Skip to content

Commit eadabe9

Browse files
committed
configure images with a UID and set this in the deployment security contexts
- also execute chown after copying binaries to hyperfed path
1 parent 9e2e763 commit eadabe9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

charts/kubefed/charts/controllermanager/templates/deployments.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ spec:
1616
labels:
1717
kubefed-control-plane: controller-manager
1818
spec:
19+
securityContext:
20+
runAsUser: 1001
1921
serviceAccountName: kubefed-controller
2022
containers:
2123
- args:
@@ -60,6 +62,8 @@ spec:
6062
labels:
6163
kubefed-admission-webhook: "true"
6264
spec:
65+
securityContext:
66+
runAsUser: 1001
6367
serviceAccountName: kubefed-admission-webhook
6468
containers:
6569
- name: admission-webhook

images/kubefed/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515

1616
FROM alpine:latest
1717
RUN apk --no-cache add ca-certificates
18-
RUN adduser -D hyperfed
18+
RUN adduser -D -g hyperfed -u 1001 hyperfed
1919

20-
RUN mkdir -p /hyperfed && \
21-
chown -R hyperfed:hyperfed /hyperfed
20+
RUN mkdir -p /hyperfed
2221

2322
WORKDIR /hyperfed/
2423
COPY /hyperfed .
2524
RUN ln -s hyperfed controller-manager \
2625
&& ln -s hyperfed kubefedctl \
2726
&& ln -s hyperfed webhook
2827

28+
RUN chown -R hyperfed:hyperfed /hyperfed
29+
2930
USER hyperfed
3031
ENTRYPOINT ["./controller-manager"]

0 commit comments

Comments
 (0)