-
Notifications
You must be signed in to change notification settings - Fork 135
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
fix(feature): uses server-side apply to reconile #1098
fix(feature): uses server-side apply to reconile #1098
Conversation
Aligns reconcile strategy for Managed() features to rely on Server-side apply rather than Update. Former apprach is used by deploy package when reconciling kustomize resources. Later tries to overwrite the entire resource rather than using patch which can lead to errors when trying to overwrite immutable fields such as: ``` failed to update object test-namespace/knative-local-gateway: Service "knative-local-gateway" is invalid: [metadata.resourceVersion: Invalid value: "": must be specified for an update, spec.clusterIP: Invalid value: "": field is immutable] ``` Additional changes - if "managed" annotation is present in one of the resources being part of the feature it will be respected - reworked tests to be more self-descriptive. extracted funcs were adding more hops while reading the code before understanding what is actually happening
ca19202
to
ac34a3d
Compare
if errJSON != nil { | ||
return fmt.Errorf("error converting yaml to json: %w", errJSON) | ||
} | ||
return cli.Patch(ctx, target, client.RawPatch(k8stypes.ApplyPatchType, data), client.ForceOwnership, client.FieldOwner("rhods-operator")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rhods-operator ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took it from the existing trusted bundle one. As I don't pass any owner here (like with deploy/kustomize) I thought using the same should be fine. The naming is outdated, I agree, but if we want to change it, let's change in both places in other PR.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zdtsw 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 |
9b68ea8
into
opendatahub-io:incubation
Ensures each test case deploys resources in their own namespaces to avoid sharing state between tests (sometimes unintentionally). Follow up to opendatahub-io#1098
Ensures each test case deploys resources in their own namespaces to avoid sharing state between tests (sometimes unintentionally). Follow up to #1098
Aligns reconcile strategy for Managed() features to rely on Server-side apply rather than Update. Former apprach is used by deploy package when reconciling kustomize resources. Later tries to overwrite the entire resource rather than using patch which can lead to errors when trying to overwrite immutable fields such as: ``` failed to update object test-namespace/knative-local-gateway: Service "knative-local-gateway" is invalid: [metadata.resourceVersion: Invalid value: "": must be specified for an update, spec.clusterIP: Invalid value: "": field is immutable] ``` Additional changes - if "managed" annotation is present in one of the resources being part of the feature it will be respected - reworked tests to be more self-descriptive. extracted funcs were adding more hops while reading the code before understanding what is actually happening (cherry picked from commit 9b68ea8)
Ensures each test case deploys resources in their own namespaces to avoid sharing state between tests (sometimes unintentionally). Follow up to opendatahub-io#1098 (cherry picked from commit 67309b6)
Aligns reconcile strategy for Managed() features to rely on Server-side apply rather than Update. Former apprach is used by deploy package when reconciling kustomize resources. Later tries to overwrite the entire resource rather than using patch which can lead to errors when trying to overwrite immutable fields such as: ``` failed to update object test-namespace/knative-local-gateway: Service "knative-local-gateway" is invalid: [metadata.resourceVersion: Invalid value: "": must be specified for an update, spec.clusterIP: Invalid value: "": field is immutable] ``` Additional changes - if "managed" annotation is present in one of the resources being part of the feature it will be respected - reworked tests to be more self-descriptive. extracted funcs were adding more hops while reading the code before understanding what is actually happening (cherry picked from commit 9b68ea8)
Ensures each test case deploys resources in their own namespaces to avoid sharing state between tests (sometimes unintentionally). Follow up to opendatahub-io#1098 (cherry picked from commit 67309b6)
Description
Aligns reconcile strategy for
Managed()
features to rely on Server-side apply rather than Update. The SSA approach is used bydeploy
package when reconciling kustomize resources, so keeping it the same makes sense.The previous one, based on
client.Update
call, tries to overwrite the entire resource rather than using a patch operation, which can lead to errors when trying to overwrite immutable fields such as:Additional changes
How Has This Been Tested?
In
make
we trust.Screenshot or short clip
Merge criteria