Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 5. Quay Operator components
Quay is a powerful container registry platform and as a result, has a significant 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:
5.1. Using managed components Copier lienLien copié sur presse-papiers!
Unless your QuayRegistry
custom resource specifies otherwise, the Operator will use defaults for the following managed components:
- postgres: For storing the registry metadata, uses a version of Postgres 10 from the Software Collections
- redis: Handles Quay builder coordination and some internal logging
-
objectstorage: For storing image layer blobs, utilizes the
ObjectBucketClaim
Kubernetes API which is provided by Noobaa/RHOCS - clair: Provides image vulnerability scanning
- horizontalpodautoscaler: Adjusts the number of Quay pods depending on memory/cpu consumption
- mirror: Configures repository mirror workers (to support optional repository mirroring)
- route: Provides an external entrypoint to the Quay registry from outside OpenShift
- monitoring: Features include a Grafana dashboard, access to individual metrics, and alerting to notify for frequently restarting Quay pods
- tls: Configures whether Red Hat Quay or OpenShift handles TLS
The Operator will handle any required configuration and installation work needed for Red Hat Quay to use the managed components. If the opinionated deployment performed by the Quay Operator is unsuitable for your environment, you can provide the Operator with unmanaged
resources (overrides) as described in the following sections.
5.2. Using unmanaged components for dependencies Copier lienLien copié sur presse-papiers!
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 simplifies 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.
5.2.1. Using an existing Postgres database Copier lienLien copié sur presse-papiers!
Create a configuration file
config.yaml
with the necessary database fields:config.yaml:
DB_URI: postgresql://test-quay-database:postgres@test-quay-database:5432/test-quay-database
DB_URI: postgresql://test-quay-database:postgres@test-quay-database:5432/test-quay-database
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Secret using the configuration file:
kubectl create secret generic --from-file config.yaml=./config.yaml config-bundle-secret
$ kubectl create secret generic --from-file config.yaml=./config.yaml config-bundle-secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a QuayRegistry YAML file
quayregistry.yaml
which marks thepostgres
component as unmanaged and references the created Secret:quayregistry.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Deploy the registry as detailed in the following sections.
5.2.2. NooBaa unmanaged storage Copier lienLien copié sur presse-papiers!
-
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.yaml
configuration file, using the information for the Object Bucket Claim:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.3. Disabling the Horizontal Pod Autoscaler Copier lienLien copié sur presse-papiers!
HorizontalPodAutoscalers
have been added to the Clair, Quay, and Mirror pods, so that they now automatically scale during load spikes.
As HPA is configured by default to be managed
, the number of pods for Quay, Clair and repository mirroring is set to two. This facilitates the avoidance of downtime when updating / reconfiguring Quay via the Operator or during rescheduling events.
If you wish to disable autoscaling or create your own HorizontalPodAutoscaler
, simply specify the component as unmanaged in the QuayRegistry
instance:
5.3. Add certs when deployed on Kubernetes Copier lienLien copié sur presse-papiers!
When deployed on Kubernetes, Red Hat Quay mounts in a secret as a volume to store config assets. Unfortunately, this currently breaks the upload certificate function of the superuser panel.
To get around this error, a base64 encoded certificate can be added to the secret after Red Hat Quay has been deployed. Here’s how:
Begin by base64 encoding the contents of the certificate:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
kubectl
tool to edit the quay-enterprise-config-secret.kubectl --namespace quay-enterprise edit secret/quay-enterprise-config-secret
$ kubectl --namespace quay-enterprise edit secret/quay-enterprise-config-secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add an entry for the cert and paste the full base64 encoded string under the entry:
custom-cert.crt: c1psWGpqeGlPQmNEWkJPMjJ5d0pDemVnR2QNCnRsbW9JdEF4YnFSdVd3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
custom-cert.crt: c1psWGpqeGlPQmNEWkJPMjJ5d0pDemVnR2QNCnRsbW9JdEF4YnFSdVd3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Finally, recycle all Red Hat Quay pods. Use
kubectl delete
to remove all Red Hat Quay pods. The Red Hat Quay Deployment will automatically schedule replacement pods with the new certificate data.
5.4. Configuring OCI and Helm with the Operator Copier lienLien copié sur presse-papiers!
Customizations to the configuration of Quay can be provided in a secret containing the configuration bundle. Execute the following command which will create a new secret called quay-config-bundle
, in the appropriate namespace, containing the necessary properties to enable OCI support.
quay-config-bundle.yaml
As of Red Hat Quay 3.6, FEATURE_HELM_OCI_SUPPORT
has been deprecated and will be removed in a future version of Red Hat Quay. In Red Hat Quay 3.6, Helm artifacts are supported by default and included under the FEATURE_GENERAL_OCI_SUPPORT
property. Users are no longer required to update their config.yaml files to enable support.
Create the secret in the appropriate namespace, in this example quay-enterprise
:
oc create -n quay-enterprise -f quay-config-bundle.yaml
$ oc create -n quay-enterprise -f quay-config-bundle.yaml
Specify the secret for the spec.configBundleSecret
field:
quay-registry.yaml
Create the registry with the specified configuration:
oc create -n quay-enterprise -f quay-registry.yaml
$ oc create -n quay-enterprise -f quay-registry.yaml
5.5. Volume size overrides Copier lienLien copié sur presse-papiers!
As of Red Hat Quay v3.6.2, you can specify the desired size of storage resources provisioned for managed components. The default size for Clair and Quay PostgreSQL databases is 50Gi
. You can now choose a large enough capacity upfront, either for performance reasons or in the case where your storage backend does not have resize capability.
In the following example, the volume size for the Clair and the Quay PostgreSQL databases has been set to 70Gi
: