Skip to content

Commit

Permalink
Refactor deployment templates to support additional env vars from Sec…
Browse files Browse the repository at this point in the history
…ret (#603)

* Refactor deployment templates to support additional environment variables from secrets

* Add documentation

---------

Co-authored-by: Rob Holland <[email protected]>
  • Loading branch information
debugger24 and robholland authored Nov 7, 2024
1 parent 74bf344 commit a33b8c1
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ helm install \

### Install with sidecar containers

You may need to provide your own sidecar containers.
You may need to provide your own sidecar containers.

For an example, review the values for Google's `cloud sql proxy` in the `values/values.cloudsqlproxy.yaml` and pass that file to `helm install`:

Expand Down Expand Up @@ -283,7 +283,7 @@ helm install \
```

Note that if archival is enabled, it is also enabled for all newly created namespaces.
Make sure to update the specific archival provider values file to set your configs.
Make sure to update the specific archival provider values file to set your configs.

### Install and configure Temporal

Expand Down Expand Up @@ -316,6 +316,29 @@ helm install \
--wait
```

### Enable SSO in Temporal UI

To enable SSO in the temporal UI set following env variables in the `web.additionalEnv`:

```yaml
- name: TEMPORAL_AUTH_ENABLED
value: "true"
- name: TEMPORAL_AUTH_PROVIDER_URL
value: "https://accounts.google.com"
- name: TEMPORAL_AUTH_CLIENT_ID
value: "xxxxx-xxxx.apps.googleusercontent.com"
- name: TEMPORAL_AUTH_CALLBACK_URL
value: "https://xxxx.com:8080/auth/sso/callback"
```
In the `web.additionalEnvSecretName` set the secret name, the secret should have following

```yaml
TEMPORAL_AUTH_CLIENT_SECRET: xxxxxxxxxxxxxxx
```

Reference: <https://docs.temporal.io/references/web-ui-server-env-vars>

## Play With It

### Exploring Your Cluster
Expand Down
5 changes: 5 additions & 0 deletions charts/temporal/templates/admintools-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ spec:
{{- if .Values.admintools.additionalEnv }}
{{- toYaml .Values.admintools.additionalEnv | nindent 12 }}
{{- end }}
{{- if .Values.admintools.additionalEnvSecretName }}
envFrom:
- secretRef:
name: {{ .Values.admintools.additionalEnvSecretName }}
{{- end }}
livenessProbe:
exec:
command:
Expand Down
5 changes: 5 additions & 0 deletions charts/temporal/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ spec:
{{- if or $.Values.server.additionalEnv $serviceValues.additionalEnv }}
{{- toYaml (default $.Values.server.additionalEnv $serviceValues.additionalEnv) | nindent 12 }}
{{- end }}
{{- if $.Values.server.additionalEnvSecretName }}
envFrom:
- secretRef:
name: {{ $.Values.server.additionalEnvSecretName }}
{{- end }}
ports:
{{- if ne $service "worker" }}
- name: rpc
Expand Down
5 changes: 5 additions & 0 deletions charts/temporal/templates/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ spec:
{{- if .Values.web.additionalEnv }}
{{- toYaml .Values.web.additionalEnv | nindent 12 }}
{{- end }}
{{- if .Values.web.additionalEnvSecretName }}
envFrom:
- secretRef:
name: {{ .Values.web.additionalEnvSecretName }}
{{- end }}
ports:
- name: http
containerPort: 8080
Expand Down
3 changes: 3 additions & 0 deletions charts/temporal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ server:
tolerations: []
affinity: {}
additionalEnv: []
additionalEnvSecretName: ""
containerSecurityContext: {}
topologySpreadConstraints: []
podDisruptionBudget: {}
Expand Down Expand Up @@ -332,6 +333,7 @@ admintools:
tolerations: []
affinity: {}
additionalEnv: []
additionalEnvSecretName: ""
resources: {}
containerSecurityContext: {}
securityContext: {}
Expand Down Expand Up @@ -388,6 +390,7 @@ web:
# Adjust Web UI config with environment variables:
# https://docs.temporal.io/references/web-ui-environment-variables
additionalEnv: []
additionalEnvSecretName: ""
containerSecurityContext: {}
securityContext: {}
topologySpreadConstraints: []
Expand Down

0 comments on commit a33b8c1

Please sign in to comment.