cluster-api icon indicating copy to clipboard operation
cluster-api copied to clipboard

:bug: Ensure Kubeadmconfig is reconciled after datasecretname is set

Open killianmuldoon opened this issue 3 years ago • 1 comments

Signed-off-by: killianmuldoon [email protected]

This changes the order in which the bootstrap reconciliation is done in the Machine controller to ensure the ownerReference, and other changes, are set after the dataSecretName has been set. This is designed to help in backup and restore use cases, or any other case where the ownerReference is removed.

In the previous code once the dataSecretName is set the KubeadmConfigTemplate never has its ownerReferences and labels reconciled. This change makes the reconcile loop always attempt to make changes to the bootstrap object, even if the secret name has previously been set.

#6980

killianmuldoon avatar Oct 11 '22 15:10 killianmuldoon

This changes the order in which the bootstrap reconciliation is done in the Machine controller to ensure the ownerReference, and other changes, are set after the dataSecretName has been set.

"are set after the dataSecretName has been set" should be "are set before the dataSecretName has been set", right?

(or rather before we check for if dataSecretName is set and then just return)

sbueringer avatar Nov 03 '22 13:11 sbueringer

"are set after the dataSecretName has been set" should be "are set before the dataSecretName has been set", right? (or rather before we check for if dataSecretName is set and then just return)

Sorry for the ambiguity here - this was meant to mean after it's set on the object, rather than referencing when the check happens.

killianmuldoon avatar Nov 03 '22 14:11 killianmuldoon

No worries! I understood what the plan was independent of the phrasing :)

/lgtm

/assign @fabriziopandini for approval

sbueringer avatar Nov 03 '22 15:11 sbueringer

/lgtm

is this a candidate for cherry-pick?

CecileRobertMichon avatar Nov 04 '22 20:11 CecileRobertMichon

is this a candidate for cherry-pick? I think yes

/cherry-pick release-1.2

@fabriziopandini Can you take a final look at this PR?

sbueringer avatar Nov 07 '22 11:11 sbueringer

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-1.2 in a new PR and assign it to you.

In response to this:

is this a candidate for cherry-pick? I think yes

/cherry-pick release-1.2

@fabriziopandini Can you take a final look at this PR?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

/lgtm

sbueringer avatar Nov 07 '22 11:11 sbueringer

great work! /lgtm /approve

fabriziopandini avatar Nov 07 '22 15:11 fabriziopandini

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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:
  • ~~OWNERS~~ [fabriziopandini]

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Nov 07 '22 15:11 k8s-ci-robot

@sbueringer: #7394 failed to apply on top of branch "release-1.2":

Applying: Ensure Kubeadmconfig is reconciled after datasecretname is set
Using index info to reconstruct a base tree...
M	internal/controllers/machine/machine_controller_phases.go
Falling back to patching base and 3-way merge...
Auto-merging internal/controllers/machine/machine_controller_phases.go
CONFLICT (content): Merge conflict in internal/controllers/machine/machine_controller_phases.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Ensure Kubeadmconfig is reconciled after datasecretname is set
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

is this a candidate for cherry-pick? I think yes

/cherry-pick release-1.2

@fabriziopandini Can you take a final look at this PR?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.