Skip to content

Conversation

@smarterclayton
Copy link
Contributor

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.

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 9, 2018
@smarterclayton
Copy link
Contributor Author

/assign @deads2k

@bparees
Copy link
Contributor

bparees commented Nov 9, 2018

/cc @gabemontero

@smarterclayton smarterclayton force-pushed the add_cluster_op_version branch 4 times, most recently from 31d6063 to 570e1fa Compare November 9, 2018 23:18
@smarterclayton
Copy link
Contributor Author

Note that both dependency updating and go tests in the config pkg seem broken

"regexp"
)

// reUUID4 uses a regexp to avoid taking a dependency on a UUID library for now
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

@smarterclayton smarterclayton Nov 13, 2018

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
Copy link
Contributor

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"

Copy link
Contributor Author

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.

// it will use the appropriate update server for the cluster and region.
//
// +optional
Upstream *URL `json:"upstream"`
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Why not make "" mean "I don't care, use the default" and eliminate the invalid case for users to stumble on?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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:

  1. I want nothing (don't even talk to anyone about updates)
  2. I want to get versions from redhat [default]
  3. I want to get versions from my custom server
  4. 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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

)

// 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}$`)
Copy link
Contributor

@abhinavdahiya abhinavdahiya Nov 12, 2018

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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.

@smarterclayton
Copy link
Contributor Author

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.
@deads2k
Copy link
Contributor

deads2k commented Nov 13, 2018

Just the namespace vs cluster scope that we spoke about in person.

lgtm otherwise

@deads2k
Copy link
Contributor

deads2k commented Nov 14, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 14, 2018
@openshift-merge-robot openshift-merge-robot merged commit 539360d into openshift:master Nov 14, 2018
@openshift-ci-robot
Copy link

[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

Details Needs approval from an approver in each of these files:
  • OWNERS [deads2k,smarterclayton]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

wking added a commit to wking/openshift-api that referenced this pull request Oct 28, 2019
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 ;).
wking added a commit to wking/openshift-api that referenced this pull request Oct 28, 2019
…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.
wking added a commit to wking/openshift-api that referenced this pull request Nov 6, 2019
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 ;).
abhat pushed a commit to abhat/api that referenced this pull request Nov 25, 2019
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 ;).
wking added a commit to wking/openshift-api that referenced this pull request 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 (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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants