Skip to content

cvo: Record history of changes to version and report target version#63

Merged
openshift-merge-robot merged 2 commits intoopenshift:masterfrom
smarterclayton:version_history
Jan 8, 2019
Merged

cvo: Record history of changes to version and report target version#63
openshift-merge-robot merged 2 commits intoopenshift:masterfrom
smarterclayton:version_history

Conversation

@smarterclayton
Copy link
Copy Markdown
Contributor

@smarterclayton smarterclayton commented Dec 1, 2018

The CVO needs to clearly communicate to users what the recent changes to
the version have been and what version it is targeting right now.

Add a history field that tracks transitions in desiredUpdate, and a
status field desired that reports when the operator is trying to reach a
stable state. current becomes a pointer - it is set of desired is unset and vice versa.

Example:

  1. CVO boots at version 4.0.1 - reports history 4.0.1 and state partial, desired as 4.0.1, current nil
  2. CVO successfully syncs 4.0.1 - reports history 4.0.1 and state completed, desired nil, current 4.0.1
  3. User sets desired 4.0.2 - reports history [4.0.2, 4.0.1], desired 4.0.2, current nil
  4. User cancels desired 4.0.2 - reports history [4.0.2, 4.0.1], desired nil, current 4.0.1

Cancel is interesting today - if you catch it before the CVO reboots, it goes back to 4.0.1. If you catch it after, you stay at 4.0.2. Since we want to encourage roll forward, it kind of makes sense, just feels ugly to an end user.

As a second change, allow a user to specify only version on a desired update and infer the payload from the availableUpdates or history. If the version doesn't match, report an invalid condition.

Change how directory filenames are created by using an md5 sum of the payload to avoid scenarios where the payload image string changes for the same version but we use the old content.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 1, 2018
@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 1, 2018
@smarterclayton smarterclayton force-pushed the version_history branch 3 times, most recently from a81633b to 5fb1f18 Compare December 1, 2018 04:26
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 1, 2018
@smarterclayton
Copy link
Copy Markdown
Contributor Author

/test e2e-aws

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2018
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2018
@smarterclayton smarterclayton force-pushed the version_history branch 2 times, most recently from 0e39999 to 77ed8fd Compare December 19, 2018 21:53
@smarterclayton
Copy link
Copy Markdown
Contributor Author

/retest

@smarterclayton
Copy link
Copy Markdown
Contributor Author

/test e2e-aws

Comment thread vendor/github.com/openshift/api/config/v1/types_cluster_version.go
StartedTime metav1.Time `json:"startedTime"`
CompletionTime *metav1.Time `json:"completionTime"`

// version is a semantic versioning identifying the update version. When this
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we just reuse Update or just embed it.. ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We could embed it, although sometimes I dislike embedding when the structs are used in different contexts to avoid accidentally getting a field we don't want. I don't care too much.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Best reason to have different is to have different godoc / apidoc. I think in this case we want different godoc.

Comment thread pkg/cvo/cvo.go
@@ -465,11 +464,14 @@ func (optr *Operator) getOrCreateClusterVersion() (*configv1.ClusterVersion, boo

// versionString returns a string describing the current version.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ques: .status.desired and .status.history[0] both give us current version that CVO is reconciling towards, correct? and we have the .status.desired as that is easy to show in oc get clusterversion ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes and yes.

@abhinavdahiya
Copy link
Copy Markdown
Contributor

@smarterclayton except #63 (comment) i think this change looks good.

@smarterclayton
Copy link
Copy Markdown
Contributor Author

Let me create the PR against openshift/api and we can discuss a bit more there.

The CVO needs to clearly communicate to users what the recent changes
to the version have been and what version it is targeting right now.

Add a `history` field that tracks transitions in desiredUpdate, and a
status field `desired` that reports when the operator is trying to
reach a stable state.

---

version: Allow user to set only version string and infer payload from history

As a convenience to users and UI, allow only the version field to be specified
in the desiredUpdate field. If a matching version exists in the history or the
availableUpdates field, the update will proceed. If it does not, the CV will
be marked as invalid.

Take care to record the initial version in the history so the original payload
is always available to recover if the user makes a mistake.

Use a hash of the payload on disk rather than a version number to prevent
collisions between mislabeled versions.
@smarterclayton smarterclayton changed the title WIP: cvo: Record history of changes to version and report target version cvo: Record history of changes to version and report target version Jan 8, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 8, 2019
@smarterclayton
Copy link
Copy Markdown
Contributor Author

Updated with latest API changes from upstream.

@abhinavdahiya
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 8, 2019
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, 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 [abhinavdahiya,smarterclayton]

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

@openshift-bot
Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit c14a0b7 into openshift:master Jan 8, 2019
wking added a commit to wking/cluster-version-operator that referenced this pull request Nov 3, 2021
The logic I'm removing is a convenience from 558ae02 (cvo: Record
history of changes to version and report target version, 2019-01-08, openshift#63).
But the current consensus is that:

* Rollbacks are risky enough that we don't want to make them that
  convenient.
* Rollbacks have never been supported, so removing the convenient
  pullspec lookup is a backwards-compatible-enough change.

This also brings the ClusterVersion operator's approach into line with
how 'oc adm upgrade --to ...' has always worked [1].

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1878925
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants