Skip to content

Commit

Permalink
Run as non-root user (#20)
Browse files Browse the repository at this point in the history
* Switch from port 80 to 8000

Signed-off-by: David Young <davidy@funkypenguin.co.nz>

* Bump chart for breaking change (port 80->8000)

Signed-off-by: David Young <davidy@funkypenguin.co.nz>

* Add securityContext to chart

Signed-off-by: David Young <davidy@funkypenguin.co.nz>

Signed-off-by: David Young <davidy@funkypenguin.co.nz>
  • Loading branch information
funkypenguin authored Sep 2, 2022
1 parent 010373c commit 72ff806
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ FROM alpine:3.14
COPY --from=build /app/flagger-k6-webhook /usr/bin/flagger-k6-webhook
COPY --from=loadimpact/k6 /usr/bin/k6 /usr/bin/k6

ENTRYPOINT /usr/bin/flagger-k6-webhook
ENTRYPOINT /usr/bin/flagger-k6-webhook
USER 65534
2 changes: 1 addition & 1 deletion charts/k6-loadtester/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: k6-loadtester
description: Flagger webhook using k6 to do load testing of the canary before rolling out traffic
type: application
version: 0.0.1
version: 1.0.0
appVersion: "0.1.1"
sources:
- https://github.com/grafana/flagger-k6-webhook
Expand Down
2 changes: 1 addition & 1 deletion charts/k6-loadtester/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
containerPort: 8000
protocol: TCP
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
Expand Down
20 changes: 10 additions & 10 deletions charts/k6-loadtester/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ logLevel: debug

readinessProbe:
httpGet:
port: 80
port: 8000
path: /health

serviceAccount:
Expand All @@ -29,20 +29,20 @@ serviceAccount:

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000
podSecurityContext:
fsGroup: 65534

securityContext:
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534

service:
type: ClusterIP
port: 80
port: 8000

resources: {}
# limits:
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

const (
defaultPort = 80
defaultPort = 8000

flagCloudToken = "cloud-token"
flagLogLevel = "log-level"
Expand Down
4 changes: 2 additions & 2 deletions example/loadtester-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ spec:
image: ghcr.io/grafana/flagger-k6-webhook:v0.0.4
name: k6-loadtester
ports:
- containerPort: 80
- containerPort: 8000
name: http-metrics
readinessProbe:
httpGet:
path: /health
port: 80
port: 8000
6 changes: 3 additions & 3 deletions example/loadtester-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
namespace: flagger
spec:
ports:
- name: k6-loadtester-http-metrics
port: 80
targetPort: 80
- name: http-k6-loadtester-metrics
port: 8000
targetPort: 8000
selector:
name: k6-loadtester

0 comments on commit 72ff806

Please sign in to comment.