// 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, and any container credentials, stored as a
secret, needed for the imagestreams to import the images they reference.

On initial start up, the Operator creates the default samples resource to
initiate the creation of the imagestreams and templates. 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, along with its configuration resources, are
contained within the `openshift-cluster-samples-operator` namespace. On start
up, it will copy the pull secret captured by the installation into the
`openshift` namespace with the name `samples-registry-credentials` to facilitate
imagestream imports. An administrator can create any additional secrets in the
`openshift` namespace as needed. Those secrets contain the content of a
container `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. Each sample includes 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
reverted automatically. 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
* The `samples-registry-credentials` secret

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]
