-
Notifications
You must be signed in to change notification settings - Fork 31
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
🌱 Set ClusterctlMoveHierarchyLabel on HelmChartProxy in CRD definition #110
🌱 Set ClusterctlMoveHierarchyLabel on HelmChartProxy in CRD definition #110
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Jont828 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 |
if helmChartProxy.Labels == nil { | ||
helmChartProxy.Labels = make(map[string]string) | ||
} | ||
helmChartProxy.Labels[clusterctl.ClusterctlMoveHierarchyLabel] = "true" |
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 alternative approach would be to have the user set the label in the YAML like here in CAPZ. That would allow users to opt-out, but the downside would be that users would have to remember to do that every time.
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.
if we decide this approach is better we could also change the CAPZ AzureClusterIdentity approach
@CecileRobertMichon @jackfrancis TL;DR HelmChartProxies need the |
@fabriziopandini do you have thoughts on this? IMO if it can always be set so the user doesn't have to worry about it that's better, but what happens if the user is using the same HelmChartProxy across several clusters and moves 1 or some of the clusters? note: if the goal is to set the label to every HelmChartProxy, the book indicates this can be done on the CRD itself so it applies to all HelmChartProxies instead of labelling each object.
https://cluster-api.sigs.k8s.io/clusterctl/provider-contract.html?highlight=move-hier#move |
@fabriziopandini do you have thoughts on this? I will suggest adding the label on the CRD definition, so it is done once and for all (no need to add on single CRs, reconcile it). |
How would we set a label on the CRD level? Would it be a kubebuilder tag? |
@fabriziopandini I tried adding the kubebuilder label based on the docs, but it doesn't seem to be working. Are there any examples of this being used?
|
You can add it by creating a kustomize patch similar to this one. Make sure to add your next patch to the kustomization file |
@fabriziopandini I've followed your suggestion and added the label to the CRD definition such that I have the following output. However, the label doesn't appear on the resources when I run
|
bd3806d
to
9292f55
Compare
@CecileRobertMichon @fabriziopandini I think I figured it out! The CRD label will only show up in the definition when it is installed through Since that pulls from the GitHub releases, we will only know for sure that it works once this is merged and we cut a new CAAPH release. However, I tested that |
@@ -0,0 +1,7 @@ | |||
# The following patch adds a directive for certmanager to inject CA into the CRD |
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.
comment needs to be updated
one nit, otherwise lgtm |
9292f55
to
de5bb35
Compare
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.
/lgtm
What this PR does / why we need it: Have the HelmChartProxy controller set the ClusterctlMoveHierarchyLabel on HelmChartProxies so that it will be discovered by
clusterctl move
.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #103