-
Notifications
You must be signed in to change notification settings - Fork 422
OCPBUGS-8356: pkg/cli/admin/upgrade: Use JSON Patch #1418
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
Conversation
In 4.11.0 [1] and 4.10.14 [2], I ported 'oc adm upgrade --to ...' and friends from POST to PATCH. I used MergePatchType, based on [3] RFC 7386 [4], which isn't powerful enough to clear 'omitempty' zero-value properties in the `Update` structure to clear any in-cluster values for that property. Luckily, we currently have no 'omitempty' Update properties [5]. But this commit transitions us to the more explict RFC 6902 JSON Patch [6], to ensure complete control over spec.desiredUpdate with the PATCH, even if Update grows 'omitempty' properties in the future. I'm also taking the opportunity to transition to complete Marshal serialization, instead of using Sprintf to hand-craft part of the JSON patch body. This reduces the chances of coding typos introducing invalid-JSON issues. [1]: https://bugzilla.redhat.com/show_bug.cgi?id=2075647#c6 [2]: https://bugzilla.redhat.com/show_bug.cgi?id=2077332#c7 [3]: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment [4]: https://www.rfc-editor.org/rfc/rfc7386 [5]: https://github.com/openshift/api/blob/8bbcb7ca71836dc87cce3ef63647403dc9d0fbea/config/v1/types_cluster_version.go#L454-L495 [6]: https://www.rfc-editor.org/rfc/rfc6902
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wking The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@wking: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
|
@wking: This pull request references Jira Issue OCPBUGS-8356, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
/hold We'll want this as part of addressing OCPBUGS-8356, but we'll also want the API bump to make |
|
I've floated openshift/api#1455 with the /jira refresh |
|
@wking: This pull request references Jira Issue OCPBUGS-8356, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
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. |
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
|
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
|
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
|
@wking: This pull request references Jira Issue OCPBUGS-8356. The bug has been updated to no longer refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
@openshift-bot: Closed this PR. DetailsIn response to this:
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. |
In 4.11.0 (#1111) and 4.10.14 (#1114), I ported
oc adm upgrade --to ...and friends from POST to PATCH. I usedMergePatchType, based on RFC 7386, which isn't powerful enough foromitemptyzero-value properties in theUpdatestructure to clear any in-cluster values for that property. Luckily, we currently have noomitemptyUpdate properties. But this commit transitions us to the more explict RFC 6902 JSON Patch, to ensure complete control overspec.desiredUpdatewith the PATCH, even ifUpdategrows 'omitempty' properties in the future.I'm also taking the opportunity to transition to complete
Marshalserialization, instead of usingSprintfto hand-craft part of the JSON patch body. This reduces the chances of coding typos introducing invalid-JSON issues.