Skip to content

Commit b91ae3b

Browse files
committed
make fmt
1 parent 6efcf93 commit b91ae3b

File tree

1 file changed

+72
-73
lines changed

1 file changed

+72
-73
lines changed

docs/install/openshift.md

Lines changed: 72 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -158,85 +158,84 @@ the Security Context Constraints (SCCs) in OpenShift.
158158

159159
1. Determine the UID range for the project:
160160

161-
```console
162-
oc get project coder -o json | jq -r '.metadata.annotations'
163-
{
164-
"openshift.io/description": "",
165-
"openshift.io/display-name": "coder",
166-
"openshift.io/requester": "kube:admin",
167-
"openshift.io/sa.scc.mcs": "s0:c26,c15",
168-
"openshift.io/sa.scc.supplemental-groups": "1000680000/10000",
169-
"openshift.io/sa.scc.uid-range": "1000680000/10000"
170-
}
171-
```
172-
173-
Note the `uid-range` and `supplemental-groups`. In this case, the project `coder`
174-
has been allocated 10,000 UIDs starting at 1000680000, and 10,000 GIDs starting
175-
at 1000680000. In this example, we will pick UID and GID 1000680000.
161+
```console
162+
oc get project coder -o json | jq -r '.metadata.annotations'
163+
{
164+
"openshift.io/description": "",
165+
"openshift.io/display-name": "coder",
166+
"openshift.io/requester": "kube:admin",
167+
"openshift.io/sa.scc.mcs": "s0:c26,c15",
168+
"openshift.io/sa.scc.supplemental-groups": "1000680000/10000",
169+
"openshift.io/sa.scc.uid-range": "1000680000/10000"
170+
}
171+
```
172+
173+
Note the `uid-range` and `supplemental-groups`. In this case, the project `coder`
174+
has been allocated 10,000 UIDs starting at 1000680000, and 10,000 GIDs starting
175+
at 1000680000. In this example, we will pick UID and GID 1000680000.
176176

177177
1. Create a `BuildConfig` referencing the source image you want to customize.
178-
This will automatically kick off a `Build` that will remain pending until step 3.
179-
180-
> For more information, please consult the [OpenShift Documentation](https://docs.openshift.com/container-platform/4.12/cicd/builds/understanding-buildconfigs.html).
181-
182-
```console
183-
oc create -f - <<EOF
184-
kind: BuildConfig
185-
apiVersion: build.openshift.io/v1
186-
metadata:
187-
name: enterprise-base
188-
namespace: coder
189-
spec:
190-
output:
191-
to:
192-
kind: ImageStreamTag
193-
name: 'enterprise-base:latest'
194-
strategy:
195-
type: Docker
196-
dockerStrategy:
197-
imageOptimizationPolicy: SkipLayers
198-
source:
199-
type: Dockerfile
200-
dockerfile: |
201-
# Specify the source image.
202-
FROM docker.io/codercom/enterprise-base:ubuntu
203-
204-
# Switch to root
205-
USER root
206-
207-
# As root:
208-
# 1) Remove the original coder user with UID 1000
209-
# 2) Add a coder group with an allowed UID
210-
# 3) Add a coder user as a member of the above group
211-
# 4) Fix ownership on the user's home directory
212-
RUN userdel coder && \
213-
groupadd coder -g 1000680000 && \
214-
useradd -l -u 1000680000 coder -g 1000680000 && \
215-
chown -R coder:coder /home/coder
216-
217-
# Go back to the user 'coder'
218-
USER coder
219-
triggers:
220-
- type: ConfigChange
221-
runPolicy: Serial
222-
EOF
223-
```
224-
178+
This will automatically kick off a `Build` that will remain pending until step 3.
179+
180+
> For more information, please consult the [OpenShift Documentation](https://docs.openshift.com/container-platform/4.12/cicd/builds/understanding-buildconfigs.html).
181+
182+
```console
183+
oc create -f - <<EOF
184+
kind: BuildConfig
185+
apiVersion: build.openshift.io/v1
186+
metadata:
187+
name: enterprise-base
188+
namespace: coder
189+
spec:
190+
output:
191+
to:
192+
kind: ImageStreamTag
193+
name: 'enterprise-base:latest'
194+
strategy:
195+
type: Docker
196+
dockerStrategy:
197+
imageOptimizationPolicy: SkipLayers
198+
source:
199+
type: Dockerfile
200+
dockerfile: |
201+
# Specify the source image.
202+
FROM docker.io/codercom/enterprise-base:ubuntu
203+
204+
# Switch to root
205+
USER root
206+
207+
# As root:
208+
# 1) Remove the original coder user with UID 1000
209+
# 2) Add a coder group with an allowed UID
210+
# 3) Add a coder user as a member of the above group
211+
# 4) Fix ownership on the user's home directory
212+
RUN userdel coder && \
213+
groupadd coder -g 1000680000 && \
214+
useradd -l -u 1000680000 coder -g 1000680000 && \
215+
chown -R coder:coder /home/coder
216+
217+
# Go back to the user 'coder'
218+
USER coder
219+
triggers:
220+
- type: ConfigChange
221+
runPolicy: Serial
222+
EOF
223+
```
225224

226225
1. Create an `ImageStream` as a target for the previous step:
227226

228-
```console
229-
oc create imagestream enterprise-base
230-
```
227+
```console
228+
oc create imagestream enterprise-base
229+
```
231230

232-
The `Build` created in the previous step should now begin.
233-
Once completed, you should see output similar to the following:
231+
The `Build` created in the previous step should now begin.
232+
Once completed, you should see output similar to the following:
234233

235-
```console
236-
oc get imagestreamtag
237-
NAME IMAGE REFERENCE UPDATED
238-
enterprise-base:latest image-registry.openshift-image-registry.svc:5000/coder/enterprise-base@sha256:1dbbe4ee11be9218e1e4741264135a4f57501fe592d94d20db6bfe11692accd1 55 minutes ago
239-
```
234+
```console
235+
oc get imagestreamtag
236+
NAME IMAGE REFERENCE UPDATED
237+
enterprise-base:latest image-registry.openshift-image-registry.svc:5000/coder/enterprise-base@sha256:1dbbe4ee11be9218e1e4741264135a4f57501fe592d94d20db6bfe11692accd1 55 minutes ago
238+
```
240239

241240
### 8. Create an OpenShift-compatible template
242241

@@ -251,7 +250,7 @@ Edit `main.tf` and update the following fields of the Kubernetes pod resource:
251250

252251
- `spec.security_context`: remove this field.
253252
- `spec.container.image`: update this field to the newly built image hosted
254-
on the OpenShift image registry from the previous step.
253+
on the OpenShift image registry from the previous step.
255254
- `spec.container.security_context`: remove this field.
256255

257256
Finally, create the template:

0 commit comments

Comments
 (0)