// Module included in the following assemblies:
//
// *  operators/operator-reference.adoc

[id="cluster-samples-operator_{context}"]
= Cluster Samples Operator

[discrete]
== Purpose

The Cluster Samples Operator manages the sample imagestreams and templates stored in the `openshift` namespace.

On initial start up, the Operator creates the default samples configuration resource to initiate the creation of the imagestreams and templates. The configuration object
is a cluster scoped object with the key `cluster` and type `configs.samples`.

The imagestreams are the {op-system-first}-based {product-title} imagestreams pointing to images on `registry.redhat.io`. Similarly, the templates are those categorized as {product-title} templates.

The Cluster Samples Operator deployment is contained within the `openshift-cluster-samples-operator` namespace. On start up, the install pull secret is used by the imagestream import logic in the internal registry and API server to authenticate with `registry.redhat.io`. An administrator can create any additional secrets in the `openshift` namespace if they change the registry used for the sample imagestreams. If created, those secrets contain the content of a Docker `config.json` needed to facilitate image import.

The image for the Cluster Samples Operator contains imagestream and template definitions for the associated {product-title} release. After the Cluster Samples Operator creates a sample, it adds an annotation that denotes the {product-title} 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. Modifications to any samples that are managed by the Operator are allowed as long as the version annotation is not modified or deleted.  However, on an upgrade, as the version annotation will change, those modifications can get replaced as the sample will be updated with the newer version. The Jenkins images are part of the image payload from the installation and are tagged into the imagestreams directly.

The samples resource includes a finalizer, which cleans up the following upon its deletion:

* Operator-managed imagestreams
* Operator-managed templates
* Operator-generated configuration resources
* Cluster status resources

Upon deletion of the samples resource, the Cluster Samples Operator recreates the resource using the default configuration.

[discrete]
== Project

link:https://github.com/openshift/cluster-samples-operator[cluster-samples-operator]
