Skip to content

Commit

Permalink
fix env quoteing and conditionally set cache endpoint env
Browse files Browse the repository at this point in the history
  • Loading branch information
AnchorArray committed Dec 9, 2024
1 parent 2ef6400 commit 7c812d7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions charts/guardrails/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning]
previous chart versions. The cache layer deployment selector labels have been
updated to be independently unique.

### Changed

- Conditionally set `WHYLABS_API_CACHE_ENDPOINT` environment variable based on
the `cache.enable` value.

## [0.5.0] - 2024-12-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion charts/guardrails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ autoscaling:
| cache.labels | object | `{}` | Labels for the cache. |
| cache.replicaCount | int | `1` | Number of replicas for the cache. |
| commonLabels | object | `{}` | Labels to add to all chart resources. |
| env | object | `{}` | [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the `guardrails` container. **Supports Helm templating syntax**, e.g. you can use `{{ .Release.Name }}` or other templating variables, functions, and conditions within the the value of each environment variable. |
| env | object | `{"CONFIG_SYNC_INTERVAL":"1","TENANCY_MODE":"{{ .Values.tenancyMode | default \"SINGLE\" }}","WHYLABS_API_CACHE_ENDPOINT":"{{ if .Values.cache.enable }}{{ .Release.Name }}.{{ .Release.Namespace }}.svc.cluster.local{{ else }}{{ end }}"}` | [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the `guardrails` container. **Supports Helm templating syntax**, e.g. you can use `{{ .Release.Name }}` or other templating variables, functions, and conditions within the the value of each environment variable. |
| envFrom | list | `[{"secretRef":{"name":"whylabs-guardrails-api-key","optional":true}},{"secretRef":{"name":"whylabs-guardrails-api-secret","optional":true}}]` | Create environment variables from Kubernetes secrets or config maps. |
| envFrom[0].secretRef.name | string | `"whylabs-guardrails-api-key"` | Name of the Kubernetes secret containing the API key. The secret must be in the same namespace as the release and should be created prior to installing the chart. |
| envFrom[1].secretRef.name | string | `"whylabs-guardrails-api-secret"` | Name of the Kubernetes secret containing the container password, the value used when executing requests against the guardrails container. The secret must be in the same namespace as the release and should be created prior to installing the chart. |
Expand Down
2 changes: 1 addition & 1 deletion charts/guardrails/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ tpl $value $ }}
value: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
{{- if .Values.envFrom }}
Expand Down
5 changes: 2 additions & 3 deletions charts/guardrails/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ commonLabels: {}
# for the `guardrails` container. **Supports Helm templating syntax**, e.g. you can use `{{ .Release.Name }}` or other
# templating variables, functions, and conditions within the the value of each environment variable.
env:
# Uncomment WHYLABS_API_CACHE_ENDPOINT if .Values.cache.enable is true
# WHYLABS_API_CACHE_ENDPOINT: "{{ .Release.Name }}.{{ .Release.Namespace }}.svc.cluster.local"
# @ignored
WHYLABS_API_CACHE_ENDPOINT: "{{ if .Values.cache.enable }}{{ .Release.Name }}.{{ .Release.Namespace }}.svc.cluster.local{{ else }}{{ end }}"
TENANCY_MODE: "{{ .Values.tenancyMode | default \"SINGLE\" }}"
CONFIG_SYNC_INTERVAL: "1"

# -- Create environment variables from Kubernetes secrets or config maps.
envFrom:
Expand Down

0 comments on commit 7c812d7

Please sign in to comment.