Skip to content

Commit

Permalink
clusteroperator: Report the appropriate injected status version
Browse files Browse the repository at this point in the history
In order to indicate we have reached our desired level, we accept
an opaque token from the payload and pass it through to status only
after we have fully rolled out our new components. This allows the
CVO to know that we have hit the desired state.
  • Loading branch information
smarterclayton committed Mar 1, 2019
1 parent 86a2b96 commit 338befd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions manifests/04-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ spec:
containers:
- image: quay.io/openshift/origin-cluster-monitoring-operator:latest
name: cluster-monitoring-operator
env:
- name: RELEASE_VERSION
value: "0.0.1-snapshot"
args:
- "-namespace=openshift-monitoring"
- "-configmap=cluster-monitoring-config"
Expand Down
4 changes: 4 additions & 0 deletions manifests/05-clusteroperator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ kind: ClusterOperator
metadata:
name: monitoring
spec: {}
status:
versions:
- name: operator
version: "0.0.1-snapshot"
16 changes: 15 additions & 1 deletion pkg/client/clusteroperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package client

import (
"fmt"
"os"

v1 "github.com/openshift/api/config/v1"
clientv1 "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
Expand Down Expand Up @@ -40,7 +41,20 @@ func (r *StatusReporter) SetDone() error {
conditions.setCondition(v1.OperatorProgressing, v1.ConditionFalse, "", time)
conditions.setCondition(v1.OperatorFailing, v1.ConditionFalse, "", time)
co.Status.Conditions = conditions.entries()
//co.Status.Version = r.version

// If we have reached "level" for the operator, report that we are at the version
// injected into us during update. We require that all components be rolled out
// and available at the new version before reporting this value.
if releaseVersion := os.Getenv("RELEASE_VERSION"); len(releaseVersion) > 0 {
co.Status.Versions = []v1.OperandVersion{
{
Name: "operator",
Version: releaseVersion,
},
}
} else {
co.Status.Versions = nil
}

_, err = r.client.UpdateStatus(co)
return err
Expand Down

0 comments on commit 338befd

Please sign in to comment.