Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ees 4807 small tweaks after merge #4725

Merged
merged 19 commits into from
May 3, 2024

Conversation

duncan-at-hiveit
Copy link
Collaborator

@duncan-at-hiveit duncan-at-hiveit commented Mar 28, 2024

This PR:

  • changes Container App Environment to be internal rather than having a Public IP address, in preparation for adding an Application Gateway in front, as requested by the Security Architecture group.
  • adds in a conditional flag to omit the Container App from deployment until a user-assigned managed identity has been created and assigned the AcrPull role.
  • swaps out the conditional inclusion of chunks of YAML in the pipeline for different environments (which turned out not to be working!) with "condition" property on Stages based on the current branch.
  • removes PSQL VNet integration in favour of enabling public SQL access to whitelisted IP address ranges, as per existing SQL Server setups. In the future this will be resolved for VNet traffic by EES-5052, by adding a Private Endpoint linking PSQL to the VNet.
  • adds additional necessary subnets to the main ARM template's control.
  • adds new appsettings to Container App, and SQL connection string secret creation for Admin, Publisher and Data Processor.
  • amends the initial migration of the Container App to allow all PSQL db users to have access to future tables as well as initial ones.

Optimisation flag for PSQL

I've added a flag for effectively skipping the PSQL stage of the deploy, as currently it seems that PSQL attempts to update every single time that we do a Public API Inf deploy, which leads to at least 5 minutes extra deploy time and at worst about 13 minutes extra. We need to work out what is causing it to redeploy each time even when nothing has changed. It may be down to the child "databases" and "firewallRules" resources, which could potentially be solved by moving them out into top-level resources in the postgres module rather than as child resources, but haven't investigated yet.

@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 8 times, most recently from 0441b9d to 10a342c Compare March 28, 2024 17:20
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 6 times, most recently from 082d603 to 027c418 Compare April 8, 2024 15:28
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 4 times, most recently from 5c1fff4 to d016e5d Compare April 16, 2024 12:28
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 9 times, most recently from 26bdbfe to ed004c8 Compare May 2, 2024 11:24
…onditionally including stages in pipeline based on variable values, as this turned out to not be working correctly
…y if the user-assigned Managed Identity has been created yet
… allow the ARM template to control the VNet and all subnets, and have the Bicep template look them up
…for provision by the VNet. Updating Container App Environment subnet to allow greater IP range. Switching Container App Environment to be internal by default to prevent the creaton of an unprotected Public IP Address.
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 2 times, most recently from 96f76d0 to 7cb0043 Compare May 2, 2024 12:37
…rmissions for future tables created in the public_data db to various Managed Identity users
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch from 7cb0043 to 254d5fc Compare May 2, 2024 13:03
…eploy with a single "deployContainerApp" flag instead
…eploy with a single "deployContainerApp" flag instead
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 2 times, most recently from 19375c1 to 669a617 Compare May 2, 2024 14:23
…ss PSQL. Added flag to avoid unnecessary PSQL deploys if possible. Added more connection strings to Key Vault and amended KV secret names to reflect existing naming conventions.
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 2 times, most recently from 9abf33a to cb5c52f Compare May 2, 2024 15:22
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 3 times, most recently from b46e2e1 to 3d299d8 Compare May 3, 2024 07:53
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch 2 times, most recently from 1507d1a to 1d36f57 Compare May 3, 2024 08:46
…prior to merging back into dev. Removing references to EES-5052 from Bicep files as we will be replacing VNet integration with Private Endpoint as part of the EES-5052 work.
@duncan-at-hiveit duncan-at-hiveit force-pushed the EES-4807-small-tweaks-after-merge branch from 24e8fa3 to 3356200 Compare May 3, 2024 08:52
Comment on lines 62 to 65
// Note that this has been added temporarily to avoid 10+ minute deploys where it appears that PSQL will redeploy even if no changes exist in
// this deploy from the previous one.
@description('Does the PostgreSQL Flexible Server require any updates? False by default to avoid unnecessarily lengthy deploys.')
param updatePsqlFlexibleServer bool = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we could create a new ticket to investigate this and tidy it up, or create an overarching tidy-up ticket to begin listing any stuff like this that still needs looking at.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created https://dfedigital.atlassian.net/browse/EES-5128 to cover this, and added some TODOs to the codebase to reference it.

Comment on lines +197 to 199
resource apiContainerAppManagedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = if (deployContainerApp) {
name: apiContainerAppManagedIdentityName
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be inside the containerApp module rather than in main?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created https://dfedigital.atlassian.net/browse/EES-5128 to cover this, and added a TODO to the codebase to reference it.

Comment on lines +235 to +236
name: 'ParquetFiles__BasePath'
value: 'data/public-api-parquet'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a new ticket creating on configuring this Azure File Share at some point, in order to mount the data directory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +262 to +264
dependsOn: [
postgreSqlServerModule
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if this is still required? If deployContainerApp is true and updatePsqlFlexibleServer is false would this work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, so this is in the situation where updatePsqlFlexibleServer is false. In that case, it's dependent on postgreSqlServerModule being complete before continuing - we have to be explicit about the dependency because we're not using any actual values from the postgreSqlServerModule output in this definition.

If updatePsqlFlexibleServer is true, postgreSqlServerModule will be undefined, and any undefined references in the dependsOn array get ignored, so this module can just deploy immediately.

@benoutram benoutram self-requested a review May 3, 2024 10:36
@duncan-at-hiveit duncan-at-hiveit merged commit 92fdf5d into dev May 3, 2024
4 of 7 checks passed
@duncan-at-hiveit duncan-at-hiveit deleted the EES-4807-small-tweaks-after-merge branch May 3, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants