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

CAPZ with ASO doesn't work for AzureUSGovernment #4113

Open
Tracked by #3402
ionutleca opened this issue Oct 10, 2023 · 11 comments
Open
Tracked by #3402

CAPZ with ASO doesn't work for AzureUSGovernment #4113

ionutleca opened this issue Oct 10, 2023 · 11 comments
Labels
area/managedclusters Issues related to managed AKS clusters created through the CAPZ ManagedCluster Type kind/bug Categorizes issue or PR as related to a bug. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@ionutleca
Copy link

ionutleca commented Oct 10, 2023

/kind bug

What steps did you take and what happened:
The AzureManagedControlPlane supports the following parameter:

spec:
  azureEnvironment: AzureUSGovernmentCloud

The createSecretFromClusterIdentity function doesn't set azureResourceManagerEndpoint and any other cloud specific variables.

The ASO controller fails with:
The subscription '***' could not be found.: PUT https://management.azure.com/subscriptions/***/resourceGroups/***

What did you expect to happen:
CAPZ to also add to the *-aso-secret the values specific to what spec.azureEnvironment on the AzureManagedControlPlane resource points to.

Anything else you would like to add:

Environment:

  • cluster-api-provider-azure version: v1.11.1
  • Kubernetes version: (use kubectl version): v1.27.3
  • OS (e.g. from /etc/os-release): AKSUbuntu-2004gen2fipscontainerd-202309.06.0
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 10, 2023
@dtzar dtzar added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Oct 10, 2023
@Jont828
Copy link
Contributor

Jont828 commented Oct 12, 2023

/triage accepted

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Oct 12, 2023
@Jont828
Copy link
Contributor

Jont828 commented Oct 12, 2023

/assign @mboersma

@nojnhuh
Copy link
Contributor

nojnhuh commented Oct 19, 2023

It appears ASO can only configure the ARM endpoint globally for all resources it manages. I've opened an issue here to make that capability accessible at the per-resource level to match CAPZ's capabilities from before: Azure/azure-service-operator#3447.

If your management cluster is only managing workload clusters for one cloud, you could possibly modify the ASO deployment manually to configure it as you need as a stopgap.

@ionutleca
Copy link
Author

ionutleca commented Oct 23, 2023

Hi @nojnhuh, I was looking into how we could globally set the ARM endpoint url for the ASO controller but I can't find a way.

CAPZ is always setting the resource scoped secret https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/controllers/asosecret_controller.go#L235

ASO is not merging the resource and the global secret, but stops after getCredentialFromAnnotation https://github.com/Azure/azure-service-operator/blob/main/v2/internal/identity/credential_provider.go#L98-L99

Because of this, even if we do manually set the global or namespaced settings for the ASO controller, they will be ignored (unless I missed something) :(

@nojnhuh
Copy link
Contributor

nojnhuh commented Oct 23, 2023

Even if changing it in aso-controller-settings doesn't work, I suppose it would be possible to edit the ASO deployment and hardcode the value there or referring to a different secret instead of deriving it from the global ASO secret.

@nojnhuh
Copy link
Contributor

nojnhuh commented Oct 25, 2023

@ionutleca Did that workaround work for you? I'll reopen this to keep tracking making this more automatic.

@nojnhuh nojnhuh reopened this Oct 25, 2023
@ionutleca
Copy link
Author

Yes, I managed to make it work with the right values set in aso-controller-settings. Thank you!

@mboersma mboersma added this to the v1.13 milestone Dec 11, 2023
@CecileRobertMichon
Copy link
Contributor

/assign @nojnhuh
/unassign @mboersma
/cc @nawazkh

@nojnhuh
Copy link
Contributor

nojnhuh commented Dec 14, 2023

Just opened this PR to at least allow setting these fields with environment variables when CAPZ is installed. Hopefully that's at least a step in the right direction: #4390

@jackfrancis jackfrancis modified the milestones: v1.13, next Jan 16, 2024
@mboersma mboersma modified the milestones: next, v1.14 Jan 19, 2024
@nojnhuh
Copy link
Contributor

nojnhuh commented Feb 7, 2024

There's still more to iron out here re: CAPZ configuring the environment per-workload cluster and ASO only configuring it globally for all resources it manages, but I don't think I'll be able to follow up with that during this milestone.

/unassign

@nojnhuh nojnhuh modified the milestones: v1.14, next Feb 29, 2024
@dtzar dtzar added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 9, 2024
@mboersma mboersma modified the milestones: next, v1.15 Mar 13, 2024
@dtzar dtzar added the area/managedclusters Issues related to managed AKS clusters created through the CAPZ ManagedCluster Type label Mar 25, 2024
@dtzar
Copy link
Contributor

dtzar commented Apr 4, 2024

Blocked until Azure/azure-service-operator#3447

@mboersma mboersma removed this from the v1.15 milestone Apr 25, 2024
@dtzar dtzar removed the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/managedclusters Issues related to managed AKS clusters created through the CAPZ ManagedCluster Type kind/bug Categorizes issue or PR as related to a bug. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Blocked
Development

No branches or pull requests

8 participants