Move server-side apply function to a shared package#4297
Merged
cbandy merged 2 commits intoCrunchyData:mainfrom Sep 22, 2025
Merged
Move server-side apply function to a shared package#4297cbandy merged 2 commits intoCrunchyData:mainfrom
cbandy merged 2 commits intoCrunchyData:mainfrom
Conversation
Kubernetes 1.22 and OpenShift 4.8 have been out of commission for some time now.
benjaminjb
reviewed
Sep 19, 2025
benjaminjb
reviewed
Sep 19, 2025
| if !equality.Semantic.DeepEqual(actual.Selector, intent.Selector) { | ||
| patch.Replace(append(path, "selector")...)(intent.Selector) | ||
| } | ||
| return runtime.Apply(ctx, r.Writer, object) |
Contributor
There was a problem hiding this comment.
Are you thinking about a separate PR to remove this file and change the many applys in internal/controller/postgrescluster?
Member
Author
There was a problem hiding this comment.
I wasn't planning on it, but that seems reasonable. I skipped it here because it is called a lot.
benjaminjb
reviewed
Sep 19, 2025
| // | ||
| // The "metadata.finalizers" field is also okay. | ||
| // - https://book.kubebuilder.io/reference/using-finalizers.html | ||
| // |
Contributor
There was a problem hiding this comment.
Highly recommend turning off whitespace differences to see what's actually going on here for anyone reviewing this
benjaminjb
reviewed
Sep 19, 2025
|
|
||
| var suite struct { | ||
| Client client.Client | ||
| Config *rest.Config |
Contributor
There was a problem hiding this comment.
Oh, the only use of ServerVersion was in the test in internal/controller/postgrescluster/controller_test.go where we were checking for older versions of k8s than we care about, ah
benjaminjb
approved these changes
Sep 19, 2025
Multiple controllers had a method for this, but the implementations differed slightly. This combines their fixes and tests them in a single place.
bebf797 to
02a345e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multiple controllers had a method for this, but the implementations differed slightly. This combines their fixes and tests them in a single place.
Checklist:
Type of Changes: