The samples operator manages the sample imagestreams and templates stored in the openshift namespace, and any docker credentials, stored as a secret, needed for the imagestreams to import the images they reference.
On initial startup, the operator will create the default samples resource to initiate the creation of the imagestreams and templates. The imagestreams are the RHEL based OCP imagestreams pointing to images on registry.redhat.io
. Similarly the templates are those categorized as OCP templates. When details for obtaining the credentials for registry.redhat.io are finalized, we will begin defaulting to that registry for the imagestreams.
The samples operator, along with it's configuration resources, are contained within the openshift-cluster-samples-operator namespace. With releases before 4.5, the samples operator would copy the install pull secret into the openshift
namespace to facilitate API Server's imagestream import from registry.redhat.io
. Starting with 4.5 that is no longer required, as the API Server's imagestream import can access the install pull secret for imagestreams in any namespace.
Otherwise, an admin can create any additional secret(s) in the openshift namespace as needed (where those secrets contain the content of a docker config.json) needed to facilitate image import, if say they override the registry to something
other than registry.redhat.io
.
The image for the samples operator contains imagestream and template definitions for the associated OpenShift release. Each sample includes an annotation that denotes the OpenShift version that it is compatible with. The operator uses this annotation to ensure that each sample matches it's release version. Samples outside of its inventory are ignored, as are skipped samples (see below). Modifications to any samples that are managed by the operator will be reverted automatically. The jenkins images are actually part of the image payload from the install and are tagged into the image streams in question directly.
The samples resource includes a finalizer which will clean up the following upon its deletion:
Upon deletion of the samples resource, the samples operator will recreate the resource using the default configuration.
The samples resource offers the following configuration fields:
runtime.GOARCH
package / variable at its initial startup to determine which
architecture's set of sample imagestreams and templates to install. And you are not allowed to change it after that.You cannot change the Architecture field at this time.
The samples resource maintains the following conditions in its status:
ImageStream
image imports are no longer tracked in real time via conditions on the samples config resource, nor do in progress ImageStreams
directly affect updates to the ClusterOperator
instance openshift-samples
. Prolonged errors with ImageStreams
are reported now by Prometheus alerts. registry.redhat.io
exist in the pull-secret
Secret in the openshift-config
namespace ... i.e. the install pull secrettrue
when this Condition is true
(though typically the deletions occur fairly quickly).See https://github.com/openshift/cluster-version-operator/blob/master/docs/dev/clusteroperator.md#conditions for how these Cluster Operator status conditions are managed.
A ConfigMap
named imagestreamtag-to-image
is created in the Samples Operator's namespace that contains an
entry for each ImageStreamTag
, where the value of the entry is the image used to populate that ImageStreamTag
.
The format of the key for each entry in the data
field in the ConfigMap
is <imagestreamname>_<imagestreamtagname>
.
Samples Operator will come up as Removed
for a disconnected OCP install. If you choose to change it to Managed
,
override the registry to a mirror registry available in your disconnected environment, you can use this ConfigMap
as a reference for which images need to be mirrored for your ImageStreams
of interest to properly import.
Samples Operator will bootstrap as Removed
if it detects it is running on ipv6, since at last check, registry.redhat.io
does not support ipv6.
CRD instance for the samples operator config: oc get configs.samples.operator.openshift.io cluster -o yaml
You can also use configs.samples
for short.
Check the status of the conditions. (See above for details on those conditions)
While imagestream import failures no longer affect the state Samples reports to the CVO (that changes occurred in 4.6), the samples operator will fire Prometheus alerts per the rules defined in https://github.com/openshift/cluster-samples-operator/blob/master/manifests/010-prometheus-rules.yaml
The samples operator will also attempt to re-import the imagestreams on approximate 15 minute intervals. Otherwise, a cluster admin can:
oc import-image <imagestream name> -n openshift --all
; if successful, the operator will detect the success and clear that imagestream from the failure listskippedImagestreams
list; the operator will also clear the imagestream(s) specified from the failure listDeployment, Events in operator’s namespace (openshift-cluster-samples-operator): basic oc get pods
, oc get events
, oc logs
of the operator pod
If any configmaps persist in the samples operator's namespace, the data maps for those configmaps will have information on which
import failed: oc get configmaps -n openshift-cluster-samples-operator -o yaml
Samples: oc get is -n openshift
, oc get templates -n openshift
… use of -o yaml on any given imagestream should show the status, and import errors will be noted there as well
Deletion of the CRD instance will reset the samples operator to the default configuration, but leave the current revision of the samples operator pod running.
You can also set the management state of the samples operator to Removed
if you do not need samples running in your
cluster:
apiVersion: samples.operator.openshift.io/v1
kind: Config
metadata:
name: cluster
spec:
architectures:
- x86_64
managementState: Removed
The imagestreams defined at (https://github.com/openshift/cluster-samples-operator/blob/master/manifests/08-openshift-imagestreams.yaml)[https://github.com/openshift/cluster-samples-operator/blob/master/manifests/08-openshift-imagestreams.yaml] are not managed by the samples operator. These are special imagestreams that point to images in the install payload, and their creation and updates are handled by the Cluster Version Operator
NOTE: this next step violates your cluster support contract if you are an OCP customer. But if your are using a cluster for development, and you wish to experiment with and update the samples operator code itself, you can reset the image used for the samples operator via the following steps:
oc edit clusterversion version
and add an override entry to the spec for the Deployment of the samples operator so it is unmanaged:spec:
overrides:
- kind: Deployment
group: apps/v1
name: cluster-samples-operator
namespace: openshift-cluster-samples-operator
unmanaged: true
oc scale deploy cluster-samples-operator --replicas=0
oc edit config.samples cluster
, remove the finalizeroc delete config.samples cluster
, config map/secrets in operator namespace, imagestreams and templates in openshift namespaceoc scale deploy cluster-samples-operator --replicas=1