Chapter 5. Using the Quay Bridge Operator
Use the following procedure to use the Quay Bridge Operator.
Prerequisites
- You have installed the Red Hat Quay Operator.
- You have logged into OpenShift Container Platform as a cluster administrator.
- You have logged into your Red Hat Quay registry.
- You have installed the Quay Bridge Operator.
-
You have configured the
QuayIntegration
custom resource.
Procedure
Enter the following command to create a new OpenShift Container Platform project called
e2e-demo
:oc new-project e2e-demo
$ oc new-project e2e-demo
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After you have created a new project, a new Organization is created in Red Hat Quay. Navigate to the Red Hat Quay registry and confirm that you have created a new Organization named
openshift_e2e-demo
.NoteThe
openshift
value of the Organization might different if the clusterID in yourQuayIntegration
resource used a different value.- On the Red Hat Quay UI, click the name of the new Organization, for example, openshift_e2e-demo.
Click Robot Accounts in the navigation pane. As part of new project, the following Robot Accounts should have been created:
- openshift_e2e-demo+deployer
- openshift_e2e-demo+default
- openshift_e2e-demo+builder
Enter the following command to confirm three secrets containing Docker configuration associated with the applicable Robot Accounts were created:
oc get secrets builder-quay-openshift deployer-quay-openshift default-quay-openshift
$ oc get secrets builder-quay-openshift deployer-quay-openshift default-quay-openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
stevsmit@stevsmit ocp-quay $ oc get secrets builder-quay-openshift deployer-quay-openshift default-quay-openshift NAME TYPE DATA AGE builder-quay-openshift kubernetes.io/dockerconfigjson 1 77m deployer-quay-openshift kubernetes.io/dockerconfigjson 1 77m default-quay-openshift kubernetes.io/dockerconfigjson 1 77m
stevsmit@stevsmit ocp-quay $ oc get secrets builder-quay-openshift deployer-quay-openshift default-quay-openshift NAME TYPE DATA AGE builder-quay-openshift kubernetes.io/dockerconfigjson 1 77m deployer-quay-openshift kubernetes.io/dockerconfigjson 1 77m default-quay-openshift kubernetes.io/dockerconfigjson 1 77m
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to display detailed information about
builder
ServiceAccount (SA), including its secrets, token expiration, and associated roles and role bindings. This ensures that the project is integrated via the Quay Bridge Operator.oc describe sa builder default deployer
$ oc describe sa builder default deployer
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to create and deploy a new application called
httpd-template
:oc new-app --template=httpd-example
$ oc new-app --template=httpd-example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After running this command,
BuildConfig
,ImageStream
,Service,
Route
, andDeploymentConfig
resources are created. When theImageStream
resource is created, an associated repository is created in Red Hat Quay.The
ImageChangeTrigger
for theBuildConfig
triggers a new Build when the Apache HTTPD image, located in theopenshift
namespace, is resolved. As the new Build is created, theMutatingWebhookConfiguration
automatically rewriters the output to point at Red Hat Quay. You can confirm that the build is complete by querying the output field of the build by running the following command:oc get build httpd-example-1 --template='{{ .spec.output.to.name }}'
$ oc get build httpd-example-1 --template='{{ .spec.output.to.name }}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
example-registry-quay-quay-enterprise.apps.quay-ocp.gcp.quaydev.org/openshift_e2e-demo/httpd-example:latest
example-registry-quay-quay-enterprise.apps.quay-ocp.gcp.quaydev.org/openshift_e2e-demo/httpd-example:latest
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
On the Red Hat Quay UI, navigate to the
openshift_e2e-demo
Organization and select the httpd-example repository. -
Click Tags in the navigation pane and confirm that the
latest
tag has been successfully pushed. Enter the following command to ensure that the latest tag has been resolved:
oc describe is httpd-example
$ oc describe is httpd-example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After the
ImageStream
is resolved, a new deployment should have been triggered. Enter the following command to generate a URL output:oc get route httpd-example --template='{{ .spec.host }}'
$ oc get route httpd-example --template='{{ .spec.host }}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
httpd-example-e2e-demo.apps.quay-ocp.gcp.quaydev.org
httpd-example-e2e-demo.apps.quay-ocp.gcp.quaydev.org
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Navigate to the URL. If a sample webpage appears, the deployment was successful.
Enter the following command to delete the resources and clean up your Red Hat Quay repository:
oc delete project e2e-demo
$ oc delete project e2e-demo
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe command waits until the project resources have been removed. This can be bypassed by adding the
--wait=false
to the above command-
After the command completes, navigate to your Red Hat Quay repository and confirm that the
openshift_e2e-demo
Organization is no longer available.
Additional resources
- Best practices dictate that all communication between a client and an image registry be facilitated through secure means. Communication should leverage HTTPS/TLS with a certificate trust between the parties. While Red Hat Quay can be configured to serve an insecure configuration, proper certificates should be utilized on the server and configured on the client. Follow the OpenShift Container Platform documentation for adding and managing certificates at the container runtime level.