-
Notifications
You must be signed in to change notification settings - Fork 584
api: Move ClusterVersion/ClusterOperator into config.openshift.io #127
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
api: Move ClusterVersion/ClusterOperator into config.openshift.io #127
Conversation
|
/assign @deads2k |
|
/cc @gabemontero |
31d6063 to
570e1fa
Compare
|
Note that both dependency updating and go tests in the config pkg seem broken |
config/v1/json.go
Outdated
| "regexp" | ||
| ) | ||
|
|
||
| // reUUID4 uses a regexp to avoid taking a dependency on a UUID library for now |
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.
apimachinery already has one: https://github.com/kubernetes/apimachinery/blob/master/pkg/util/uuid/uuid.go
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.
We don't actually depend on that, so that brings in a whole mess of new dependencies
config/v1/json.go
Outdated
| var reUUID4 = regexp.MustCompile(`^[a-fA-F\d]{8}-[a-fA-F\d]{4}-4[a-fA-F\d]{3}-[89abAB][a-fA-F\d]{3}-[a-fA-F\d]{12}$`) | ||
|
|
||
| // UnmarshalJSON unmarshals RFC4122 uuid from string. | ||
| func (cid *ClusterID) UnmarshalJSON(b []byte) error { |
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.
are you sure you want to do this? it will prevent deserialization client-side. I would stay away from this and enforce it as a CRD validator.
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 was being enforced in CVO right now. We won't be able to enforce this with a naive validator.
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.
I agree with the point
| type ClusterOperatorStatus struct { | ||
| // conditions describes the state of the operator's reconciliation functionality. | ||
| // +patchMergeKey=type | ||
| // +patchStrategy=merge |
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.
these don't work for CRDs. Prefer removing them.
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.
They would actually work locally if you ran the apply patch code in client-go against these types.
| type ClusterStatusConditionType string | ||
|
|
||
| const ( | ||
| // OperatorAvailable indicates that the binary maintained by the operator (eg: openshift-apiserver for the |
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.
@derekwaynecarr suggests "operand" for "binary maintained by the 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.
Ugh, I hate that word.
config/v1/types_cluster_version.go
Outdated
| // it will use the appropriate update server for the cluster and region. | ||
| // | ||
| // +optional | ||
| Upstream *URL `json:"upstream"` |
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.
Why would we distinguish between "" and nil?
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.
No need to, but will have to refactor the CVO for it.
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.
IMO nil is valid option, saying i do not care use your default. But "" should be an error.
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.
IMO
nilis valid option, saying i do not care use your default. But "" should be an error.
Why not make "" mean "I don't care, use the default" and eliminate the invalid case for users to stumble on?
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.
Actually, do we want to be able to disable upstream? If so, we should explicitly model that I think.
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.
That would probably usually be
UpdateServer *UpdateServer
...
type UpdateServer struct {
// defaults to the appropriate location
URL string
}
or
DisableUpdates bool
Upstream URL
We want the unusual conditions to be opted in - bools that default to true are too confusing for users.
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.
bools that default to true are too confusing for users.
bools that default to true are too confusing for everyone
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.
yes.
How about I take the follow up to add disablement as a net new field, with clear semantics that fit into "auto update" as a multi level thing:
- I want nothing (don't even talk to anyone about updates)
- I want to get versions from redhat [default]
- I want to get versions from my custom server
- I want to automatically update to those versions
| } | ||
|
|
||
| // URL is a thin wrapper around string that ensures the string is a valid URL. | ||
| type URL string |
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.
we haven't be assiduous about this. Would you like to be? I have no strong feelings.
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.
Carry over from the CVO. I think used judiciously it is good, but can be taken too far.
config/v1/json.go
Outdated
| ) | ||
|
|
||
| // reUUID4 uses a regexp to avoid taking a dependency on a UUID library for now | ||
| var reUUID4 = regexp.MustCompile(`^[a-fA-F\d]{8}-[a-fA-F\d]{4}-4[a-fA-F\d]{3}-[89abAB][a-fA-F\d]{3}-[a-fA-F\d]{12}$`) |
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.
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.
I'm going to move this into the CVO, David is right that client side validation doesn't work in the long run. We already need to reflect validation errors back to the ClusterVersion status, so we might as well put that there.
570e1fa to
8ce86d9
Compare
|
Comments addressed. |
These types are used by the cluster version operator to update a cluster and to report on the status of the cluster as the admin would see it. The ClusterVersion and ClusterOperator types were created in the cluster version operator and are now stable enough to be moved here.
8ce86d9 to
898d7e3
Compare
|
Just the namespace vs cluster scope that we spoke about in person. lgtm otherwise |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, smarterclayton 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 |
The typo was originally from 898d7e3 (api: Move ClusterVersion/ClusterOperator into config.openshift.io, 2018-11-09, openshift#127). The "any operator" bit explains why we don't want, for example, ingress-operator specific config in here. The later ClusterOperatorSpec comment goes into more detail on that with its 'pause' hypothetical, but a bit of extra hinting can't hurt ;).
…etes ecosystem" The abbreviated wording was originally from 898d7e3 (api: Move ClusterVersion/ClusterOperator into config.openshift.io, 2018-11-09, openshift#127). But using the full name in these docs gives readers one less abbreviation to recognize.
The typo was originally from 898d7e3 (api: Move ClusterVersion/ClusterOperator into config.openshift.io, 2018-11-09, openshift#127). The "any operator" bit explains why we don't want, for example, ingress-operator specific config in here. The later ClusterOperatorSpec comment goes into more detail on that with its 'pause' hypothetical, but a bit of extra hinting can't hurt ;).
The typo was originally from 898d7e3 (api: Move ClusterVersion/ClusterOperator into config.openshift.io, 2018-11-09, openshift#127). The "any operator" bit explains why we don't want, for example, ingress-operator specific config in here. The later ClusterOperatorSpec comment goes into more detail on that with its 'pause' hypothetical, but a bit of extra hinting can't hurt ;).
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.
These types are used by the cluster version operator to update a
cluster and to report on the status of the cluster as the admin
would see it.
The ClusterVersion and ClusterOperator types were created in the
cluster version operator and are now stable enough to be moved here.