Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable container security contexts modifications #50

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: azure/setup-helm@v3

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
uses: helm/chart-testing-action@v2.6.1

- name: Run chart-testing (list-changed)
id: list-changed
Expand Down
2 changes: 1 addition & 1 deletion charts/athens-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: athens-proxy
version: 0.7.1
version: 0.8.0
appVersion: v0.12.0
description: The proxy server for Go modules
icon: https://raw.githubusercontent.com/gomods/athens/main/docs/static/banner.png
Expand Down
5 changes: 5 additions & 0 deletions charts/athens-proxy/ci/basic-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ jaeger:
enabled: true
extraLabels:
athensIs: "awesome"
image:
runAsNonRoot: true
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
19 changes: 11 additions & 8 deletions charts/athens-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ spec:
{{- toYaml .Values.annotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.image.runAsNonRoot }}
securityContext:
runAsUser: 1000
runAsGroup: 1000
{{- end }}
serviceAccount: {{ template "fullname" . }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
Expand Down Expand Up @@ -57,10 +62,9 @@ spec:
subPath: id_rsa-{{ $server.host }}
{{- end }}
{{- end }}
{{- if .Values.image.runAsNonRoot }}
{{- with .Values.initContainerSecurityContext }}
securityContext:
runAsUser: 1000
runAsGroup: 1000
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.intiContainerResources }}
resources:
Expand Down Expand Up @@ -235,15 +239,14 @@ spec:
subPath: {{ $server.existingSecret.subPath | quote }}
{{- end }}
{{- end }}
{{- if .Values.image.runAsNonRoot }}
{{- with .Values.securityContext }}
securityContext:
runAsUser: 1000
runAsGroup: 1000
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.resources }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
volumes:
- name: storage-volume
{{- if .Values.storage.disk.persistence.enabled }}
Expand Down
10 changes: 10 additions & 0 deletions charts/athens-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ storage:
# as GCP figures out internal authentication between products for you.
serviceAccount: ""

# Container security context configuration (see API reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core)
# This will override the `image.runAsNonRoot` settings in the specified container if `runAsUser` or `runAsGroup` are set
securityContext: {}
DrPsychick marked this conversation as resolved.
Show resolved Hide resolved
# allowPrivilegeEscalation: false
# runAsNonRoot: true

initContainerSecurityContext: {}
# allowPrivilegeEscalation: false
# runAsNonRoot: true
DrPsychick marked this conversation as resolved.
Show resolved Hide resolved

# Extra environment variables to be passed
# You can add any new ones at the bottom
configEnvVars: {}
Expand Down
Loading