Skip to content

Commit

Permalink
Adding the ability to set custom environment variables on the injecto…
Browse files Browse the repository at this point in the history
…r, connect, and operator containers
  • Loading branch information
jillianwilson committed Jan 24, 2024
1 parent 8b065f4 commit 88621ce
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 87 deletions.
162 changes: 88 additions & 74 deletions charts/connect/README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions charts/connect/templates/connect-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ spec:
- name: OP_LOG_LEVEL
value: "{{ .Values.connect.api.logLevel }}"
{{- include "onepassword-connect.profilerConfig" . | indent 12 -}}
{{- range .Values.connect.customEnvVars}}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
{{- if .Values.connect.probes.readiness }}
readinessProbe:
httpGet:
Expand Down
4 changes: 4 additions & 0 deletions charts/connect/templates/operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ spec:
key: {{ .Values.operator.token.key }}
- name: AUTO_RESTART
value: "{{ .Values.operator.autoRestart }}"
{{- range .Values.operator.customEnvVars}}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
resources:
{{- toYaml .Values.operator.resources | nindent 12 }}
{{- end }}
18 changes: 16 additions & 2 deletions charts/connect/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ connect:
# In order to expose the service, use the route section below
ingress:
enabled: false
labels: {}
labels:
{}
# traffic: external
annotations: {}
annotations:
{}
# |
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
Expand Down Expand Up @@ -189,6 +191,12 @@ connect:
# Number of profiler snapshots to keep.
keepLast: 12

# 1Password Connect Custom Container Environment Variables
# Must be written in the following format:
# - name: VARIABLE_NAME
# value: VARIABLE_VALUE
customEnvVars: {}

# This section of values is for 1Password Operator Configuration
operator:
# Denotes whether the 1Password Operator will be deployed
Expand Down Expand Up @@ -286,6 +294,12 @@ operator:
# 1Password Operator Log Level Configuration
logLevel: info

# 1Password Operator Custom Container Environment Variables
# Must be written in the following format:
# - name: VARIABLE_NAME
# value: VARIABLE_VALUE
customEnvVars: {}

# 1Password Acceptance Tests Functionality
acceptanceTests:
enabled: false
Expand Down
41 changes: 30 additions & 11 deletions charts/secrets-injector/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,54 @@
# 1Password Kubernetes Secrets Injector Helm chart

## Installation

Installing the Helm Chart with default configurations will deploy 1Password Kubernetes Secrets Injector in your default Namespace.

```
helm install --generate-name 1password/secrets-injector
```

## Configuration Values

The 1Password Kubernetes Secrets Injector Helm chart offers many configuration options for deployment. Please refer to the list below for information on what configuration options are available as well as what the default configuration options are.

[From the Official Helm Install Guide](https://helm.sh/docs/helm/helm_install/#helm-install):

>To override values in a chart, use either the '--values' flag and pass in a file or use the '--set' flag and pass configuration from the command line, to force a string value use '--set-string'. In case a value is large and therefore you want not to use neither '--values' nor '--set', use '--set-file' to read the single large value from file.
> To override values in a chart, use either the '--values' flag and pass in a file or use the '--set' flag and pass configuration from the command line, to force a string value use '--set-string'. In case a value is large and therefore you want not to use neither '--values' nor '--set', use '--set-file' to read the single large value from file.
For example:

For example:
```bash
$ helm install -f myvalues.yaml injector ./secrets-injector
```

or
or

```bash
$ helm install --set injector.applicationName=injector injector ./secrets-injector
```

### Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| injector.applicationName | string | `"secrets-injector"` | The name of 1Password Kubernetes Secrets Injector Application |
| injector.imagePullPolicy | string | `"IfNotPresent"` | The 1Password Secrets Injector docker image policy. `"IfNotPresent"` means the image is pulled only if it is not already present locally. |
| injector.imageRepository | string | `"1password/kubernetes-secrets-injector"` | The 1Password Secrets Injector docker image repository |
| injector.port | string | `443` | The port the Secrets Injector exposes |
| injector.targetPort | integer | `8443` | The port the Secrets Injector API sends requests to the pod |
| injector.version | string | `{{.Chart.AppVersion}}` | The 1Password Secrets Injector version to pull. |

| Key | Type | Default | Description |
| ------------------------ | ------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| injector.applicationName | string | `"secrets-injector"` | The name of 1Password Kubernetes Secrets Injector Application |
| injector.imagePullPolicy | string | `"IfNotPresent"` | The 1Password Secrets Injector docker image policy. `"IfNotPresent"` means the image is pulled only if it is not already present locally. |
| injector.imageRepository | string | `"1password/kubernetes-secrets-injector"` | The 1Password Secrets Injector docker image repository |
| injector.port | string | `443` | The port the Secrets Injector exposes |
| injector.targetPort | integer | `8443` | The port the Secrets Injector API sends requests to the pod |
| injector.version | string | `{{.Chart.AppVersion}}` | The 1Password Secrets Injector version to pull. |
| injector.customEnvVars | map | `{}` | Custom Environment Variables for the 1Password Secrets Injector container that are not specified in this helm chart. |

#### Custom Environment Variables

The injector container supports additional environment variables beyond those explicitly defined in the Helm chart. These can be defined using a key map for each custom variable. An example is shown below:

```yaml
injector:
customEnvVars:
- name: "CUSTOM_ENV_VAR1"
value: "customvar2"
- name: "CUSTOM_ENV_VAR2"
value: "customvar2"
```
4 changes: 4 additions & 0 deletions charts/secrets-injector/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- range .Values.operator.customEnvVars}}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
lifecycle:
preStop:
exec:
Expand Down
5 changes: 5 additions & 0 deletions charts/secrets-injector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ injector:
port: 443
targetPort: 8443
version: "{{ .Chart.AppVersion }}"
# 1Password Operator Custom Container Environment Variables
# Must be written in the following format:
# - name: VARIABLE_NAME
# value: VARIABLE_VALUE
customEnvVars: {}

0 comments on commit 88621ce

Please sign in to comment.