Chapter 9. Customizing Red Hat Quay on OpenShift Container Platform
After deployment, you can customize the Red Hat Quay application by editing the Red Hat Quay configuration bundle secret spec.configBundleSecret
. You can also change the managed status of components and configure resource requests for some components in the spec.components
object of the QuayRegistry
resource.
9.1. Editing the config bundle secret in the OpenShift Container Platform console
Use the following procedure to edit the config bundle secret in the OpenShift Container Platform console.
Procedure
On the Red Hat Quay Registry overview screen, click the link for the Config Bundle Secret.
To edit the secret, click Actions
Edit Secret. Modify the configuration and save the changes.
- Monitor the deployment to ensure successful completion and that the configuration changes have taken effect.
9.2. Determining QuayRegistry endpoints and secrets
Use the following procedure to find QuayRegistry
endpoints and secrets.
Procedure
You can examine the
QuayRegistry
resource, usingoc describe quayregistry
oroc get quayregistry -o yaml
, to find the current endpoints and secrets by entering the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc get quayregistry example-registry -n quay-enterprise -o yaml
$ oc get quayregistry example-registry -n quay-enterprise -o yaml
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: ... name: example-registry namespace: quay-enterprise ... spec: components: - kind: quay managed: true ... - kind: clairpostgres managed: true configBundleSecret: init-config-bundle-secret status: currentVersion: 3.7.0 lastUpdated: 2022-05-11 13:28:38.199476938 +0000 UTC registryEndpoint: https://example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org
apiVersion: quay.redhat.com/v1 kind: QuayRegistry metadata: ... name: example-registry namespace: quay-enterprise ... spec: components: - kind: quay managed: true ... - kind: clairpostgres managed: true configBundleSecret: init-config-bundle-secret
1 status: currentVersion: 3.7.0 lastUpdated: 2022-05-11 13:28:38.199476938 +0000 UTC registryEndpoint: https://example-registry-quay-quay-enterprise.apps.docs.gcp.quaydev.org
2
9.3. Modifying the configuration file by using the CLI
You can modify the config.yaml
file that is stored by the configBundleSecret
by downloading the existing configuration using the CLI. After making changes, you can re-upload the configBundleSecret
resource to make changes to the Red Hat Quay registry.
Modifying the config.yaml
file that is stored by the configBundleSecret
resource is a multi-step procedure that requires base64 decoding the existing configuration file and then uploading the changes. For most cases, using the OpenShift Container Platform web console to make changes to the config.yaml
file is simpler.
Prerequisites
- You are logged in to the OpenShift Container Platform cluster as a user with admin privileges.
Procedure
Describe the
QuayRegistry
resource by entering the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc describe quayregistry -n <quay_namespace>
$ oc describe quayregistry -n <quay_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ... ...
# ... Config Bundle Secret: example-registry-config-bundle-v123x # ...
Obtain the secret data by entering the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc get secret -n <quay_namespace> <example-registry-config-bundle-v123x> -o jsonpath='{.data}'
$ oc get secret -n <quay_namespace> <example-registry-config-bundle-v123x> -o jsonpath='{.data}'
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow { "config.yaml": "RkVBVFVSRV9VU0 ... MDAwMAo=" }
{ "config.yaml": "RkVBVFVSRV9VU0 ... MDAwMAo=" }
Decode the data into a YAML file into the current directory by passing in the
>> config.yaml
flag. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow echo 'RkVBVFVSRV9VU0 ... MDAwMAo=' | base64 --decode >> config.yaml
$ echo 'RkVBVFVSRV9VU0 ... MDAwMAo=' | base64 --decode >> config.yaml
-
Make the desired changes to your
config.yaml
file, and then save the file asconfig.yaml
. Create a new
configBundleSecret
YAML by entering the following command.Copy to Clipboard Copied! Toggle word wrap Toggle overflow touch <new_configBundleSecret_name>.yaml
$ touch <new_configBundleSecret_name>.yaml
Create the new
configBundleSecret
resource, passing in theconfig.yaml
file` by entering the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc -n <namespace> create secret generic <secret_name> \ --from-file=config.yaml=</path/to/config.yaml> \ --dry-run=client -o yaml > <new_configBundleSecret_name>.yaml
$ oc -n <namespace> create secret generic <secret_name> \ --from-file=config.yaml=</path/to/config.yaml> \
1 --dry-run=client -o yaml > <new_configBundleSecret_name>.yaml
- 1
- Where
<config.yaml>
is yourbase64 decoded
config.yaml
file.
Create the
configBundleSecret
resource by entering the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc create -n <namespace> -f <new_configBundleSecret_name>.yaml
$ oc create -n <namespace> -f <new_configBundleSecret_name>.yaml
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow secret/config-bundle created
secret/config-bundle created
Update the
QuayRegistry
YAML file to reference the newconfigBundleSecret
object by entering the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc patch quayregistry <registry_name> -n <namespace> --type=merge -p '{"spec":{"configBundleSecret":"<new_configBundleSecret_name>"}}'
$ oc patch quayregistry <registry_name> -n <namespace> --type=merge -p '{"spec":{"configBundleSecret":"<new_configBundleSecret_name>"}}'
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow quayregistry.quay.redhat.com/example-registry patched
quayregistry.quay.redhat.com/example-registry patched
Verification
Verify that the
QuayRegistry
CR has been updated with the newconfigBundleSecret
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc describe quayregistry -n <quay_namespace>
$ oc describe quayregistry -n <quay_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ... ...
# ... Config Bundle Secret: <new_configBundleSecret_name> # ...
After patching the registry, the Red Hat Quay Operator automatically reconciles the changes.