diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..75f3075 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +backups/ diff --git a/charts/rudderstack-helm/Chart.yaml b/charts/rudderstack-helm/Chart.yaml index 58b4b93..77fbafa 100644 --- a/charts/rudderstack-helm/Chart.yaml +++ b/charts/rudderstack-helm/Chart.yaml @@ -14,7 +14,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.3.0 +version: 0.4.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. diff --git a/charts/rudderstack-helm/README.md b/charts/rudderstack-helm/README.md index a6976b2..5a1bde0 100644 --- a/charts/rudderstack-helm/README.md +++ b/charts/rudderstack-helm/README.md @@ -74,6 +74,7 @@ The following table lists the configurable parameters of the Rudderstack chart a | Parameter | Description | Default | | ----------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------ | | `rudderWorkspaceToken` | Workspace token from the dashboard | `-` | +| `rudderWorkspaceTokenExistingSecret` | Secret with workspace token (overrides `rudderWorkspaceToken`) | `-` | | `backend.image.repository` | Container image repository for the backend | `rudderlabs/rudder-server` | | `backend.image.version` | Container image tag for the backend. [Available versions](https://hub.docker.com/r/rudderlabs/rudder-server/tags) | `v0.1.6` | | `backend.image.pullPolicy` | Container image pull policy for the backend image | `Always` | diff --git a/charts/rudderstack-helm/rudder-config.yaml b/charts/rudderstack-helm/rudder-config.yaml index b9af72a..17b9aed 100644 --- a/charts/rudderstack-helm/rudder-config.yaml +++ b/charts/rudderstack-helm/rudder-config.yaml @@ -35,6 +35,8 @@ Gateway: maxTransformerProcess: 64 maxRetry: 5 maxRetryTime: 10s + sourceListForParsingParams: + - shopify EventSchemas: enableEventSchemasFeature: false syncInterval: 240s diff --git a/charts/rudderstack-helm/templates/_helpers.tpl b/charts/rudderstack-helm/templates/_helpers.tpl index 6e69832..35943b0 100644 --- a/charts/rudderstack-helm/templates/_helpers.tpl +++ b/charts/rudderstack-helm/templates/_helpers.tpl @@ -51,6 +51,13 @@ app.kubernetes.io/name: {{ include "rudderstack.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} +{{/* +Return secret name to be used based on provided values. +*/}} +{{- define "rudderstack.rudderWorkspaceTokenSecretName" -}} +{{- default (include "rudderstack.fullname" .) .Values.rudderWorkspaceTokenExistingSecret -}} +{{- end -}} + {{- define "transformer.name" -}} {{- printf "%s-%s" (include "rudderstack.name" .) "transformer" -}} {{- end -}} @@ -86,6 +93,27 @@ Return the appropriate apiVersion for statefulset. {{- end -}} {{- end -}} +{{- define "statsd.enabled" -}} +{{- if .Values.telegraf_sidecar -}} +{{- if .Values.telegraf_sidecar.enabled }} +{{ .Values.telegraf_sidecar.enabled }} +{{- end -}} +{{- else -}} +{{ fail "Telegraf sidecar block doesn't exist in values.yaml ." }} +{{- end -}} +{{- end -}} + +{{- define "statsd.url" -}} +{{- if .Values.telegraf_sidecar -}} +{{- if .Values.telegraf_sidecar.enabled -}} +{{- printf "localhost:8125" }} +{{- else -}} +{{ fail "Sidecar Telegraf is not enabled. We can't deduce statsd url." }} +{{- end -}} +{{- else -}} +{{ fail "Telegraf sidecar block doesn't exist in values.yaml . We can't deduce statsd url." }} +{{- end -}} +{{- end -}} {{/*telegraf helper functions */}} diff --git a/charts/rudderstack-helm/templates/secret-rudder-token.yaml b/charts/rudderstack-helm/templates/secret-rudder-token.yaml new file mode 100644 index 0000000..80c6909 --- /dev/null +++ b/charts/rudderstack-helm/templates/secret-rudder-token.yaml @@ -0,0 +1,13 @@ +{{- if not .Values.rudderWorkspaceTokenExistingSecret }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "rudderstack.rudderWorkspaceTokenSecretName" . }} + labels: + {{- include "rudderstack.labels" . | nindent 4 }} +type: Opaque +data: + rudderWorkspaceToken: {{ required "value for either .Values.rudderWorkspaceTokenExistingSecret or .Values.rudderWorkspaceToken is expected" .Values.rudderWorkspaceToken | b64enc | quote }} +{{- end }} + diff --git a/charts/rudderstack-helm/templates/statefulset.yaml b/charts/rudderstack-helm/templates/statefulset.yaml index 68466f7..1786c56 100644 --- a/charts/rudderstack-helm/templates/statefulset.yaml +++ b/charts/rudderstack-helm/templates/statefulset.yaml @@ -15,6 +15,9 @@ spec: labels: {{- include "rudderstack.selectorLabels" . | nindent 8 }} annotations: + {{- if not .Values.rudderWorkspaceTokenExistingSecret }} + checksum/rudder-workspace-token: {{ include (print $.Template.BasePath "/secret-rudder-token.yaml") . | sha256sum }} + {{- end }} checksum/rudder-config: {{ .Files.Get "rudder-config.yaml" | sha256sum }} checksum/rudder-bigquery-credentials: {{ .Files.Get "bigquery-credentials.json" | sha256sum }} spec: @@ -27,12 +30,14 @@ spec: defaultMode: 420 name: {{ include "backend.fullname" . }}-config name: backend-config-volume + {{- if .Values.telegraf_sidecar }} {{- if .Values.telegraf_sidecar.enabled}} - name: telegraf configMap: defaultMode: 420 name: {{ include "telegraf-sidecar.fullname" . }}-config {{- end }} + {{- end }} {{- if .Values.gcpCredentialSecret.enabled }} - name: google-application-credentials secret: @@ -71,7 +76,10 @@ spec: {{- .Values.backend.extraEnvVars | toYaml | nindent 10 }} {{- end }} - name: CONFIG_BACKEND_TOKEN - value: {{ .Values.rudderWorkspaceToken }} + valueFrom: + secretKeyRef: + name: {{ template "rudderstack.rudderWorkspaceTokenSecretName" . }} + key: rudderWorkspaceToken {{- if .Values.backend.controlPlaneJSON }} - name: RSERVER_BACKEND_CONFIG_CONFIG_FROM_FILE value: "{{ .Values.backend.controlPlaneJSON }}" @@ -103,7 +111,7 @@ spec: - name: KUBE_NAMESPACE value: {{ .Release.Namespace }} command: ["/docker-entrypoint.sh"] - args: ["/bin/sh","-c","/wait-for $JOBS_DB_HOST:$(JOBS_DB_PORT) -- /rudder-server"] + args: ["/bin/sh","-c","/wait-for $JOBS_DB_HOST:$(JOBS_DB_PORT) {{ if (include "statsd.enabled" .) -}} -- /wait-for -u {{ include "statsd.url" .}} {{- end }} -- /rudder-server"] {{- if .Values.telegraf_sidecar.enabled}} - name: {{ include "telegraf-sidecar.name" .}} image: "{{ .Values.telegraf_sidecar.image.repo }}:{{ .Values.telegraf_sidecar.image.tag }}" diff --git a/charts/rudderstack-helm/values.yaml b/charts/rudderstack-helm/values.yaml index da7fa59..3ec3f94 100644 --- a/charts/rudderstack-helm/values.yaml +++ b/charts/rudderstack-helm/values.yaml @@ -7,8 +7,9 @@ # Following values must be filled in for the deployment to succeed # Please uncomment below lines and fill values accordingly. -# Please enter api token obtained from rudder dashboard below +# Please enter api token obtained from rudder dashboard below or specify existing secret, that contains rudderWorkspaceToken key # rudderWorkspaceToken: +# rudderWorkspaceTokenExistingSecret: gcpCredentialSecret: enabled: false