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

Simplify managed fields upgrade from CSA to SSA #319

Merged
merged 1 commit into from
May 7, 2024

Conversation

erikgb
Copy link
Contributor

@erikgb erikgb commented Mar 7, 2024

This PR simplifies the upgrade from CSA to SSA by using the helper provided by upstream Kubernetes and also used by kubectl. There is a theoretical change in behavior when upgrading after this PR, since the helper does not take the target configmap key into account when upgrading. Which means there could potentially be another operator/controller using the c/r regression field manager. I still think the simplification of code and RBAC is worth this minor risk.

@jetstack-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@jetstack-bot jetstack-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. labels Mar 7, 2024
@jetstack-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from erikgb. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

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

@jetstack-bot jetstack-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 7, 2024
@erikgb erikgb force-pushed the simplify-ssa-upgrade branch 2 times, most recently from 199b81c to 8cf4122 Compare May 6, 2024 16:16
@erikgb
Copy link
Contributor Author

erikgb commented May 6, 2024

/test all

@erikgb erikgb changed the title refactor: simplify managed fields upgrade Simplify managed fields upgrade from CSA to SSA May 6, 2024
Signed-off-by: Erik Godding Boye <egboye@gmail.com>
@erikgb erikgb marked this pull request as ready for review May 6, 2024 18:56
@cert-manager-prow cert-manager-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 6, 2024
@erikgb
Copy link
Contributor Author

erikgb commented May 6, 2024

/unhold
/cc @inteon

@cert-manager-prow cert-manager-prow bot requested a review from inteon May 6, 2024 18:56
@cert-manager-prow cert-manager-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 6, 2024
@erikgb
Copy link
Contributor Author

erikgb commented May 6, 2024

/test pull-trust-manager-verify

@inteon
Copy link
Member

inteon commented May 7, 2024

Thanks @erikgb.
Great work upstreaming support for sub-resources.
/approve
/lgtm

@cert-manager-prow cert-manager-prow bot added the lgtm Indicates that a PR is ready to be merged. label May 7, 2024
@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2024
@cert-manager-prow cert-manager-prow bot merged commit 5398155 into cert-manager:main May 7, 2024
4 checks passed
if !needsUpdate {
return false, nil
if patch != nil {
return true, b.client.Patch(ctx, obj, client.RawPatch(types.JSONPatchType, patch))
Copy link
Member

Choose a reason for hiding this comment

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

This is quite a neat trick: instead of update, patch (JSON instead of ssa) is used so there is no extra rbac necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants