Skip to content

Commit

Permalink
pkg/operator: version the osImageURL CM
Browse files Browse the repository at this point in the history
This patch also guards against unversioned osImageURL config maps in the
future.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
  • Loading branch information
runcom committed Jan 9, 2020
1 parent 04cd219 commit c7d3d9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions install/0000_80_machine-config-operator_05_osimageurl.yaml
Expand Up @@ -4,6 +4,7 @@ metadata:
name: machine-config-osimageurl
namespace: openshift-machine-config-operator
data:
releaseVersion: 0.0.1-snapshot
# The OS payload, managed by the daemon + pivot + rpm-ostree
# https://github.com/openshift/machine-config-operator/issues/183
osImageURL: "registry.svc.ci.openshift.org/openshift:machine-os-content"
5 changes: 5 additions & 0 deletions pkg/operator/sync.go
Expand Up @@ -686,6 +686,11 @@ func (optr *Operator) getOsImageURL(namespace string) (string, error) {
if err != nil {
return "", err
}
releaseVersion := cm.Data["releaseVersion"]
optrVersion, _ := optr.vStore.Get("operator")
if releaseVersion != optrVersion {
return "", fmt.Errorf("refusing to read osImageURL version %q, operator version %q", releaseVersion, optrVersion)
}
return cm.Data["osImageURL"], nil
}

Expand Down

0 comments on commit c7d3d9a

Please sign in to comment.