-
Notifications
You must be signed in to change notification settings - Fork 515
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
Conversation
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.
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.
/lgtm
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LalatenduMohanty, wking 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 |
@@ -253,7 +253,7 @@ type Update struct { | |||
// or potentially malicious sources. | |||
// | |||
// +optional | |||
Force bool `json:"force"` | |||
Force bool `json:"force,omitempty"` |
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.
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.
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 |
@openshift-bot: Closed this PR. In 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. |
This type used to be used for both the admin-provided
spec.desiredUpdate
and the operator-providedstatus.desired
. That changed in 575f8d2 (#521, 4.6), whenstatus.desired
moved to a newRelease
type, so nowUpdate
is only used forspec.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 particularversion
orimage
in mind, returning explicit empty strings is distracting noise. With this commit, it will be easier to focus on theversion
orimage
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 addingomitempty
there too, because the benefit of de-emphasizing the property's presence (and reducing the chance that an admin says "hey, let's see whatforce: true
does" without reading associated docs) outweighs the benefit of explicitly pointing outforce: false
cases.