Skip to content

Commit

Permalink
storage-scrubber: enable jwt auth with storage controller
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi Z <[email protected]>
  • Loading branch information
skyzh committed Aug 5, 2024
1 parent 64c9eab commit b1ff185
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/neon-storage-scrubber/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: neon-storage-scrubber
description: neon-storage-scrubber
type: application
version: 1.0.0
version: 1.1.0
appVersion: "v0.1.0"
sources:
- https://github.com/neondatabase/neon/tree/main/storage_scrubber
5 changes: 4 additions & 1 deletion charts/neon-storage-scrubber/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ $ helm install neon-storage-scrubber neondatabase/neon-storage-scrubber
| settings.sentryUrl | string | `""` | url (will be converted into `SENTRY_DSN` environment variable) used by sentry to collect error/panic events in neon-pg-sni-router |
| storageScrubber.awsBucket | string | `""` | The AWS bucket for the pageserver storage |
| storageScrubber.awsRegion | string | `""` | The AWS region to run the scrubber |
| storageScrubber.command | list | `["/usr/local/bin/storage_scrubber","pageserver-physical-gc","--min-age=1week"]` | The command to run |
| storageScrubber.command | list | `["pageserver-physical-gc","--min-age=1week"]` | The command to run |
| storageScrubber.enableStorageControllerConnection | bool | `false` | Enable storage controller related functionalities |
| storageScrubber.schedule | string | `"0 18 * * *"` | |
| storageScrubber.storageControllerJwtToken | string | `""` | Control plane / storage controller JWT token for connecting to the storage controller |
| storageScrubber.storageControllerUrl | string | `""` | URL of the storage controller |
| storageScrubber.timeZone | string | `"Etc/UTC"` | The timezone for the cron job |
| tolerations | list | `[]` | Tolerations for pod assignment. |

Expand Down
12 changes: 12 additions & 0 deletions charts/neon-storage-scrubber/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,21 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /usr/local/bin/storage_scrubber
{{- if .Values.storageScrubber.enableStorageControllerConnection }}
- "--controller-jwt"
- {{ .Values.storageScrubber.storageControllerJwtToken | quote }}
- "--controller-api"
- {{ .Values.storageScrubber.storageControllerUrl | quote }}
{{- end -}}
{{- toYaml .Values.storageScrubber.command | nindent 16 }}
env:
- name: BUCKET
value: {{ .Values.storageScrubber.awsBucket }}
- name: REGION
value: {{ .Values.storageScrubber.awsRegion }}
- name: STORAGE_CONTROLLER_URL
value: {{ .Values.storageScrubber.storageControllerUrl | quote }}
{{- if .Values.settings }}
{{- with .Values.settings.sentryUrl }}
- name: SENTRY_DSN
Expand All @@ -59,6 +68,9 @@ spec:
{{- toYaml . | nindent 16 }}
{{- end }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "neon-storage-scrubber.fullname" . }}-env-vars
resources:
{{- toYaml .Values.resources | nindent 16 }}
{{- with .Values.nodeSelector }}
Expand Down
9 changes: 9 additions & 0 deletions charts/neon-storage-scrubber/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "neon-storage-scrubber.fullname" . }}-env-vars
labels:
{{- include "neon-storage-scrubber.labels" . | nindent 4 }}
type: Opaque
data:
STORAGE_CONTROLLER_JWT_TOKEN: {{ .Values.storageScrubber.storageControllerJwtToken | b64enc | quote }}
10 changes: 8 additions & 2 deletions charts/neon-storage-scrubber/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ settings:
sentryUrl: ""
# settings.sentryEnvironment -- "development" or "production". It will be visible in sentry in order to filter issues
sentryEnvironment: "development"
# -- extra env variables when running the job
# settings.extraEnvs -- extra env variables when running the job
extraEnvs:
- name: RUST_BACKTRACE
value: '1'
Expand All @@ -49,9 +49,15 @@ storageScrubber:
schedule: "0 18 * * *"
# -- The command to run
command:
- /usr/local/bin/storage_scrubber
- pageserver-physical-gc
- --min-age=1week
# -- Enable storage controller related functionalities
enableStorageControllerConnection: false
# -- Control plane / storage controller JWT token for connecting to the storage controller

Check failure on line 56 in charts/neon-storage-scrubber/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

56:93 [trailing-spaces] trailing spaces
storageControllerJwtToken: ""
# -- URL of the storage controller
storageControllerUrl: ""


# -- Annotations for neon-storage-scrubber pods
podAnnotations: {}
Expand Down

0 comments on commit b1ff185

Please sign in to comment.