Chapter 3. High Level Concepts
3.1. QuayRegistry API Copy linkLink copied to clipboard!
The Quay Operator provides the QuayRegistry custom resource API to declaratively manage Quay container registries on the cluster. Use either the OpenShift UI or a command-line tool to interact with this API.
-
Creating a
QuayRegistrywill result in the Operator deploying and configuring all necessary resources needed to run Quay on the cluster. -
Editing a
QuayRegistrywill result in the Operator reconciling the changes and creating/updating/deleting objects to match the desired configuration. -
Deleting a
QuayRegistrywill result in garbage collection of all previously created resources and theQuaycontainer registry will no longer be available.
The QuayRegistry API is fairly simple, and the fields are outlined in the following sections.
3.2. Quay components Copy linkLink copied to clipboard!
Quay is a powerful container registry platform and as a result, requires a decent number of dependencies. These include a database, object storage, Redis, and others. The Quay Operator manages an opinionated deployment of Quay and its dependencies on Kubernetes. These dependencies are treated as components and are configured through the QuayRegistry API.
In the QuayRegistry custom resource, the spec.components field configures components. Each component contains two fields: kind - the name of the component, and managed - boolean whether the component lifecycle is handled by the Operator. By default (omitting this field), all components are managed and will be autofilled upon reconciliation for visibility:
spec:
components:
- managed: true
kind: clair
- managed: true
kind: postgres
- managed: true
kind: objectstorage
- managed: true
kind: redis
- managed: true
kind: horizontalpodautoscaler
- managed: true
kind: route
- managed: true
kind: mirror
- managed: true
kind: monitoring
Unless your QuayRegistry custom resource specifies otherwise, the Operator will use defaults for the following managed components:
-
postgresStores the registry metadata. Uses a version of Postgres 10 from the Software Collections. -
redisHandles Quay builder coordination and some internal logging. -
objectstorageStores image layer blobs. Utilizes theObjectBucketClaimKubernetes API which is provided by Noobaa/RHOCS. -
clairProvides image vulnerability scanning. -
horizontalpodautoscalerAdjusts the number of Quay pods depending on memory/cpu consumption. -
mirrorConfigures a repository mirror worker (to support optional repository mirroring). -
routeProvides an external entrypoint to the Quay registry from outside of OpenShift. -
monitoringFeatures include a Grafana dashboard, access to individual metrics, and alerting to notify for frequently restarting Quay pods.
3.3. Using managed components Copy linkLink copied to clipboard!
While the Operator will handle any required configuration and installation work needed for Red Hat Quay to use the managed components, there are several considerations to keep in mind.
If you choose to install the Quay Operator in a single namespace, then you must set the monitoring component to
false:spec: components: - kind: monitoring managed: false- Database backups should be performed regularly using either the supplied tools on the Postgres image or your own backup infrastructure. The Operator does not currently ensure the Postgres database is backed up.
-
Restoring the Postgres database from a backup must be done using Postgres tools and procedures. Be aware that your Quay
Podsshould not be running while the database restore is in progress. - Database disk space is allocated automatically by the Operator with 50 GiB. This number represents a usable amount of storage for most small to medium Red Hat Quay installations but may not be sufficient for your use cases. Resizing the database volume is currently not handled by the Operator.
- Object storage disk space is allocated automatically by the Operator with 50 GiB. This number represents a usable amount of storage for most small to medium Red Hat Quay installations but may not be sufficient for your use cases. Resizing the RHOCS volume is currently not handled by the Operator. See the section below on resizing managed storage for more details.
-
The Operator will deploy an OpenShift
Routeas the default entrypoint to the registry. If you prefer a different entrypoint (e.g.Ingressor directServiceaccess that configuration will need to be done manually).
If any of these considerations are unacceptable for your environment, it would be suggested to provide the Operator with unmanaged resources or overrides as described in the following sections.
3.4. Using unmanaged components for dependencies Copy linkLink copied to clipboard!
If you have existing components such as Postgres, Redis or object storage that you would like to use with Quay, you first configure them within the Quay configuration bundle (config.yaml) and then reference the bundle in your QuayRegistry (as a Kubernetes Secret) while indicating which components are unmanaged.
The Quay config editor can also be used to create or modify an existing config bundle and simplify the process of updating the Kubernetes Secret, especially for multiple changes. When Quay’s configuration is changed via the config editor and sent to the Operator, the Quay deployment will be updated to reflect the new configuration.
3.4.1. Using an existing Postgres database Copy linkLink copied to clipboard!
Create a configuration file
config.yamlwith the necessary database fields:config.yaml:
DB_URI: postgresql://test-quay-database:postgres@test-quay-database:5432/test-quay-databaseCreate a Secret using the configuration file:
$ kubectl create secret generic --from-file config.yaml=./config.yaml config-bundle-secretCreate a QuayRegistry YAML file
quayregistry.yamlwhich marks postgres component as unmanaged and references the created Secret:quayregistry.yaml
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: test spec: configBundleSecret: config-bundle-secret components: - kind: postgres managed: falseCreate the QuayRegistry:
$ oc create -f quayregistry.yaml
The deployed Quay application will now use the external database.
3.4.2. Unmanaged storage Copy linkLink copied to clipboard!
The following example uses NooBaa storage, but can be applied to other image storage options such as Azure, S3, etc.
-
Create a NooBaa Object Bucket Claim in the console at Storage
Object Bucket Claims. - Retrieve the Object Bucket Claim Data details including the Access Key, Bucket Name, Endpoint (hostname) and Secret Key.
Create a
config.yamlconfiguration file, using the information for the Object Bucket Claim:DISTRIBUTED_STORAGE_CONFIG: default: - RHOCSStorage - access_key: WmrXtSGk8B3nABCDEFGH bucket_name: my-noobaa-bucket-claim-8b844191-dc6c-444e-9ea4-87ece0abcdef hostname: s3.openshift-storage.svc is_secure: true port: "443" secret_key: X9P5SDGJtmSuHFCMSLMbdNCMfUABCDEFGH+C5QD storage_path: /datastorage/registry DISTRIBUTED_STORAGE_DEFAULT_LOCATIONS: [] DISTRIBUTED_STORAGE_PREFERENCE: - defaultCreate a Secret using the configuration file:
$ kubectl create secret generic --from-file config.yaml=./config.yaml config-bundle-secretCreate a QuayRegistry YAML file
quayregistry.yamlwhich marks storage component as unmanaged and references the created Secret:quayregistry.yaml
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: name: test spec: configBundleSecret: config-bundle-secret components: - kind: storage managed: falseCreate the QuayRegistry:
oc create -f quayregistry.yaml
The deployed Quay application will now use the created storage.
3.4.3. Disabling the Horizontal Pod Autoscaler Copy linkLink copied to clipboard!
If you wish to disable autoscaling or create your own HorizontalPodAutoscaler, simply specify the component as unmanaged in the QuayRegistry instance:
apiVersion: quay.redhat.com/v1
kind: QuayRegistry
metadata:
name: some-quay
spec:
components:
- kind: horizontalpodautoscaler
managed: false
3.5. Config bundle secret Copy linkLink copied to clipboard!
The spec.configBundleSecret field is a reference to the metadata.name of a Secret in the same namespace as the QuayRegistry. This Secret must contain a config.yaml key/value pair. This config.yaml file is a Quay config YAML file. This field is optional, and will be auto-filled by the Operator if not provided. If provided, it serves as the base set of config fields which are later merged with other fields from any managed components to form a final output Secret, which is then mounted into the Quay application pods.
3.6. QuayRegistry Status Copy linkLink copied to clipboard!
Lifecycle observability for a given Quay deployment is reported in the status section of the corresponding QuayRegistry object. The Operator constantly updates this section, and this should be the first place to look for any problems or state changes in Quay or its managed dependencies.
3.6.1. Registry Endpoint Copy linkLink copied to clipboard!
Once Quay is ready to be used, the status.registryEndpoint field will be populated with the publicly available hostname of the registry.
3.6.2. Config Editor Endpoint Copy linkLink copied to clipboard!
Access Quay’s UI-based config editor using status.configEditorEndpoint.
3.6.3. Config Editor Credentials Secret Copy linkLink copied to clipboard!
The username/password for the config editor UI will be stored in a Secret in the same namespace as the QuayRegistry referenced by status.configEditorCredentialsSecret.
3.6.4. Current Version Copy linkLink copied to clipboard!
The current version of Quay that is running will be reported in status.currentVersion.
3.6.5. Conditions Copy linkLink copied to clipboard!
Certain conditions will be reported in status.conditions.