Skip to content

Enable Server-Side Apply for finalizers management#1322

Open
enarha wants to merge 1 commit into
tektoncd:mainfrom
enarha:switch-finalizers-ssa
Open

Enable Server-Side Apply for finalizers management#1322
enarha wants to merge 1 commit into
tektoncd:mainfrom
enarha:switch-finalizers-ssa

Conversation

@enarha
Copy link
Copy Markdown
Contributor

@enarha enarha commented May 4, 2026

Leverages functionality added here:
knative/pkg#3275
Options documented here:
https://github.com/knative/pkg/blob/main/controller/options.go#L31-L40

Added migration cleanup process, for inflight objects caught between the old version (using merge patch) and the new version (using SSA patch). It could be removed once all supported versions using merge patch become EOL. That code add minimal overhead and no extra API calls.

Assisted-by: Claude Code

Changes

/kind enhancement

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user-facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Switch finalizer management to Server-Side Apply patch to improve performance and reduce API load.

@tekton-robot
Copy link
Copy Markdown

@enarha: The label(s) kind/enhancement cannot be applied, because the repository doesn't have them.

Details

In response to this:

Leverages functionality added here:
knative/pkg#3275
Options documented here:
https://github.com/knative/pkg/blob/main/controller/options.go#L31-L40

Changes

/kind enhancement

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user-facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Switch finalizer management to Server-Side Apply patch to improve performance and reduce API load.

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.

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 4, 2026
@tekton-robot tekton-robot requested review from divyansh42 and khrm May 4, 2026 11:02
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 4, 2026
@enarha
Copy link
Copy Markdown
Contributor Author

enarha commented May 4, 2026

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label May 4, 2026
Copy link
Copy Markdown
Member

@aThorp96 aThorp96 left a comment

Choose a reason for hiding this comment

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

/approve

Before merging, are there any tradeoffs to using serversideapply here? I remember the discussion that led to exploring serversideapply, but I don't remember if there were any drawbacks discussed

SkipStatusUpdates: true,
ConfigStore: configStore,
FinalizerName: "results.tekton.dev/pipelinerun",
UseServerSideApplyForFinalizers: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be a feature flag or is it safe/stable enough to hardcode as enabled?

Copy link
Copy Markdown
Contributor Author

@enarha enarha May 12, 2026

Choose a reason for hiding this comment

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

I contributed that functionality to Knative, but it's an opt-in feature, so not sure really how widely it's used. IMO that's too low level stuff and not really related to Tekton or the Results functionality, to expose to users to configure and only makes the configuration even more complex. With that said, on the project level we can take more cautious approach and only enable it to a single component before enabling it to all. The real benefit though will come when all components/controllers acting on the same objects enable it.
The only risk IMO is the transition from merge patch to SSA for the in-flight objects. I was sure with SSA this works (SSA will update the object unless there is a clash of ownership - another SSA manager updated the same field), but I'm testing this scenario now and it looks like it does not. I'm looking into that now, thus put the PR on hold.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aThorp96 to add just one more thing, we already use SSA for managing the annotations. That was done almost a year ago. Now we switch the finalizers management. So in terms of "technology", we already use SSA for some time now.

@tekton-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aThorp96
To complete the pull request process, please ask for approval from enarha after the PR has been reviewed.

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

Details 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

@enarha
Copy link
Copy Markdown
Contributor Author

enarha commented May 12, 2026

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 12, 2026
@enarha enarha force-pushed the switch-finalizers-ssa branch from 65bd2bd to ac346fe Compare May 13, 2026 17:23
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 13, 2026
Leverages functionality added here:
knative/pkg#3275
Options documented here:
https://github.com/knative/pkg/blob/main/controller/options.go#L31-L40

Added migration cleanup process, for inflight objects caught between the
old version (using merge patch) and the new version (using SSA patch).
It could be removed once all supported versions using merge patch become
EOL. That code add minimal overhead and no extra API calls.

Assisted-by: Claude Code
@enarha enarha force-pushed the switch-finalizers-ssa branch from ac346fe to 80f391d Compare May 14, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/misc Categorizes issue or PR as a miscellaneuous one. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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