Skip to content

Commit

Permalink
Configurable Security Context for CronJobs (#705)
Browse files Browse the repository at this point in the history
* Configurable Security Context for Snuba CronJobs

Configurable Security Context is missing from both Snuba cleanup jobs
(cleanup transactions and cleanup errors). It makes it impossible to run
those jobs with `runAsNonRoot` - k8s cannot verify id of a named user.

* Configurable Security Context for Sentry Cleanup

It's necessary to run it in restrictive environment blocking pods running as root.

Co-authored-by: Szymon Soloch <ssoloch@opera.com>
  • Loading branch information
Agalin and Szymon Soloch authored Oct 17, 2022
1 parent 086dea2 commit 0a64d95
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sentry/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sentry
description: A Helm chart for Kubernetes
type: application
version: 16.0.4
version: 16.0.5
appVersion: 22.9.0
dependencies:
- name: memcached
Expand Down
4 changes: 4 additions & 0 deletions sentry/templates/cronjob-sentry-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ spec:
imagePullSecrets:
{{ toYaml .Values.images.sentry.imagePullSecrets | indent 12 }}
{{- end }}
{{- if .Values.sentry.cleanup.securityContext }}
securityContext:
{{ toYaml .Values.sentry.cleanup.securityContext | indent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-sentry-cleanup
image: "{{ template "sentry.image" . }}"
Expand Down
4 changes: 4 additions & 0 deletions sentry/templates/cronjob-snuba-cleanup-errors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ spec:
imagePullSecrets:
{{ toYaml .Values.images.snuba.imagePullSecrets | indent 12 }}
{{- end }}
{{- if .Values.snuba.cleanupErrors.securityContext }}
securityContext:
{{ toYaml .Values.snuba.cleanupErrors.securityContext | indent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-snuba-cleanup-errors
image: "{{ template "snuba.image" . }}"
Expand Down
4 changes: 4 additions & 0 deletions sentry/templates/cronjob-snuba-cleanup-transactions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ spec:
imagePullSecrets:
{{ toYaml .Values.images.snuba.imagePullSecrets | indent 12 }}
{{- end }}
{{- if .Values.snuba.cleanupTransactions.securityContext }}
securityContext:
{{ toYaml .Values.snuba.cleanupTransactions.securityContext | indent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-snuba-cleanup-errors
image: "{{ template "snuba.image" . }}"
Expand Down
3 changes: 3 additions & 0 deletions sentry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ sentry:
enabled: true
schedule: "0 0 * * *"
days: 90
# securityContext: {}
sidecars: []
volumes: []
serviceAccount: {}
Expand Down Expand Up @@ -424,6 +425,7 @@ snuba:
schedule: "0 * * * *"
sidecars: []
volumes: []
# securityContext: {}
serviceAccount: {}

cleanupTransactions:
Expand All @@ -435,6 +437,7 @@ snuba:
schedule: "0 * * * *"
sidecars: []
volumes: []
# securityContext: {}
serviceAccount: {}

hooks:
Expand Down

0 comments on commit 0a64d95

Please sign in to comment.