This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 10. Using Red Hat subscriptions in builds
Use the following sections to run entitled builds on OpenShift Container Platform.
10.1. Creating an image stream tag for the Red Hat Universal Base Image 링크 복사링크가 클립보드에 복사되었습니다!
To use Red Hat subscriptions within a build, you create an image stream tag to reference the Universal Base Image (UBI).
To make the UBI available in every project in the cluster, you add the image stream tag to the openshift
namespace. Otherwise, to make it available in a specific project, you add the image stream tag to that project.
The benefit of using image stream tags this way is that doing so grants access to the UBI based on the registry.redhat.io
credentials in the install pull secret without exposing the pull secret to other users. This is more convenient than requiring each developer to install pull secrets with registry.redhat.io
credentials in each project.
Procedure
To create an
ImageStreamTag
in theopenshift
namespace, so it is available to developers in all projects, enter:oc tag --source=docker registry.redhat.io/ubi7/ubi:latest ubi:latest -n openshift
$ oc tag --source=docker registry.redhat.io/ubi7/ubi:latest ubi:latest -n openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To create an
ImageStreamTag
in a single project, enter:oc tag --source=docker registry.redhat.io/ubi7/ubi:latest ubi:latest
$ oc tag --source=docker registry.redhat.io/ubi7/ubi:latest ubi:latest
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2. Adding subscription entitlements as a build secret 링크 복사링크가 클립보드에 복사되었습니다!
Builds that use Red Hat subscriptions to install content must include the entitlement keys as a build secret.
Prerequisites
You must have access to Red Hat entitlements through your subscription, and the entitlements must have separate public and private key files.
Procedure
Create a secret containing your entitlements, ensuring that there are separate files containing the public and private keys:
oc create secret generic etc-pki-entitlement --from-file /path/to/entitlement/{ID}.pem \ --from-file /path/to/entitlement/{ID}-key.pem ...
$ oc create secret generic etc-pki-entitlement --from-file /path/to/entitlement/{ID}.pem \ > --from-file /path/to/entitlement/{ID}-key.pem ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the secret as a build input in the build configuration:
source: secrets: - secret: name: etc-pki-entitlement destinationDir: etc-pki-entitlement
source: secrets: - secret: name: etc-pki-entitlement destinationDir: etc-pki-entitlement
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.3. Running builds with Subscription Manager 링크 복사링크가 클립보드에 복사되었습니다!
10.3.1. Docker builds using Subscription Manager 링크 복사링크가 클립보드에 복사되었습니다!
Docker strategy builds can use the Subscription Manager to install subscription content.
Prerequisites
The entitlement keys, subscription manager configuration, and subscription manager certificate authority must be added as build inputs.
Procedure
Use the following as an example Dockerfile to install content with the Subscription Manager:
10.4. Running builds with Red Hat Satellite subscriptions 링크 복사링크가 클립보드에 복사되었습니다!
10.4.1. Adding Red Hat Satellite configurations to builds 링크 복사링크가 클립보드에 복사되었습니다!
Builds that use Red Hat Satellite to install content must provide appropriate configurations to obtain content from Satellite repositories.
Prerequisites
You must provide or create a
yum
-compatible repository configuration file that downloads content from your Satellite instance.Sample repository configuration
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Create a
ConfigMap
containing the Satellite repository configuration file:oc create configmap yum-repos-d --from-file /path/to/satellite.repo
$ oc create configmap yum-repos-d --from-file /path/to/satellite.repo
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the Satellite repository configuration to the
BuildConfig
:source: configMaps: - configMap: name: yum-repos-d destinationDir: yum.repos.d
source: configMaps: - configMap: name: yum-repos-d destinationDir: yum.repos.d
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.4.2. Docker builds using Red Hat Satellite subscriptions 링크 복사링크가 클립보드에 복사되었습니다!
Docker strategy builds can use Red Hat Satellite repositories to install subscription content.
Prerequisites
- The entitlement keys and Satellite repository configurations must be added as build inputs.
Procedure
Use the following as an example Dockerfile to install content with Satellite:
- 1
- If adding Satellite configurations to builds using
enabled=1
fails, addRUN sed -i".org" -e "s#^enabled=1#enabled=0#g" /etc/yum/pluginconf.d/subscription-manager.conf
to the Dockerfile.
10.5. Squash layers with docker builds 링크 복사링크가 클립보드에 복사되었습니다!
Docker builds normally create a layer representing each instruction in a Dockerfile. Setting the imageOptimizationPolicy
to SkipLayers
merges all instructions into a single layer on top of the base image.
Procedure
Set the
imageOptimizationPolicy
toSkipLayers
:strategy: dockerStrategy: imageOptimizationPolicy: SkipLayers
strategy: dockerStrategy: imageOptimizationPolicy: SkipLayers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow