-
Notifications
You must be signed in to change notification settings - Fork 83
Set omitempty on the ManifestWork UpdateStrategy field #206
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
Merged
openshift-merge-robot
merged 1 commit into
open-cluster-management-io:main
from
mprahl:updatestrategy
Feb 13, 2023
Merged
Set omitempty on the ManifestWork UpdateStrategy field #206
openshift-merge-robot
merged 1 commit into
open-cluster-management-io:main
from
mprahl:updatestrategy
Feb 13, 2023
Conversation
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
Member
Author
|
/cc @qiujian16 |
JustinKuli
reviewed
Feb 10, 2023
When a ManifestWork without UpdateStrategy set is marshalled into JSON, it causes the JSON value of "updateStrategy": null. This works on newer versions of Kubernetes, however, on older versions such as v1.19.16, the following error is returned when creating a ManifestWork: The ManifestWork "addon-config-policy-controller-pre-delete-hosting-cluster2" is invalid: spec.manifestConfigs.updateStrategy: Invalid value: "null": spec.manifestConfigs.updateStrategy in body must be of type object: "null" The best way to avoid this is to add omitempty to the JSON tag so that it's completely not present in the JSON representation. This bug was encountered when using a predelete hook in the addon framework. So this change will need to be updated in at least the addon framework and the work agent. Relates: https://issues.redhat.com/browse/ACM-3233 https://issues.redhat.com/browse/ACM-2923 Signed-off-by: mprahl <mprahl@users.noreply.github.com>
Member
|
/approve |
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mprahl, qiujian16 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 |
openshift-merge-robot
pushed a commit
to open-cluster-management-io/governance-policy-addon-controller
that referenced
this pull request
Feb 13, 2023
This change makes it so that a finalizer is added to the config-policy-controller ManagedClusterAddOn object. Now when it is deleted, it will trigger an additional ManifestWork to create a Pod which signals to the config-policy-controller that it's being uninstalled and it waits for all ConfigurationPolicy objects to have their finalizers removed before exiting. Once the Pod exits successfully, the finalizer on the ManagedClusterAddOn object is removed and the config-policy-controller uninstall proceeds. If there are a lot of policies, it may take longer than 30 seconds, so the grace period was bumped up to 120 seconds to exit cleanly. Note that now with KIND_VERSION set to minimum, it uses a newer version for the Hub to match the lowest supported version for the Hub. This is to work around this: open-cluster-management-io/api#206 Signed-off-by: mprahl <mprahl@users.noreply.github.com>
magic-mirror-bot bot
pushed a commit
to stolostron/governance-policy-addon-controller
that referenced
this pull request
Feb 13, 2023
This change makes it so that a finalizer is added to the config-policy-controller ManagedClusterAddOn object. Now when it is deleted, it will trigger an additional ManifestWork to create a Pod which signals to the config-policy-controller that it's being uninstalled and it waits for all ConfigurationPolicy objects to have their finalizers removed before exiting. Once the Pod exits successfully, the finalizer on the ManagedClusterAddOn object is removed and the config-policy-controller uninstall proceeds. If there are a lot of policies, it may take longer than 30 seconds, so the grace period was bumped up to 120 seconds to exit cleanly. Note that now with KIND_VERSION set to minimum, it uses a newer version for the Hub to match the lowest supported version for the Hub. This is to work around this: open-cluster-management-io/api#206 Signed-off-by: mprahl <mprahl@users.noreply.github.com> (cherry picked from commit b82633184bf18fdfe1705440c30f8a1672c46702)
openshift-merge-robot
pushed a commit
to stolostron/governance-policy-addon-controller
that referenced
this pull request
Feb 14, 2023
This change makes it so that a finalizer is added to the config-policy-controller ManagedClusterAddOn object. Now when it is deleted, it will trigger an additional ManifestWork to create a Pod which signals to the config-policy-controller that it's being uninstalled and it waits for all ConfigurationPolicy objects to have their finalizers removed before exiting. Once the Pod exits successfully, the finalizer on the ManagedClusterAddOn object is removed and the config-policy-controller uninstall proceeds. If there are a lot of policies, it may take longer than 30 seconds, so the grace period was bumped up to 120 seconds to exit cleanly. Note that now with KIND_VERSION set to minimum, it uses a newer version for the Hub to match the lowest supported version for the Hub. This is to work around this: open-cluster-management-io/api#206 Signed-off-by: mprahl <mprahl@users.noreply.github.com> (cherry picked from commit b82633184bf18fdfe1705440c30f8a1672c46702)
openshift-cherrypick-robot
pushed a commit
to openshift-cherrypick-robot/governance-policy-addon-controller
that referenced
this pull request
Feb 14, 2023
This change makes it so that a finalizer is added to the config-policy-controller ManagedClusterAddOn object. Now when it is deleted, it will trigger an additional ManifestWork to create a Pod which signals to the config-policy-controller that it's being uninstalled and it waits for all ConfigurationPolicy objects to have their finalizers removed before exiting. Once the Pod exits successfully, the finalizer on the ManagedClusterAddOn object is removed and the config-policy-controller uninstall proceeds. If there are a lot of policies, it may take longer than 30 seconds, so the grace period was bumped up to 120 seconds to exit cleanly. Note that now with KIND_VERSION set to minimum, it uses a newer version for the Hub to match the lowest supported version for the Hub. This is to work around this: open-cluster-management-io/api#206 Signed-off-by: mprahl <mprahl@users.noreply.github.com> (cherry picked from commit b82633184bf18fdfe1705440c30f8a1672c46702)
mprahl
added a commit
to stolostron/governance-policy-addon-controller
that referenced
this pull request
Feb 14, 2023
This change makes it so that a finalizer is added to the config-policy-controller ManagedClusterAddOn object. Now when it is deleted, it will trigger an additional ManifestWork to create a Pod which signals to the config-policy-controller that it's being uninstalled and it waits for all ConfigurationPolicy objects to have their finalizers removed before exiting. Once the Pod exits successfully, the finalizer on the ManagedClusterAddOn object is removed and the config-policy-controller uninstall proceeds. If there are a lot of policies, it may take longer than 30 seconds, so the grace period was bumped up to 120 seconds to exit cleanly. Note that now with KIND_VERSION set to minimum, it uses a newer version for the Hub to match the lowest supported version for the Hub. This is to work around this: open-cluster-management-io/api#206 Signed-off-by: mprahl <mprahl@users.noreply.github.com> (cherry picked from commit b82633184bf18fdfe1705440c30f8a1672c46702)
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.
When a ManifestWork without UpdateStrategy set is marshalled into JSON, it causes the JSON value of "updateStrategy": null. This works on newer versions of Kubernetes, however, on older versions such as v1.19.16, the following error is returned when creating a ManifestWork: The ManifestWork "addon-config-policy-controller-pre-delete-hosting-cluster2" is invalid: spec.manifestConfigs.updateStrategy: Invalid value: "null": spec.manifestConfigs.updateStrategy in body must be of type object: "null"
The best way to avoid this is to add omitempty to the JSON tag so that it's completely not present in the JSON representation.
This bug was encountered when using a predelete hook in the addon framework. So this change will need to be updated in at least the addon framework and the work agent.
Relates:
https://issues.redhat.com/browse/ACM-3233
https://issues.redhat.com/browse/ACM-2923
Signed-off-by: mprahl mprahl@users.noreply.github.com