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

create public IP before AKS cluster #1141

Merged
merged 1 commit into from
Jan 22, 2025
Merged

create public IP before AKS cluster #1141

merged 1 commit into from
Jan 22, 2025

Conversation

geoberle
Copy link
Collaborator

What this PR does

create implicit dependency between public egress IP address and AKS cluster. this way bicep will only start the AKS creation/modification once the public IP is created and ready.

additionally persist the registration of the Microsoft.Network/AllowBringYourOwnPublicIpAddress AFEC flag, which is required to bring our own egress IP for the AKS cluter.

Jira:
Link to demo recording:

Special notes for your reviewer

@@ -389,7 +389,7 @@ resource aksCluster 'Microsoft.ContainerService/managedClusters@2024-04-02-previ
outboundIPs: {
publicIPs: [
{
id: resourceId('Microsoft.Network/publicIPAddresses', aksClusterOutboundIPAddressName)
id: aksClusterOutboundIPAddress.outputs.publicIPAddressId
Copy link
Collaborator

Choose a reason for hiding this comment

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

That did not work in my previous testing and I just tried it again:

Preflight validation check for resource(s) for container service aro-hcp-aks in resource group hcp-underlay-usw3jche-svc failed. Message: Error parsing provided IP of [reference(resourceId('Microsoft.Resources/deployments', variables('aksClusterOutboundIPAddressName')), '2022-09-01').outputs.publicIPAddressId.value]. Error parsing failed for [reference(resourceId('Microsoft.Resources/deployments', variables('aksClusterOutboundIPAddressName')), '2022-09-01').outputs.publicIPAddressId.value]. Invalid resource Id format.

My understanding is this is apparently due to how bicep modules are processed in ARM and how it only produces outputs after the module deployment is completed. As such, it cannot provide the ID to the AKS cluster resource and ARM wants an ID, not a reference to one

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 just realized you are right. it works well when the IP exists already but fails on a preflight check in EV2. i'll try something else. see the updated PR

Copy link
Collaborator

Choose a reason for hiding this comment

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

I had also refrained to use dependsOn because Azure discourages it and having never encountered timing issues in my testing I assumed somehow Azure was figuring out the dependency with resourceId()

That said nothing complains if we add the resource to dependsOn so lets do that for now to avoid the timing issues

@jfchevrette
Copy link
Collaborator

Is this meant to solve an issue you encountered? I must have provisioned at least 20 clusters throughout my testing of #1103 and never encountered a dependency or missing resource error

@geoberle
Copy link
Collaborator Author

Is this meant to solve an issue you encountered? I must have provisioned at least 20 clusters throughout my testing of #1103 and never encountered a dependency or missing resource error

there can be timing issues, e.g. when IP address creation is delayed and the AKS cluster creation is making faster progress. i reverted the id reference change and instead created an explicit dependency from the AKS cluster to the public IP address module.

this PR sets up implicit dependency between the public egress IP address creation and the AKS cluster that will use it.

Signed-off-by: Gerd Oberlechner <[email protected]>
@geoberle geoberle merged commit 9773683 into main Jan 22, 2025
22 checks passed
@geoberle geoberle deleted the aks-egress-ip-fix branch January 22, 2025 12:59
janboll pushed a commit that referenced this pull request Jan 22, 2025
this PR sets up implicit dependency between the public egress IP address creation and the AKS cluster that will use it.

Signed-off-by: Gerd Oberlechner <[email protected]>
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