Skip to content

Commit

Permalink
Merge pull request #228 from logdnalf/master
Browse files Browse the repository at this point in the history
Allow the Operator to run as non-root.
  • Loading branch information
chusAlvarez authored Jan 29, 2020
2 parents fc18d3d + b4a5895 commit e9c5dea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ FROM alpine:latest
RUN apk --no-cache add \
ca-certificates
COPY --from=0 /go/src/github.com/spotahome/redis-operator/bin/linux/redis-operator /usr/local/bin
RUN addgroup -g 1000 rf && \
adduser -D -u 1000 -G rf rf && \
chown rf:rf /usr/local/bin/redis-operator
USER rf

ENTRYPOINT ["/usr/local/bin/redis-operator"]
4 changes: 4 additions & 0 deletions example/operator/all-redis-operator-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ spec:
- image: quay.io/spotahome/redis-operator:latest
imagePullPolicy: IfNotPresent
name: app
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
resources:
limits:
cpu: 100m
Expand Down
4 changes: 4 additions & 0 deletions example/operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ spec:
- image: quay.io/spotahome/redis-operator:latest
imagePullPolicy: IfNotPresent
name: app
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
resources:
limits:
cpu: 100m
Expand Down

0 comments on commit e9c5dea

Please sign in to comment.