Skip to content

Commit

Permalink
Merge pull request #2603 from lsst-sqre/tickets/DM-40947
Browse files Browse the repository at this point in the history
DM-40947: Add secrets config for more applications
  • Loading branch information
rra authored Sep 29, 2023
2 parents f3321da + 135cbf3 commit 9811266
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 29 deletions.
1 change: 1 addition & 0 deletions applications/obsloctap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Publish observing schedule
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| config.persistentVolumeClaims | list | `[]` | PersistentVolumeClaims to create. |
| config.separateSecrets | bool | `false` | Whether to use the new secrets management scheme |
| config.volume_mounts | list | `[]` | Mount points for additional volumes |
| config.volumes | list | `[]` | Additional volumes to attach |
| environment | object | `{}` | Environment variables (e.g. butler configuration/auth parms) for panel |
Expand Down
20 changes: 20 additions & 0 deletions applications/obsloctap/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"aws-credentials.ini":
description: >-
Google Cloud Storage credentials to the Butler data store, formatted using
AWS syntax for use with boto.
copy:
application: nublado
key: "aws-credentials.ini"
"butler-gcs-idf-creds.json":
description: >-
Google Cloud Storage credentials to the Butler data store in the native
Google syntax, containing the private asymmetric key.
copy:
application: nublado
key: "butler-gcs-idf-creds.json"
"postgres-credentials.txt":
description: >-
PostgreSQL credentials in its pgpass format for the Butler database.
copy:
application: nublado
key: "postgres-credentials.txt"
2 changes: 1 addition & 1 deletion applications/obsloctap/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
# butler-secrets-raw is the secrets we get from vault
- name: "butler-secrets-raw"
secret:
secretName: "butler-secret"
secretName: {{ include "obsloctap.fullname" . }}
# butler-secrets are the copied and chmoded versions
- name: "butler-secrets"
emptyDir: {}
Expand Down
7 changes: 5 additions & 2 deletions applications/obsloctap/templates/vault-secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
apiVersion: ricoberger.de/v1alpha1
kind: VaultSecret
metadata:
name: butler-secret
name: {{ template "obsloctap.fullname" . }}
labels:
{{- include "obsloctap.labels" . | nindent 4 }}
spec:
{{- if .Values.config.separateSecrets }}
path: "{{ .Values.global.vaultSecretsPath }}/obsloctap"
{{- else }}
path: "{{ .Values.global.vaultSecretsPath }}/butler-secret"
{{- end }}
type: Opaque
3 changes: 2 additions & 1 deletion applications/obsloctap/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ ingress:
# -- Additional annotations to add to the ingress
annotations: {}


config:
# -- Additional volumes to attach
volumes: []
Expand All @@ -27,6 +26,8 @@ config:
# -- PersistentVolumeClaims to create.
persistentVolumeClaims: []

# -- Whether to use the new secrets management scheme
separateSecrets: false

# The following will be set by parameters injected by Argo CD and should not
# be set in the individual environment values files.
Expand Down
3 changes: 2 additions & 1 deletion applications/plot-navigator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ Panel-based plot viewer
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| config.persistentVolumeClaims | list | `[]` | PersistentVolumeClaims to create. |
| config.separateSecrets | bool | `false` | Whether to use the new secrets management scheme |
| config.volume_mounts | list | `[]` | Mount points for additional volumes |
| config.volumes | list | `[]` | Additional volumes to attach |
| environment | object | `{}` | Environment variables (e.g. butler configuration/auth parms) for panel |
| global.baseUrl | string | Set by Argo CD | Base URL for the environment |
| global.host | string | Set by Argo CD | Host name for ingress |
| global.vaultSecretsPath | string | Set by Argo CD | Base path for Vault secrets |
| image.repository | string | `"ghcr.io/lsst-dm/pipetask-plot-navigator"` | plot-navigator image to use |
| image.tag | string | `""` | |
| image.tag | string | The appVersion of the chart | Tag of plot-navigator image to use |
| ingress.annotations | object | `{}` | Additional annotations to add to the ingress |
20 changes: 20 additions & 0 deletions applications/plot-navigator/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"aws-credentials.ini":
description: >-
Google Cloud Storage credentials to the Butler data store, formatted using
AWS syntax for use with boto.
copy:
application: nublado
key: "aws-credentials.ini"
"butler-gcs-idf-creds.json":
description: >-
Google Cloud Storage credentials to the Butler data store in the native
Google syntax, containing the private asymmetric key.
copy:
application: nublado
key: "butler-gcs-idf-creds.json"
"postgres-credentials.txt":
description: >-
PostgreSQL credentials in its pgpass format for the Butler database.
copy:
application: nublado
key: "postgres-credentials.txt"
4 changes: 1 addition & 3 deletions applications/plot-navigator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ spec:
labels:
{{- include "plot-navigator.selectorLabels" . | nindent 8 }}
spec:
imagePullSecrets:
- name: "pull-secret"
volumes:
# butler-secrets-raw is the secrets we get from vault
- name: "butler-secrets-raw"
secret:
secretName: "butler-secret"
secretName: {{ include "plot-navigator.fullname" . }}
# butler-secrets are the copied and chmoded versions
- name: "butler-secrets"
emptyDir: {}
Expand Down
17 changes: 5 additions & 12 deletions applications/plot-navigator/templates/vault-secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
---
apiVersion: ricoberger.de/v1alpha1
kind: VaultSecret
metadata:
name: butler-secret
name: {{ template "plot-navigator.fullname" . }}
labels:
{{- include "plot-navigator.labels" . | nindent 4 }}
spec:
{{- if .Values.config.separateSecrets }}
path: "{{ .Values.global.vaultSecretsPath }}/plot-navigator"
{{- else }}
path: "{{ .Values.global.vaultSecretsPath }}/butler-secret"
{{- end }}
type: Opaque
---
apiVersion: ricoberger.de/v1alpha1
kind: VaultSecret
metadata:
name: pull-secret
labels:
{{- include "plot-navigator.labels" . | nindent 4 }}
spec:
path: "{{- .Values.global.vaultSecretsPath }}/pull-secret"
type: kubernetes.io/dockerconfigjson
6 changes: 5 additions & 1 deletion applications/plot-navigator/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
image:
# -- plot-navigator image to use
repository: ghcr.io/lsst-dm/pipetask-plot-navigator

# -- Tag of plot-navigator image to use
# @default -- The appVersion of the chart
tag: ""

# -- Environment variables (e.g. butler configuration/auth parms) for panel
Expand All @@ -10,7 +13,6 @@ ingress:
# -- Additional annotations to add to the ingress
annotations: {}


config:
# -- Additional volumes to attach
volumes: []
Expand All @@ -21,6 +23,8 @@ config:
# -- PersistentVolumeClaims to create.
persistentVolumeClaims: []

# -- Whether to use the new secrets management scheme
separateSecrets: false

# The following will be set by parameters injected by Argo CD and should not
# be set in the individual environment values files.
Expand Down
3 changes: 2 additions & 1 deletion applications/production-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ A collection of utility pages for monitoring data processing.
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity rules for the production-tools deployment pod |
| config.separateSecrets | bool | `false` | Whether to use the new secrets management scheme |
| environment | object | `{}` | |
| fullnameOverride | string | `""` | Override the full name for resources (includes the release name) |
| global.baseUrl | string | Set by Argo CD | Base URL for the environment |
| global.host | string | Set by Argo CD | Host name for ingress |
| global.vaultSecretsPath | string | Set by Argo CD | Base path for Vault secrets |
| image.pullPolicy | string | `"IfNotPresent"` | Pull policy for the production-tools image |
| image.repository | string | `"lsstdm/production_tools"` | Image to use in the production-tools deployment |
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
| image.tag | string | The appVersion of the chart | Tag of production-tools image to use |
| ingress.annotations | object | `{}` | Additional annotations for the ingress rule |
| nameOverride | string | `""` | Override the base name for resources |
| nodeSelector | object | `{}` | Node selection rules for the production-tools deployment pod |
Expand Down
20 changes: 20 additions & 0 deletions applications/production-tools/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"aws-credentials.ini":
description: >-
Google Cloud Storage credentials to the Butler data store, formatted using
AWS syntax for use with boto.
copy:
application: nublado
key: "aws-credentials.ini"
"butler-gcs-idf-creds.json":
description: >-
Google Cloud Storage credentials to the Butler data store in the native
Google syntax, containing the private asymmetric key.
copy:
application: nublado
key: "butler-gcs-idf-creds.json"
"postgres-credentials.txt":
description: >-
PostgreSQL credentials in its pgpass format for the Butler database.
copy:
application: nublado
key: "postgres-credentials.txt"
2 changes: 1 addition & 1 deletion applications/production-tools/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
# butler-secrets-raw is the secrets we get from vault
- name: "butler-secrets-raw"
secret:
secretName: "butler-secret"
secretName: {{ include "production-tools.fullname" . }}
# butler-secrets are the copied and chmoded versions
- name: "butler-secrets"
emptyDir: {}
Expand Down
7 changes: 5 additions & 2 deletions applications/production-tools/templates/vault-secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
apiVersion: ricoberger.de/v1alpha1
kind: VaultSecret
metadata:
name: butler-secret
name: {{ template "production-tools.fullname" . }}
labels:
{{- include "production-tools.labels" . | nindent 4 }}
spec:
{{- if .Values.config.separateSecrets }}
path: "{{ .Values.global.vaultSecretsPath }}/production-tools"
{{- else }}
path: "{{ .Values.global.vaultSecretsPath }}/butler-secret"
{{- end }}
type: Opaque
---
apiVersion: ricoberger.de/v1alpha1
Expand Down
7 changes: 6 additions & 1 deletion applications/production-tools/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ image:
# -- Pull policy for the production-tools image
pullPolicy: IfNotPresent

# -- Overrides the image tag whose default is the chart appVersion.
# -- Tag of production-tools image to use
# @default -- The appVersion of the chart
tag: ""

# -- Override the base name for resources
Expand All @@ -31,6 +32,10 @@ ingress:
# -- Additional annotations for the ingress rule
annotations: {}

config:
# -- Whether to use the new secrets management scheme
separateSecrets: false

# -- Resource limits and requests for the production-tools deployment pod
resources: {}

Expand Down
10 changes: 10 additions & 0 deletions docs/admin/migrating-secrets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ Switch to the new secrets tree
If you are using a static secrets file, add the ``--secrets`` flag pointing to that file.
This will fix any secrets that are missing or incorrect in Vault.

#. Some Phalanx applications need to know whether the old or new secrets layout is in use.
On your working branch, add the necessary settings for those applications to their :file:`values-{environment}.yaml` files for your environment.
Applications to review:

- :px-app:`datalinker` (``config.separateSecrets``)
- :px-app:`nublado` (``secrets.templateSecrets``)
- :px-app:`obsloctap` (``config.separateSecrets``)
- :px-app:`plot-navigator` (``config.separateSecrets``)
- :px-app:`production-tools` (``config.separateSecrets``)

#. You're now ready to test the new secrets tree.
You can do this on a branch that contains the changes you made above.

Expand Down
3 changes: 0 additions & 3 deletions tests/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"giftless",
"linters",
"monitoring",
"obsloctap",
"next-visit-fan-out",
"plot-navigator",
"production-tools",
)
"""Temporary whitelist of applications that haven't added secrets.yaml."""

Expand Down

0 comments on commit 9811266

Please sign in to comment.