Skip to content

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiewang committed May 13, 2022
1 parent cb981ef commit 0be0310
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
backups/
2 changes: 1 addition & 1 deletion charts/rudderstack-helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions charts/rudderstack-helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
2 changes: 2 additions & 0 deletions charts/rudderstack-helm/rudder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Gateway:
maxTransformerProcess: 64
maxRetry: 5
maxRetryTime: 10s
sourceListForParsingParams:
- shopify
EventSchemas:
enableEventSchemasFeature: false
syncInterval: 240s
Expand Down
28 changes: 28 additions & 0 deletions charts/rudderstack-helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down Expand Up @@ -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 */}}
Expand Down
13 changes: 13 additions & 0 deletions charts/rudderstack-helm/templates/secret-rudder-token.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

12 changes: 10 additions & 2 deletions charts/rudderstack-helm/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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 }}"
Expand Down
3 changes: 2 additions & 1 deletion charts/rudderstack-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0be0310

Please sign in to comment.