Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 8 additions & 77 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ oc adm release new -n openshift --server https://api.ci.openshift.org \
--to-image docker.io/abhinavdahiya/origin-release:latest
```

## Using CVO to render the release-payload locally
## Using CVO to render the release-image locally

1. Run the following command to get render the release-payload contents to `/tmp/cvo`

Expand Down
8 changes: 4 additions & 4 deletions docs/dev/clusteroperator.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ Ref: [godoc](https://godoc.org/github.com/openshift/api/config/v1#ClusterOperato
## Why I want ClusterOperator Custom Resource in /manifests

Everyone must include the ClusterOperator Custom Resource in [`/manifests`](operators.md#what-do-i-put-in-manifests).
The ClusterVersionOperator sweeps the release payload and applies it to the cluster. On upgrade, the CVO uses clusteroperators to confirm successful upgrades.
The ClusterVersionOperator sweeps the release image and applies it to the cluster. On upgrade, the CVO uses clusteroperators to confirm successful upgrades.
Cluster-admins make use of these resources to check the status of their clusters.

## How should I include ClusterOperator Custom Resource in /manifests

### How ClusterVersionOperator handles ClusterOperator in release payload
### How ClusterVersionOperator handles ClusterOperator in release image

When ClusterVersionOperator encounters a ClusterOperator Custom Resource,

- It uses the `.metadata.name` and `.metadata.namespace` to find the corresponding ClusterOperator instance in the cluster
- It then waits for the instance in the cluster until
- `.status.version` in the live instance matches the `.status.version` from the release payload and
- `.status.version` in the live instance matches the `.status.version` from the release image and
- the live instance `.status.conditions` report available, not progressing and not failed
- It then continues to the next task.

ClusterVersionOperator will only deploy files with `.yaml`, `.yml`, or `.json` extensions, like `kubectl create -f DIR`.

**NOTE**: ClusterVersionOperator sweeps the manifests in the release payload in alphabetical order, therefore if the ClusterOperator Custom Resource exists before the deployment for the operator that is supposed to report the Custom Resource, ClusterVersionOperator will be stuck waiting and cannot proceed. Also note that the ClusterOperator resource in `/manifests` is only a communication mechanism, to tell the ClusterVersionOperator, which ClusterOperator resource to wait for. The ClusterVersionOperator does not create the ClusterOperator resource, this and updating it is the responsibility of the respective operator.
**NOTE**: ClusterVersionOperator sweeps the manifests in the release image in alphabetical order, therefore if the ClusterOperator Custom Resource exists before the deployment for the operator that is supposed to report the Custom Resource, ClusterVersionOperator will be stuck waiting and cannot proceed. Also note that the ClusterOperator resource in `/manifests` is only a communication mechanism, to tell the ClusterVersionOperator, which ClusterOperator resource to wait for. The ClusterVersionOperator does not create the ClusterOperator resource, this and updating it is the responsibility of the respective operator.

### What should be the contents of ClusterOperator Custom Resource in /manifests

Expand Down
12 changes: 6 additions & 6 deletions docs/dev/clusterversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
The `ClusterVersion` is a custom resource object which holds the current version of the cluster.
This object is used by the administrator to declare their target cluster state, which the cluster-version operator (CVO) then works to transition the cluster to that target state.

## Finding your current update payload
## Finding your current update image

You can extract the current update payload from the `ClusterVersion` object:
You can extract the current update image from the `ClusterVersion` object:

```console
$ oc get clusterversion -o jsonpath='{.status.current.payload}{"\n"}' version
$ oc get clusterversion -o jsonpath='{.status.current.image}{"\n"}' version
registry.svc.ci.openshift.org/openshift/origin-release@sha256:c1f11884c72458ffe91708a4f85283d591b42483c2325c3d379c3d32c6ac6833
```

Expand All @@ -18,8 +18,8 @@ For testing operators, it is sometimes helpful to disable CVO management so you
To get a list of objects managed by the CVO, run:

```console
$ oc adm release extract --from=registry.svc.ci.openshift.org/openshift/origin-release@sha256:c1f11884c72458ffe91708a4f85283d591b42483c2325c3d379c3d32c6ac6833 --to=release-payload
$ ls release-payload | head -n5
$ oc adm release extract --from=registry.svc.ci.openshift.org/openshift/origin-release@sha256:c1f11884c72458ffe91708a4f85283d591b42483c2325c3d379c3d32c6ac6833 --to=release-image
$ ls release-image | head -n5
0000_07_cluster-network-operator_00_namespace.yaml
0000_07_cluster-network-operator_01_crd.yaml
0000_07_cluster-network-operator_02_rbac.yaml
Expand All @@ -44,7 +44,7 @@ To add an entry to that list, you can use a [JSON Patch][json-patch] to add a [`
For example, to set the network operator's daemonset unmanaged:

```console
$ head -n5 release-payload/0000_07_cluster-network-operator_03_daemonset.yaml
$ head -n5 release-image/0000_07_cluster-network-operator_03_daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand Down
22 changes: 16 additions & 6 deletions docs/dev/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

The Cluster Version Operator reports the following metrics:

Core metrics for the version
Core metrics for the version. Types:

* `current` - the version the operator is applying right now (the running CVO version)
* `failure` - if the failure condition is set, reported for desired and current versions
* `desired` - reported if different from current
* `completed` - returns 1 and the info of the most recent `Completed` entry in the history, or 0 otherwise

`current` has the `age` label set to the unix timestamp of the image age, `completed` has the `age` label
set to the time at which the update was completed. All other variants have empty age labels.

```
# HELP cluster_version Reports the version of the cluster.
# TYPE cluster_version gauge
cluster_version{payload="test/image:1",type="current",version="4.0.2"} 1
cluster_version{payload="test/image:1",type="failure",version="4.0.2"} 1
cluster_version{age="132049356",image="test/image:1",type="current",version="4.0.2"} 1
cluster_version{age="",image="test/image:1",type="failure",version="4.0.2"} 1
cluster_version{age="",image="test/image:2",type="desired",version="4.0.3"} 1
cluster_version{age="132064396",image="test/image:1",type="completed",version="4.0.2"} 1
# HELP cluster_version_available_updates Report the count of available versions for an upstream and channel.
# TYPE cluster_version_available_updates gauge
cluster_version_available_updates{channel="fast",upstream="https://api.openshift.com/api/upgrades_info/v1/graph"} 0
Expand All @@ -28,14 +38,14 @@ cluster_operator_conditions{condition="RetrievedUpdates",name="version",namespac
cluster_operator_up{name="version",namespace="openshift-cluster-version",version="4.0.1"} 1
```

Metrics reported while applying the payload:
Metrics reported while applying the image:

```
# HELP cluster_version_payload Report the number of entries in the payload.
# HELP cluster_version_payload Report the number of entries in the image.
# TYPE cluster_version_payload gauge
cluster_version_payload{type="applied",version="4.0.3"} 0
cluster_version_payload{type="pending",version="4.0.3"} 1
# HELP cluster_operator_payload_errors Report the number of errors encountered applying the payload.
# HELP cluster_operator_payload_errors Report the number of errors encountered applying the image.
# TYPE cluster_operator_payload_errors gauge
cluster_operator_payload_errors{version="4.0.3"} 10
```
6 changes: 3 additions & 3 deletions docs/dev/operators.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Second Level Operator integration with CVO

## How do I get added to the release payload?
## How do I get added to the release image?

Add the following to your Dockerfile

Expand All @@ -12,7 +12,7 @@ LABEL io.openshift.release.operator=true
```

Ensure your image is published into the cluster release tag by ci-operator
Wait for a new release payload to be created (usually once you push to master in your operator).
Wait for a new release image to be created (usually once you push to master in your operator).

## What do I put in /manifests?

Expand Down Expand Up @@ -49,7 +49,7 @@ If you’d like to ensure your manifests are applied in order to the cluster add
02_deployment.yaml
```

When your manifests are added to the release payload, they’ll be given a prefix that corresponds to the name of your repo/image:
When your manifests are added to the release image, they’ll be given a prefix that corresponds to the name of your repo/image:

```
/release-manifests/
Expand Down
13 changes: 7 additions & 6 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

PROJECT_ROOT="$(dirname "${BASH_SOURCE[0]}")/.."

${PROJECT_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh \
all \
github.com/openshift/cluster-version-operator/pkg/generated \
github.com/openshift/cluster-version-operator/pkg/apis \
"config.openshift.io:v1 operatorstatus.openshift.io:v1" \
$@ \
# This project performs no code generation
#${PROJECT_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh \
# all \
# github.com/openshift/cluster-version-operator/pkg/generated \
# github.com/openshift/cluster-version-operator/pkg/apis \
# "config.openshift.io:v1 operatorstatus.openshift.io:v1" \
# $@ \
5 changes: 3 additions & 2 deletions lib/resourcemerge/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ func ensureClusterOperatorStatus(modified *bool, existing *configv1.ClusterOpera
*modified = true
existing.Conditions = required.Conditions
}
if existing.Version != required.Version {

if !equality.Semantic.DeepEqual(existing.Versions, required.Versions) {
*modified = true
existing.Version = required.Version
existing.Versions = required.Versions
}
if !equality.Semantic.DeepEqual(existing.Extension.Raw, required.Extension.Raw) {
*modified = true
Expand Down
Loading