Skip to content
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

config/v1/types_cluster_version: Make Update properties omitempty #992

Closed

Conversation

wking
Copy link
Member

@wking wking commented Aug 17, 2021

This type used to be used for both the admin-provided spec.desiredUpdate and the operator-provided status.desired. That changed in 575f8d2 (#521, 4.6), when status.desired moved to a new Release type, so now Update is only used for spec.desiredUpdate.

The properties have been +optional since they landed in 898d7e3 (#127) and ab4ff93 (#293).

I'm adding omitempty, because if the admin doesn't have a particular version or image in mind, returning explicit empty strings is distracting noise. With this commit, it will be easier to focus on the version or image property that did get set, and you need at least one of them to be set to be a usable update request.

The force property is a bit more wiggly, since there may be some benefit to explicitly pointing out that the admin is not forcing the update. But forcing is supposed to be an exceptional-situation safety valve, so I'm adding omitempty there too, because the benefit of de-emphasizing the property's presence (and reducing the chance that an admin says "hey, let's see what force: true does" without reading associated docs) outweighs the benefit of explicitly pointing out force: false cases.

This type used to be used for both the admin-provided
spec.desiredUpdate and the operator-provided status.desired.  That
changed in 575f8d2 (config/v1: New Release type for
ClusterVersionStatus, 2019-01-19, openshift#521, 4.6), when status.desired
moved to a new Release type, so now Update is only used for
spec.desiredUpdate.

The properties have been '+optional' since they landed in 898d7e3
(api: Move ClusterVersion/ClusterOperator into config.openshift.io,
2018-11-09, openshift#127) and ab4ff93 (Update ClusterVersion to have a
'force' update flag and track verified, 2019-04-22, openshift#293).

I'm adding 'omitempty', because if the admin doesn't have a particular
version or image in mind, returning explicit empty strings is
distracting noise.  With this commit, it will be easier to focus on
the version or image property that did get set, and you need at least
one of them to be set to be a usable update request.

The force property is a bit more wiggly, since there may be some
benefit to explicitly pointing out that the admin is not forcing the
update.  But forcing is supposed to be an exceptional-situation safety
valve, so I'm adding omitempty there too, because the benefit of
de-emphasizing the property's presence (and reducing the chance that
an admin says "hey, let's see what 'force: true' does" without reading
associated docs) outweighs the benefit of explicitly pointing out
'force: false' cases.
Copy link
Member

@LalatenduMohanty LalatenduMohanty left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 17, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: LalatenduMohanty, wking
To complete the pull request process, please assign knobunc after the PR has been reviewed.
You can assign the PR to them by writing /assign @knobunc in a comment when ready.

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

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

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2021
@@ -253,7 +253,7 @@ type Update struct {
// or potentially malicious sources.
//
// +optional
Force bool `json:"force"`
Force bool `json:"force,omitempty"`
Copy link

Choose a reason for hiding this comment

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

This doesn't make any sense, the default false is not empty but false, in which case you'll always get that. So I'd propose dropping this. It would only make sense with pointer bool. strings changes are good.

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 4, 2022
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 3, 2022
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Mar 5, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 5, 2022

@openshift-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants