Skip to content

Commit

Permalink
specify nonroot uid for manager
Browse files Browse the repository at this point in the history
  • Loading branch information
harpratap committed Sep 2, 2020
1 parent f7a3b65 commit ab10f57
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/plugin/v3/scaffolds/internal/templates/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
USER 65532:65532
ENTRYPOINT ["/manager"]
`
2 changes: 2 additions & 0 deletions pkg/plugin/v3/scaffolds/internal/templates/manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ spec:
labels:
control-plane: controller-manager
spec:
securityContext:
runAsUser: 65532
containers:
- command:
- /manager
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3-addon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
USER 65532:65532

ENTRYPOINT ["/manager"]
2 changes: 2 additions & 0 deletions testdata/project-v3-addon/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
labels:
control-plane: controller-manager
spec:
securityContext:
runAsUser: 65532
containers:
- command:
- /manager
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3-multigroup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
USER 65532:65532

ENTRYPOINT ["/manager"]
2 changes: 2 additions & 0 deletions testdata/project-v3-multigroup/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
labels:
control-plane: controller-manager
spec:
securityContext:
runAsUser: 65532
containers:
- command:
- /manager
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER nonroot:nonroot
USER 65532:65532

ENTRYPOINT ["/manager"]
2 changes: 2 additions & 0 deletions testdata/project-v3/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
labels:
control-plane: controller-manager
spec:
securityContext:
runAsUser: 65532
containers:
- command:
- /manager
Expand Down

0 comments on commit ab10f57

Please sign in to comment.