此内容没有您所选择的语言版本。
Chapter 5. Using the Quay Bridge Operator
To verify that the Quay Bridge Operator synchronizes your OpenShift Container Platform projects with Red Hat Quay, you can create a test project and confirm that organizations, robot accounts, and image repositories are created automatically.
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
QuayIntegrationcustom resource.
Procedure
Enter the following command to create a new OpenShift Container Platform project called
e2e-demo:$ oc new-project e2e-demoAfter 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
openshiftvalue of the Organization might different if the clusterID in yourQuayIntegrationresource 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-openshiftExample 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 77mEnter the following command to display detailed information about
builderServiceAccount (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 deployerExample output
... Name: builder Namespace: e2e-demo Labels: <none> Annotations: <none> Image pull secrets: builder-dockercfg-12345 builder-quay-openshift Mountable secrets: builder-dockercfg-12345 builder-quay-openshift Tokens: builder-token-12345 Events: <none> ...Enter the following command to create and deploy a new application called
httpd-template:$ oc new-app --template=httpd-exampleExample output
--> Deploying template "e2e-demo/httpd-example" to project e2e-demo ... --> Creating resources ... service "httpd-example" created route.route.openshift.io "httpd-example" created imagestream.image.openshift.io "httpd-example" created buildconfig.build.openshift.io "httpd-example" created deploymentconfig.apps.openshift.io "httpd-example" created --> Success Access your application via route 'httpd-example-e2e-demo.apps.quay-ocp.gcp.quaydev.org' Build scheduled, use 'oc logs -f buildconfig/httpd-example' to track its progress. Run 'oc status' to view your app.After running this command,
BuildConfig,ImageStream,Service,Route, andDeploymentConfigresources are created. When theImageStreamresource is created, an associated repository is created in Red Hat Quay.The
ImageChangeTriggerfor theBuildConfigtriggers a new Build when the Apache HTTPD image, located in theopenshiftnamespace, is resolved. As the new Build is created, theMutatingWebhookConfigurationautomatically 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 }}'Example output
example-registry-quay-quay-enterprise.apps.quay-ocp.gcp.quaydev.org/openshift_e2e-demo/httpd-example:latest-
On the Red Hat Quay UI, navigate to the
openshift_e2e-demoOrganization and select the httpd-example repository. -
Click Tags in the navigation pane and confirm that the
latesttag has been successfully pushed. Enter the following command to ensure that the latest tag has been resolved:
$ oc describe is httpd-exampleExample output
Name: httpd-example Namespace: e2e-demo Created: 55 minutes ago Labels: app=httpd-example template=httpd-example Description: Keeps track of changes in the application image Annotations: openshift.io/generated-by=OpenShiftNewApp openshift.io/image.dockerRepositoryCheck=2023-10-02T17:56:45Z Image Repository: image-registry.openshift-image-registry.svc:5000/e2e-demo/httpd-example Image Lookup: local=false Unique Images: 0 Tags: 1 latest tagged from example-registry-quay-quay-enterprise.apps.quay-ocp.gcp.quaydev.org/openshift_e2e-demo/httpd-example:latestAfter the
ImageStreamis 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 }}'Example output
httpd-example-e2e-demo.apps.quay-ocp.gcp.quaydev.org- 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-demoNoteThe command waits until the project resources have been removed. This can be bypassed by adding the
--wait=falseto the above command-
After the command completes, navigate to your Red Hat Quay repository and confirm that the
openshift_e2e-demoOrganization is no longer available.
Additional resources