diff --git a/charts/sentry/templates/deployment-geoip-job.yaml b/charts/sentry/templates/deployment-geoip-job.yaml index cd7067b5d..58c88754d 100644 --- a/charts/sentry/templates/deployment-geoip-job.yaml +++ b/charts/sentry/templates/deployment-geoip-job.yaml @@ -4,12 +4,18 @@ kind: Job metadata: name: geoip-install-job annotations: - "helm.sh/hook": "pre-install" - "helm.sh/hook-weight": "3" + "helm.sh/hook": "post-install,post-upgrade" + "helm.sh/hook-weight": "9" spec: template: spec: initContainers: + - name: init-create-geoip-dir + image: busybox + command: ['sh', '-c', 'mkdir -p /usr/share/GeoIP'] + volumeMounts: + - name: {{ .Values.geodata.volumeName }} + mountPath: {{ .Values.geodata.mountPath }} - name: init-geoip-conf image: busybox command: ['sh', '-c', 'echo -e "AccountID $(echo $GEOIPUPDATE_ACCOUNT_ID)\nLicenseKey $(echo $GEOIPUPDATE_LICENSE_KEY)\nEditionIDs $(echo $GEOIPUPDATE_EDITION_IDS)" > /usr/share/GeoIP/GeoIP.conf'] diff --git a/charts/sentry/templates/pvc-geoip.yaml b/charts/sentry/templates/pvc-geoip.yaml index 46ca5d970..42814a492 100644 --- a/charts/sentry/templates/pvc-geoip.yaml +++ b/charts/sentry/templates/pvc-geoip.yaml @@ -8,6 +8,9 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + annotations: + "helm.sh/hook": "pre-install,pre-upgrade" + "helm.sh/hook-weight": "-1" spec: accessModes: - ReadWriteMany diff --git a/charts/sentry/templates/relay/deployment-relay.yaml b/charts/sentry/templates/relay/deployment-relay.yaml index 75403c4f6..81422016b 100644 --- a/charts/sentry/templates/relay/deployment-relay.yaml +++ b/charts/sentry/templates/relay/deployment-relay.yaml @@ -153,7 +153,7 @@ spec: mountPath: /work/.relay/config.yml subPath: config.yml readOnly: true - {{- if .Values.geodata.volumeName }} + {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} mountPath: {{ .Values.geodata.mountPath }} {{- end }} @@ -202,7 +202,7 @@ spec: {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} persistentVolumeClaim: - claimName: data-sentry-geoip + claimName: {{ .Values.geodata.volumeName }} {{- end }} {{- if .Values.relay.volumes }} {{ toYaml .Values.relay.volumes | indent 6 }} diff --git a/charts/sentry/templates/sentry/web/deployment-sentry-web.yaml b/charts/sentry/templates/sentry/web/deployment-sentry-web.yaml index b42c9c321..e84e160ec 100644 --- a/charts/sentry/templates/sentry/web/deployment-sentry-web.yaml +++ b/charts/sentry/templates/sentry/web/deployment-sentry-web.yaml @@ -110,7 +110,7 @@ spec: readOnly: true - mountPath: {{ .Values.filestore.filesystem.path }} name: sentry-data - {{- if .Values.geodata.volumeName }} + {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} mountPath: {{ .Values.geodata.mountPath }} {{- end }} @@ -189,7 +189,7 @@ spec: {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} persistentVolumeClaim: - claimName: data-sentry-geoip + claimName: {{ .Values.geodata.volumeName }} {{- end }} {{- if .Values.sentry.web.volumes }} {{ toYaml .Values.sentry.web.volumes | indent 6 }} diff --git a/charts/sentry/templates/sentry/worker/deployment-sentry-worker-events.yaml b/charts/sentry/templates/sentry/worker/deployment-sentry-worker-events.yaml index 867be3ad6..487bca5ff 100644 --- a/charts/sentry/templates/sentry/worker/deployment-sentry-worker-events.yaml +++ b/charts/sentry/templates/sentry/worker/deployment-sentry-worker-events.yaml @@ -93,7 +93,7 @@ spec: readOnly: true - mountPath: {{ .Values.filestore.filesystem.path }} name: sentry-data - {{- if .Values.geodata.volumeName }} + {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} mountPath: {{ .Values.geodata.mountPath }} {{- end }} @@ -153,7 +153,7 @@ spec: {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} persistentVolumeClaim: - claimName: data-sentry-geoip + claimName: {{ .Values.geodata.volumeName }} {{- end }} {{- if .Values.sentry.workerEvents.priorityClassName }} priorityClassName: "{{ .Values.sentry.workerEvents.priorityClassName }}" diff --git a/charts/sentry/templates/sentry/worker/deployment-sentry-worker-transactions.yaml b/charts/sentry/templates/sentry/worker/deployment-sentry-worker-transactions.yaml index 44d27a7f5..5ae3097f5 100644 --- a/charts/sentry/templates/sentry/worker/deployment-sentry-worker-transactions.yaml +++ b/charts/sentry/templates/sentry/worker/deployment-sentry-worker-transactions.yaml @@ -93,7 +93,7 @@ spec: readOnly: true - mountPath: {{ .Values.filestore.filesystem.path }} name: sentry-data - {{- if .Values.geodata.volumeName }} + {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} mountPath: {{ .Values.geodata.mountPath }} {{- end }} @@ -156,7 +156,7 @@ spec: {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} persistentVolumeClaim: - claimName: data-sentry-geoip + claimName: {{ .Values.geodata.volumeName }} {{- end }} {{- if .Values.sentry.workerTransactions.volumes }} {{ toYaml .Values.sentry.workerTransactions.volumes | indent 6 }} diff --git a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml index d76c14282..3e61a2094 100644 --- a/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml +++ b/charts/sentry/templates/sentry/worker/deployment-sentry-worker.yaml @@ -108,7 +108,7 @@ spec: readOnly: true - mountPath: {{ .Values.filestore.filesystem.path }} name: sentry-data - {{- if .Values.geodata.volumeName }} + {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} - name: {{ .Values.geodata.volumeName }} mountPath: {{ .Values.geodata.mountPath }} {{- end }} @@ -171,4 +171,9 @@ spec: {{- if .Values.sentry.worker.volumes }} {{ toYaml .Values.sentry.worker.volumes | indent 6 }} {{- end }} + {{- if and .Values.geodata.volumeName .Values.geodata.accountID }} + - name: {{ .Values.geodata.volumeName }} + persistentVolumeClaim: + claimName: {{ .Values.geodata.volumeName }} + {{- end }} {{- end }} diff --git a/charts/sentry/values.yaml b/charts/sentry/values.yaml index ec61a3e9f..eca606ae4 100644 --- a/charts/sentry/values.yaml +++ b/charts/sentry/values.yaml @@ -165,13 +165,13 @@ geodata: ## If undefined (the default) or set to null, no storageClassName spec is ## set, choosing the default provisioner. (gp2 on AWS, standard on ## GKE, AWS & OpenStack) - # storageClass: "-" + # storageClass: "" # for example: csi-s3 size: 1Gi - volumeName: "" + volumeName: "" # for example: data-sentry-geoip # mountPath of the volume containing the database - mountPath: "" + mountPath: "" # for example: /usr/share/GeoIP # path to the geoip database inside the volumemount - path: "" + path: "" # for example: /usr/share/GeoIP/GeoLite2-City.mmdb sentry: # to not generate a sentry-secret, use these 2 values to reference an existing secret