Skip to content

Commit ff388db

Browse files
authored
Merge pull request #97745 from shivanisathe25/update_csinote
[DOCS] Shared Resource CSI Driver wording update
2 parents 5ac32c2 + bca37fe commit ff388db

File tree

1 file changed

+3
-123
lines changed

1 file changed

+3
-123
lines changed

modules/builds-running-entitled-builds-with-sharedsecret-objects.adoc

Lines changed: 3 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -2,129 +2,9 @@
22
[id="builds-running-entitled-builds-with-sharedsecret-objects_{context}"]
33
= Running builds using SharedSecret objects
44

5-
You can use a `SharedSecret` object to securely access the entitlement keys of a cluster in builds.
5+
You can use a `SharedSecret` object to securely access the entitlement keys of a cluster in builds. The `SharedSecret` object allows you to share and synchronize secrets across namespaces.
66

7-
The `SharedSecret` object allows you to share and synchronize secrets across namespaces.
8-
9-
[IMPORTANT]
10-
====
11-
The Shared Resource CSI Driver feature is now generally available in link:https://docs.redhat.com/en/documentation/builds_for_red_hat_openshift/1.1[{builds-v2title} 1.1]. This feature is now removed in {product-title} 4.18 and later. To use this feature, ensure that you are using {builds-v2title} 1.1 or later.
12-
====
13-
14-
.Prerequisites
15-
16-
* You have enabled the `TechPreviewNoUpgrade` feature set by using the feature gates. For more information, see xref:../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling features using feature gates].
17-
* You must have permission to perform the following actions:
18-
** Create build configs and start builds.
19-
** Discover which `SharedSecret` CR instances are available by entering the `oc get sharedsecrets` command and getting a non-empty list back.
20-
** Determine if the `builder` service account available to you in your namespace is allowed to use the given `SharedSecret` CR instance. In other words, you can run `oc adm policy who-can use <identifier of specific SharedSecret>` to see if the `builder` service account in your namespace is listed.
21-
22-
[NOTE]
23-
====
24-
If neither of the last two prerequisites in this list are met, establish, or ask someone to establish, the necessary role-based access control (RBAC) so that you can discover `SharedSecret` CR instances and enable service accounts to use `SharedSecret` CR instances.
25-
====
26-
27-
.Procedure
28-
29-
. Use `oc apply` to create a `SharedSecret` object instance with the cluster's entitlement secret.
30-
+
317
[IMPORTANT]
328
====
33-
You must have cluster administrator permissions to create `SharedSecret` objects.
34-
====
35-
+
36-
.Example `oc apply -f` command with YAML `Role` object definition
37-
[source,terminal]
38-
----
39-
$ oc apply -f - <<EOF
40-
kind: SharedSecret
41-
apiVersion: sharedresource.openshift.io/v1alpha1
42-
metadata:
43-
name: etc-pki-entitlement
44-
spec:
45-
secretRef:
46-
name: etc-pki-entitlement
47-
namespace: openshift-config-managed
48-
EOF
49-
----
50-
51-
. Create a role to grant the `builder` service account permission to access the `SharedSecret` object:
52-
+
53-
.Example `oc apply -f` command
54-
[source,terminal]
55-
----
56-
$ oc apply -f - <<EOF
57-
apiVersion: rbac.authorization.k8s.io/v1
58-
kind: Role
59-
metadata:
60-
name: builder-etc-pki-entitlement
61-
namespace: build-namespace
62-
rules:
63-
- apiGroups:
64-
- sharedresource.openshift.io
65-
resources:
66-
- sharedsecrets
67-
resourceNames:
68-
- etc-pki-entitlement
69-
verbs:
70-
- use
71-
EOF
72-
----
73-
74-
. Create a `RoleBinding` object that grants the `builder` service account permission to access the `SharedSecret` object by running the following command:
75-
+
76-
.Example `oc create rolebinding` command
77-
[source,terminal]
78-
----
79-
$ oc create rolebinding builder-etc-pki-entitlement --role=builder-etc-pki-entitlement --serviceaccount=build-namespace:builder
80-
----
81-
82-
. Add the entitlement secret to your `BuildConfig` object by using a CSI volume mount:
83-
+
84-
.Example YAML `BuildConfig` object definition
85-
[source,yaml]
86-
----
87-
apiVersion: build.openshift.io/v1
88-
kind: BuildConfig
89-
metadata:
90-
name: uid-wrapper-rhel9
91-
namespace: build-namespace
92-
spec:
93-
runPolicy: Serial
94-
source:
95-
dockerfile: |
96-
FROM registry.redhat.io/ubi9/ubi:latest
97-
RUN rm -rf /etc/rhsm-host <1>
98-
RUN yum --enablerepo=codeready-builder-for-rhel-9-x86_64-rpms install \ <2>
99-
nss_wrapper \
100-
uid_wrapper -y && \
101-
yum clean all -y
102-
RUN ln -s /run/secrets/rhsm /etc/rhsm-host <3>
103-
strategy:
104-
type: Docker
105-
dockerStrategy:
106-
volumes:
107-
- mounts:
108-
- destinationPath: "/etc/pki/entitlement"
109-
name: etc-pki-entitlement
110-
source:
111-
csi:
112-
driver: csi.sharedresource.openshift.io
113-
readOnly: true <4>
114-
volumeAttributes:
115-
sharedSecret: etc-pki-entitlement <5>
116-
type: CSI
117-
----
118-
+
119-
<1> You must include the command to remove the `/etc/rhsm-host` directory and all its contents in the Dockerfile before executing any `yum` or `dnf` commands.
120-
<2> Use the link:https://access.redhat.com/downloads/content/package-browser[Red Hat Package Browser] to find the correct repositories for your installed packages.
121-
<3> You must restore the `/etc/rhsm-host` symbolic link to keep your image compatible with other Red Hat container images.
122-
<4> You must set `readOnly` to `true` to mount the shared resource in the build.
123-
<5> Reference the name of the `SharedSecret` object to include it in the build.
124-
125-
. Start a build from the `BuildConfig` object and follow the logs using the `oc` command.
126-
+
127-
[source,terminal]
128-
----
129-
$ oc start-build uid-wrapper-rhel9 -n build-namespace -F
130-
----
9+
The Shared Resource CSI Driver feature is now generally available in link:https://docs.redhat.com/en/documentation/builds_for_red_hat_openshift/1.1[{builds-v2title} 1.1]. To use this feature, ensure that you have installed {builds-v2title} 1.1 or later.
10+
====

0 commit comments

Comments
 (0)