Skip to content

Commit

Permalink
Fix overriding guardrails envFrom secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
AnchorArray committed Oct 31, 2024
1 parent 338cec0 commit d883f44
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
7 changes: 7 additions & 0 deletions charts/guardrails/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning]
(https://semver.org/spec/v2.0.0.html).

## [0.3.1] - 2024-10-31

### Fixed

- Converted `envFrom` to be a list rather than a map. These values typically
need to be overridden rather than extended.

## [0.3.0] - 2024-10-15

### Updated
Expand Down
2 changes: 1 addition & 1 deletion charts/guardrails/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: guardrails
description: A Helm chart for WhyLabs Guardrails
type: application
version: 0.3.0
version: 0.3.1
appVersion: "2.0.1"
12 changes: 5 additions & 7 deletions charts/guardrails/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# guardrails

![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.1](https://img.shields.io/badge/AppVersion-2.0.1-informational?style=flat-square)
![Version: 0.3.1](https://img.shields.io/badge/Version-0.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.1](https://img.shields.io/badge/AppVersion-2.0.1-informational?style=flat-square)

A Helm chart for WhyLabs Guardrails

Expand Down Expand Up @@ -110,14 +110,14 @@ release_name=""
# the working directory or --destination path
helm pull \
oci://ghcr.io/whylabs/guardrails \
--version 0.3.0
--version 0.3.1
# Requires the helm-diff plugin to be installed:
# helm plugin install https://github.com/databus23/helm-diff
helm diff upgrade \
--allow-unreleased \
--namespace "${target_namespace}" \
"${release_name}" guardrails-0.3.0.tgz
"${release_name}" guardrails-0.3.1.tgz
```
After you've installed the repo you can install the chart.
Expand All @@ -126,7 +126,7 @@ After you've installed the repo you can install the chart.
helm upgrade --install \
--create-namespace \
--namespace "${target_namespace}" \
"${release_name}" guardrails-0.3.0.tgz
"${release_name}" guardrails-0.3.1.tgz
```

## Exposing Guardrails Outside Kubernetes
Expand Down Expand Up @@ -198,9 +198,7 @@ utilization.
| autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":70}` | [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) configuration for the `guardrails` container. |
| 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. |
| envFrom | object | `{"whylabs-guardrails-api-key":{"optional":true,"type":"secretRef"},"whylabs-guardrails-api-secret":{"optional":true,"type":"secretRef"}}` | Create environment variables from Kubernetes secrets or config maps. |
| envFrom.whylabs-guardrails-api-key | map | `{"optional":true,"type":"secretRef"}` | Comment out or remove this section if using file-based secrets |
| envFrom.whylabs-guardrails-api-secret | map | `{"optional":true,"type":"secretRef"}` | Comment out or remove this section if using file-based secrets |
| 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. |
| extraVolumeMounts | list | `[]` | Extra [volume mounts](https://kubernetes.io/docs/concepts/storage/volumes/) for the `guardrails` container. |
| extraVolumes | list | `[]` | Extra [volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the `Pod`. |
| fullnameOverride | string | `""` | Override the full name of the chart. |
Expand Down
6 changes: 1 addition & 5 deletions charts/guardrails/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ spec:
{{- end }}
{{- if .Values.envFrom }}
envFrom:
{{- range $key, $value := .Values.envFrom }}
- {{ $value.type }}:
name: {{ $key }}
optional: {{ $value.optional | default false }}
{{- end }}
{{- toYaml .Values.envFrom | nindent 12 }}
{{- end }}
ports:
- name: http
Expand Down
14 changes: 6 additions & 8 deletions charts/guardrails/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ env: {}

# -- Create environment variables from Kubernetes secrets or config maps.
envFrom:
# -- (map) Comment out or remove this section if using file-based secrets
whylabs-guardrails-api-key:
type: secretRef
optional: true
# -- (map) Comment out or remove this section if using file-based secrets
whylabs-guardrails-api-secret:
type: secretRef
optional: true
- secretRef:
name: whylabs-guardrails-api-key
optional: true
- secretRef:
name: whylabs-guardrails-api-secret
optional: true

serviceAccount:
# -- If `true`, create a new `ServiceAccount`.
Expand Down

0 comments on commit d883f44

Please sign in to comment.