Skip to content

Commit

Permalink
build: Fail helm upgrade if secrets are not set in values.yaml
Browse files Browse the repository at this point in the history
To avoid unintential default secrets in production, passwords default to null now.
`helm upgrade` will fail if the secrets are not set.
  • Loading branch information
MoritzWeber0 committed Sep 21, 2024
1 parent 6828e3a commit 87a6cb9
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ jobs:
--set mocks.oauth=True \
--set development=True \
--set general.port=8080 \
--set database.backend.internal.password="secret" \
--set database.guacamole.internal.password="secret" \
--set valkey.password="secret" \
--set backend.authentication.oauth.endpoints.wellKnown="http://test-oauth-mock:8080/default/.well-known/openid-configuration" \
./helm
- name: Wait for all containers to be ready
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ helm-deploy:
--set cluster.ingressClassName=traefik \
--set cluster.ingressNamespace=kube-system \
--set backend.k8sSessionNamespace="$(SESSION_NAMESPACE)" \
--set loki.gateway.basicAuth.password="localLokiPassword" \
--set grafana.adminPassword="admin" \
--set database.backend.internal.password="secret" \
--set database.guacamole.internal.password="secret" \
--set valkey.password="secret" \
$(RELEASE) $$HELM_PACKAGE_DIR/collab-manager-*.tgz
rm -rf "$$HELM_PACKAGE_DIR"
$(MAKE) provision-guacamole wait
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ https://github.com/DSD-DBS/capella-collab-manager/assets/23395732/01c5dc34-7792-

### Running Locally with k3d

The following instructions are not suitable for a production deployment, but
can be used to try out the features of the Collaboration Manager locally. You
can find the installation guide for a production deployment in the
[general documentation](https://dsd-dbs.github.io/capella-collab-manager/admin/installation/).

#### Prerequisites

To deploy the application you need:
Expand Down Expand Up @@ -182,11 +187,6 @@ Once the cluster is installed and all services are running
[Getting started guide](https://dsd-dbs.github.io/capella-collab-manager/admin/getting_started/getting_started/)
and be up and running in a few minutes.

### Deployment

You can find the installation guide for a production deployment in the
[general documentation](https://dsd-dbs.github.io/capella-collab-manager/admin/installation/).

## How it Works

The Capella Collaboration Manager consists of a couple of components:
Expand Down
4 changes: 2 additions & 2 deletions helm/config/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ k8s:
promtail:
lokiEnabled: {{ .Values.loki.enabled }}
lokiURL: http://loki-gateway.{{- .Release.Namespace -}}.svc.cluster.local/loki/api/v1
lokiUsername: {{ .Values.definitions.loki.username }}
lokiPassword: {{ .Values.definitions.loki.password }}
lokiUsername: {{ .Values.loki.gateway.basicAuth.username }}
lokiPassword: {{ .Values.loki.gateway.basicAuth.password }}
serverPort: 3101

general:
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/backend/postgres.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
- name: POSTGRES_DB
value: backend
- name: POSTGRES_PASSWORD
value: {{ .Values.database.backend.internal.password }}
value: {{ .Values.database.backend.internal.password | required ".Values.database.backend.internal.password is required. Please generate a random password and set it in the values.yaml." }}
- name: POSTGRES_USER
value: backend
ports:
Expand Down
7 changes: 3 additions & 4 deletions helm/templates/grafana/grafana.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ data:
grafana.ini: |
[security]
admin_user = {{ .Values.grafana.adminUser }}
admin_password = {{ .Values.grafana.adminPassword }}
admin_password = {{ .Values.grafana.adminPassword | required ".Values.grafana.adminPassword is required. Please generate a random password and set it in the values.yaml." }}
[paths]
data = /var/lib/grafana/
logs = /var/log/grafana
Expand Down Expand Up @@ -64,9 +63,9 @@ data:
orgId: 1
url: http://loki-gateway.{{ .Release.Namespace }}.svc.cluster.local
basicAuth: true
basicAuthUser: {{ .Values.definitions.loki.username }}
basicAuthUser: {{ .Values.loki.gateway.basicAuth.username }}
secureJsonData:
basicAuthPassword: {{ .Values.definitions.loki.password }}
basicAuthPassword: {{ .Values.loki.gateway.basicAuth.password | required ".Values.loki.gateway.basicAuth.password is required. Please generate a random password and set it in the values.yaml." }}
version: 1
editable: false
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/guacamole/postgres.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
- name: POSTGRES_DB
value: guacamole
- name: POSTGRES_PASSWORD
value: {{ .Values.database.guacamole.internal.password }}
value: {{ .Values.database.guacamole.internal.password | required ".Values.database.guacamole.internal.password is required. Please generate a random password and set it in the values.yaml." }}
- name: POSTGRES_USER
value: guacamole
- name: POSTGRES_HOST_AUTH_METHOD
Expand Down
4 changes: 2 additions & 2 deletions helm/templates/promtail/_promtail.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
clients:
- url: http://loki-gateway.{{- .Release.Namespace -}}.svc.cluster.local/loki/api/v1/push
basic_auth:
username: {{ .Values.definitions.loki.username }}
password: {{ .Values.definitions.loki.password }}
username: {{ .Values.loki.gateway.basicAuth.username }}
password: {{ .Values.loki.gateway.basicAuth.password }}
server:
http_listen_port: 3101
{{- end }}
2 changes: 1 addition & 1 deletion helm/templates/valkey/valkey.secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ metadata:
type: Opaque
stringData:
valkey.conf: |
requirepass {{ .Values.valkey.password }}
requirepass {{ .Values.valkey.password | required ".Values.valkey.password is required. Please generate a random password and set it in the values.yaml." }}
18 changes: 6 additions & 12 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ database:
###### IF database.guacamole.deploy == True ######

# Admin password of the database
password: secret
password: null

external:
###### IF database.guacamole.deploy == False ######
Expand Down Expand Up @@ -135,7 +135,7 @@ database:
###### IF database.backend.deploy == True ######

# Admin password of the database
password: secret
password: null

external:
###### IF database.backend.deploy == False ######
Expand All @@ -144,7 +144,7 @@ database:
uri: postgresql://user:password@url:port/db_name

valkey:
password: secret
password: null

backend:
authentication:
Expand Down Expand Up @@ -258,16 +258,10 @@ promtail:
storageAccessMode: ReadWriteOnce
storageClassName: local-path

definitions:
loki:
# Default username & password for Loki
username: &lokiUsername localLokiUser
password: &lokiPassword localLokiPassword

# Default passwords for Grafana
grafana:
adminUser: admin
adminPassword: admin
adminPassword: null

# https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml
loki:
Expand All @@ -284,8 +278,8 @@ loki:
gateway:
basicAuth:
enabled: True
username: *lokiUsername
password: *lokiPassword
username: localLokiUser
password: null
resources: &resourcesLoki
limits:
cpu: '1'
Expand Down

0 comments on commit 87a6cb9

Please sign in to comment.