Questo contenuto non è disponibile nella lingua selezionata.
Chapter 3. Bare metal builds with Red Hat Quay on OpenShift Container Platform
The procedures in this section explain how to create an environment for bare metal builds for Red Hat Quay on OpenShift Container Platform.
3.1. Configuring bare metal builds for Red Hat Quay on OpenShift Container Platform
Use the following procedure to configure bare metal builds for Red Hat Quay on OpenShift Container Platform.
					If you are using the Red Hat Quay Operator on OpenShift Container Platform with a managed route component in your QuayRegistry CRD, see "Red Hat Quay on OpenShift Container Platform builds limitations with self-managed routes".
				
Prerequisites
- You have an OpenShift Container Platform cluster provisioned with the Red Hat Quay Operator running.
- 
						You have set the tlscomponent tounmanagedand uploaded custom SSL/TLS certificates to the Red Hat Quay Operator. For more information, see SSL and TLS for Red Hat Quay.
- You are logged into OpenShift Container Platform as a cluster administrator.
Procedure
- Enter the following command to create a project where Builds will be run, for example, - bare-metal-builder:- oc new-project bare-metal-builder - $ oc new-project bare-metal-builder- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Create a new - ServiceAccountin the the- bare-metal-buildernamespace by entering the following command:- oc create sa -n bare-metal-builder quay-builder - $ oc create sa -n bare-metal-builder quay-builder- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Enter the following command to grant a user the - editrole within the- bare-metal-buildernamespace:- oc policy add-role-to-user -n bare-metal-builder edit system:serviceaccount:bare-metal-builder:quay-builder - $ oc policy add-role-to-user -n bare-metal-builder edit system:serviceaccount:bare-metal-builder:quay-builder- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Enter the following command to retrieve a token associated with the - quay-builderservice account in the- bare-metal-buildernamespace. This token is used to authenticate and interact with the OpenShift Container Platform cluster’s API server.- If your OpenShift Container Platform cluster is version 4.11+, enter the following command: - oc create token quay-builder -n bare-metal-builder --duration 24h - oc create token quay-builder -n bare-metal-builder --duration 24h- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- If your OpenShift Container Platform cluster is earlier than version 4.11, for example, version 4.10, enter the following command: - oc sa get-token -n bare-metal-builder quay-builder - $ oc sa get-token -n bare-metal-builder quay-builder- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
- Identify the URL for the OpenShift Container Platform cluster’s API server. This can be found in the OpenShift Container Platform web console.
- Identify a worker node label to be used when scheduling build jobs. Because build pods must run on bare metal worker nodes, typically these are identified with specific labels. - Check with your cluster administrator to determine exactly which node label should be used. 
- Obtain the Kube API Server’s certificate authority (CA) to add to Red Hat Quay’s extra certificates. - On OpenShift Container Platform versions 4.15+, enter the following commands to obtain the name of the secret containing the CA: - oc extract cm/kube-root-ca.crt -n openshift-apiserver - $ oc extract cm/kube-root-ca.crt -n openshift-apiserver- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - mv ca.crt build_cluster.crt - $ mv ca.crt build_cluster.crt- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- On OpenShift Container Platform versions earlier than 4.15, for example, 4.14, enter the following command: - oc get sa openshift-apiserver-sa --namespace=openshift-apiserver -o json | jq '.secrets[] | select(.name | contains("openshift-apiserver-sa-token"))'.name- $ oc get sa openshift-apiserver-sa --namespace=openshift-apiserver -o json | jq '.secrets[] | select(.name | contains("openshift-apiserver-sa-token"))'.name- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- 
								Obtain the ca.crtkey value from the secret in the OpenShift Container Platform Web Console. The value begins with "-----BEGIN CERTIFICATE-----"`.
- 
								Import the CA to Red Hat Quay. Ensure that the name of this file matches the K8S_API_TLS_CAfield used in Step 9.
 
- Create the following - SecurityContextConstraintsresource for the- ServiceAccount:- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Update the - config.yamlfile of your Red Hat Quay on OpenShift Container Platform deployment to include an appropriate bare metal builds configuration by using the OpenShift Container Platform web console.- 
								Click Operators Installed Operators Red Hat Quay Quay Registry. 
- Click the name of your registry, for example, example-registry.
- Under Config Bundle Secret, click the name of your configuration bundle, for example, extra-ca-certificate-config-bundle-secret.
- 
								Click Actions Edit Secret. 
- Add the following information to your Red Hat Quay - config.yamlfile, replacing each value with information that is relevant to your specific installation:- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- Obtained by running the following command:$ oc get route quayregistry-quay-builder -n ${QUAY_PROJECT} -o jsonpath='{.spec.host}'.
- 2
- The hostname for your Redis service.
- 3
- Set to match the name of your bare metal builds namespace. This example usedbare-metal-builder.
- 4
- TheK8S_API_SERVERis obtained by running$ oc cluster-info.
- 5
- You must manually create and add your custom CA cert, for example,K8S_API_TLS_CA: /conf/stack/extra_ca_certs/build-cluster.crt.
- 6
- Defaults to5120Miif left unspecified.
- 7
- Defaults to1000mif left unspecified.
- 8
- Defaults to3968Miif left unspecified.
- 9
- Defaults to500mif left unspecified.
- 10
- Obtained when running$ oc create sa.
- 11
- Allows public SSH keys to be added to the build environment for remote troubleshooting access. This key, or keys, should correspond to the private key that an admin or developer will use to SSH into the build worker for debugging purposes. This key can be obtained by establishing an SSH connection to the remote host using a specific SSH key and port. For example:$ ssh -i /path/to/ssh/key/set/in/ssh_authorized_keys -p 9999 core@localhost.
 
 
- 
								Click Operators 
- Restart your Red Hat Quay registry to enable the builds feature.
3.1.1. Red Hat Quay on OpenShift Container Platform builds limitations with self-managed routes
					The following limitations apply when you are using the Red Hat Quay Operator on OpenShift Container Platform with a managed route component:
				
- Currently, OpenShift Container Platform routes are only able to serve traffic to a single port. Additional steps are required to set up Red Hat Quay Builds.
- 
							Ensure that your kubectlorocCLI tool is configured to work with the cluster where the Red Hat Quay Operator is installed and that yourQuayRegistryexists; theQuayRegistrydoes not have to be on the same bare metal cluster where builders run.
- Ensure that HTTP/2 ingress is enabled on the OpenShift cluster by following these steps.
- The Red Hat Quay Operator creates a - Routeresource that directs gRPC traffic to the Build manager server running inside of the existing- Quaypod, or pods. If you want to use a custom hostname, or a subdomain like- <builder-registry.example.com>, ensure that you create a CNAME record with your DNS provider that points to the- status.ingress[0].hostof the create- Routeresource. For example:- kubectl get -n <namespace> route <quayregistry-name>-quay-builder -o jsonpath={.status.ingress[0].host}- $ kubectl get -n <namespace> route <quayregistry-name>-quay-builder -o jsonpath={.status.ingress[0].host}- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Using the OpenShift Container Platform UI or CLI, update the - Secretreferenced by- spec.configBundleSecretof the- QuayRegistrywith the build cluster CA certificate. Name the key- extra_ca_cert_build_cluster.cert. Update the- config.yamlfile entry with the correct values referenced in the build configuration that you created when you configured Red Hat Quay builds, and add the- BUILDMAN_HOSTNAMECONFIGURATION FIELD:- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 1
- The externally accessible server hostname which the build jobs use to communicate back to the build manager. Default is the same asSERVER_HOSTNAME. For an OpenShiftrouteresource, it is eitherstatus.ingress[0].hostor the CNAME entry if using a custom hostname.BUILDMAN_HOSTNAMEmust include the port number, for example,somehost:443for an OpenShift Container Platformrouteresource, as the gRPC client used to communicate with the build manager does not infer any port if omitted.