Skip to content

Commit

Permalink
simplify sec context configuration for controller (#74)
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitriy Kalinin <[email protected]>
  • Loading branch information
cppforlife and Dmitriy Kalinin authored Jun 10, 2022
1 parent 51500ee commit 3b76cf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -ldflags="-X 'main.Version=$SG
# --- run ---
FROM photon:3.0

RUN tdnf install -y shadow-tools

RUN groupadd -g 2000 secretgen-controller && useradd -r -u 1000 --create-home -g secretgen-controller secretgen-controller
RUN chmod g+w /etc/pki/tls/certs/ca-bundle.crt && chgrp secretgen-controller /etc/pki/tls/certs/ca-bundle.crt
USER secretgen-controller

COPY --from=0 /go/src/github.com/vmware-tanzu/carvel-secretgen-controller/controller secretgen-controller

# Run as secretgen-controller by default, will be overridden to a random uid on OpenShift
USER 1000
ENV PATH="/:${PATH}"
ENTRYPOINT ["/secretgen-controller"]
10 changes: 6 additions & 4 deletions config/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ spec:
cpu: 120m
memory: 100Mi
securityContext:
runAsUser: 1000
runAsGroup: 2000
securityContext:
fsGroup: 3000
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- all

0 comments on commit 3b76cf0

Please sign in to comment.