Skip to content

Commit

Permalink
allow external secrets to potentially clobber other secrets if opted …
Browse files Browse the repository at this point in the history
…in (#208)

Co-authored-by: retool-bot <[email protected]>
  • Loading branch information
JatinNanda and retool-bot authored Jan 27, 2025
1 parent 095fcb7 commit 2791c21
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/retool/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: retool
description: A Helm chart for Kubernetes
type: application
version: 6.3.2
version: 6.3.3
maintainers:
- name: Retool Engineering
email: [email protected]
Expand Down
7 changes: 7 additions & 0 deletions charts/retool/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,10 @@ Usage: (template "retool.codeExecutor.image.tag" .)
{{- end -}}
{{- $output -}}
{{- end -}}

{{/*
Checks whether or not ExternalSecret definitions are enabled and can potentially clobber secrets or explicitly allow additional direct secret refs.
*/}}
{{- define "shouldIncludeConfigSecretsEnvVars" -}}
{{- or (not (or (.Values.externalSecrets.enabled) (.Values.externalSecrets.externalSecretsOperator.enabled))) .Values.includeConfigSecrets -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ spec:

{{- include "retool.telemetry.includeEnvVars" . | nindent 10 }}

{{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }}
{{- if (include "shouldIncludeConfigSecretsEnvVars" .) }}
- name: LICENSE_KEY
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ spec:

{{- include "retool.telemetry.includeEnvVars" . | nindent 10 }}

{{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }}
{{- if (include "shouldIncludeConfigSecretsEnvVars" .) }}
- name: LICENSE_KEY
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_telemetry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
value: "/host/proc"
- name: SYSFS_ROOT
value: "/host/sys"
{{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }}
{{- if (include "shouldIncludeConfigSecretsEnvVars" .) }}
- name: LICENSE_KEY
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ spec:
- name: CODE_EXECUTOR_INGRESS_DOMAIN
value: http://{{ template "retool.codeExecutor.name" . }}
{{- end }}
{{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }}
{{- if (include "shouldIncludeConfigSecretsEnvVars" .) }}
- name: LICENSE_KEY
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/deployment_workflows_worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ spec:
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: "http://$(HOST_IP):4317"
{{- end }}
{{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }}
{{- if (include "shouldIncludeConfigSecretsEnvVars" .) }}
- name: LICENSE_KEY
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/retool/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (not .Values.externalSecrets.enabled) (not .Values.externalSecrets.externalSecretsOperator.enabled) }}
{{- if (include "shouldIncludeConfigSecretsEnvVars" .) }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
3 changes: 3 additions & 0 deletions charts/retool/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ externalSecrets:
# Support for legacy external secrets, note this is deprecated in favour of External Secrets Operator: https://github.com/godaddy/kubernetes-external-secrets
# This mode only allows a single secret name to be provided.
enabled: false
# If external secrets are currently enabled, it is disallowed to specify regular configuration secrets as a safeguard from clobbering.
# This flag allows bypassing that check and specifying both an ExternalSecret and a regular secret for different secrets.
includeConfigSecrets: false
name: retool-config
# Array of secrets to be use as env variables. (Optional)
secrets:
Expand Down
3 changes: 3 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ externalSecrets:
# Support for legacy external secrets, note this is deprecated in favour of External Secrets Operator: https://github.com/godaddy/kubernetes-external-secrets
# This mode only allows a single secret name to be provided.
enabled: false
# If external secrets are currently enabled, it is disallowed to specify regular configuration secrets as a safeguard from clobbering.
# This flag allows bypassing that check and specifying both an ExternalSecret and a regular secret for different secrets.
includeConfigSecrets: false
name: retool-config
# Array of secrets to be use as env variables. (Optional)
secrets:
Expand Down

0 comments on commit 2791c21

Please sign in to comment.