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

feat: Enable server-side-apply on direct applier #399

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

yuwenma
Copy link
Contributor

@yuwenma yuwenma commented Jul 3, 2024

This will fix the "annotation too long" problem when the managed manifests are too large.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Additional documentation:

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 3, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 3, 2024
@@ -170,6 +170,7 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
applyOpts.PruneResources = append(applyOpts.PruneResources, r...)
}

applyOpts.ServerSideApply = true
Copy link
Member

Choose a reason for hiding this comment

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

Should this maybe be behind a feature flag, to allow users to choose when to enable this behavior? If so, could probably be done in the set of flags parsed some 20-ish lines above this one.

(I'm all for it, and would probably enable it first thing, but given that transitioning from CSA to SSA is not always straightforward, it might be worth giving the user a choice here; if nothing else, it enables bumping this library for other reasons without being forced to also manage the transition.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review @tomasaschan and sorry for the late reply. Changing this to a feature flag makes sense! I changed it as a feature specific to the direct applier rather than another field in ApplyOption (interface level), because we cannot guarantee every implemented applier can support SSA.

Also, since the SSA is a boolean type, to avoid confusing between unset vs default to false, I used a preferred option to distinguish whether it is configured or not.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 30, 2024
This will fix the  "annotation too long" problem when the managed manifests are too large.
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 6, 2024
inner directApplierSite
}

func (d *DirectApplier) UseServerSideApply() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use a dedicated function to make the flag more discoverable.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 9, 2024
@justinsb
Copy link
Contributor

justinsb commented Sep 9, 2024

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, yuwenma

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

@k8s-ci-robot k8s-ci-robot merged commit 57a043f into kubernetes-sigs:master Sep 9, 2024
6 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants