-
Notifications
You must be signed in to change notification settings - Fork 430
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
ASOAPI: basic automated adoption #4799
Conversation
@@ -80,6 +81,10 @@ func SetManagedClusterDefaults(ctrlClient client.Client, asoManagedControlPlane | |||
return err | |||
} | |||
|
|||
if err := setManagedClusterCredentials(ctx, cluster, managedClusterPath, managedCluster); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asoctl import
doesn't populate any configuration for ASO to generate a kubeconfig Secret for the cluster, so CAPZ will now take responsibility for doing that if it's not already defined. This smooths out adoption by letting users essentially pipe the asoctl
output straight to kubectl apply
.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4799 +/- ##
==========================================
- Coverage 62.74% 61.93% -0.82%
==========================================
Files 199 201 +2
Lines 16507 16821 +314
==========================================
+ Hits 10358 10418 +60
- Misses 5379 5620 +241
- Partials 770 783 +13 ☔ View full report in Codecov by Sentry. |
Known gaps here:
|
) | ||
|
||
// AgentPoolAdoptReconciler adopts ASO ManagedClustersAgentPool resources into a CAPI Cluster. | ||
type AgentPoolAdoptReconciler struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if "import" would be a better term to use in the actual code (rather than "adopt"). What other use cases does "detect that an ASO resource doesn't have an equivalent CAPI/CAPZ resource" serve besides "adoption" in the sense that we've been discussing? (which I'd summarize as "purposefully migrate cluster lifecycle management of an existing cluster to Cluster API")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean you find one of those terms more general or specific than the other? To me "adopt" and "import" seem synonymous enough that I'm not sure I follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer the term "adopt" since "import" is more related to getting the ASO Spec that matches an existing resource, while CAPZ is actively managing something that is adopted. Like Jon mentioned I think they are pretty similar too, so it can go either way.
<!-- markdown-link-check-disable-next-line --> | ||
The [experimental AzureASOManagedControlPlane and related APIs](/topics/aso.html#experimental-aso-api) support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link checker doesn't seem to like linking to a dynamically generated domain-local path like this. The link as it appears in the docs preview here seems to work though: https://deploy-preview-4799--kubernetes-sigs-cluster-api-provider-azure.netlify.app/topics/managedcluster#option-1-using-the-experimental-aso-based-api
/retest |
- Adopting existing clusters created with the GA AzureManagedControlPlane API to the experimental API with | ||
this method is theoretically possible, but untested. Care should be taken to prevent CAPZ from reconciling | ||
two different representations of the same underlying Azure resources. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be helpful to include an example of what the spec will look like for using the ASO experimental API. I'm following this and created the ASO resources but as a first-time user, I'm not sure how to incorporate that into a CAPZ spec. I think it also might help to link to the ASO API docs from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a link to the flavor template in the docs in #4802. Does that help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup that looks good!
/lgtm |
LGTM label has been added. Git tree hash: 2de65e57bb0a50d45bea989528d5b4f0bef346af
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jackfrancis The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold for squashing commits |
squashed! |
/retest |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR implements an automated adoption mechanism for ASOAPI-based clusters. It works by watching ASO ManagedClusters and ManagedClustersAgentPools with a sentinel
sigs.k8s.io/cluster-api-provider-azure-adopt=true
annotation and scaffolds the CAPZ/CAPI resources around them required to represent a full Cluster API Cluster. It's designed to work in conjunction withasoctl import azure-resource
in order to work with any pre-existing AKS cluster, though any ASO YAML should work.This PR currently includes the changes from #4798 in the first two commits, but I'll merge
main
into this branch after that merges to keep this PR diff clean.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Part of #4713 and related to #1173
Special notes for your reviewer:
TODOs:
Release note: