diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8d0969..eb2a7de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,13 @@ jobs: version: v4.2.0 - name: Lint chart - run: helm lint helm --strict + run: helm lint helm --strict --values helm/values-sit.yaml - name: Render chart run: | helm template config-server helm \ + --namespace digital-bank-sit \ + --values helm/values-sit.yaml \ --set image.tag="${GITHUB_SHA}" \ > rendered.yaml test -s rendered.yaml diff --git a/AGENTS.md b/AGENTS.md index debe212..0e5bf9b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,7 +27,7 @@ It serves externalized runtime configuration from `config-repo` to the platform ./mvnw test ./mvnw verify ./mvnw spring-boot:run -helm lint helm --strict +helm lint helm --strict --values helm/values-sit.yaml ``` ## Runtime Notes diff --git a/README.md b/README.md index 1282f32..83b27a5 100644 --- a/README.md +++ b/README.md @@ -188,13 +188,15 @@ kubectl get nodes Validate the chart without changing the cluster: ```bash -helm lint helm +helm lint helm --strict --values helm/values-sit.yaml -helm template config-server helm | +helm template config-server helm \ + --namespace digital-bank-sit \ + --values helm/values-sit.yaml | kubectl apply --dry-run=client -f - ``` -Create the namespace and an opaque Secret containing a repository-scoped, read-only GitHub credential. Never commit the token or place it in Helm values: +Create the namespace and an opaque Secret containing a repository-scoped, read-only GitHub credential. Never commit the token or place it in Helm values. The Helm values file points to this existing Secret by name only: ```bash kubectl create namespace digital-bank-sit --dry-run=client -o yaml | @@ -218,6 +220,7 @@ Install or upgrade the release in the SIT namespace: helm upgrade --install config-server helm \ --namespace digital-bank-sit \ --create-namespace \ + --values helm/values-sit.yaml \ --wait \ --timeout 5m ``` @@ -291,7 +294,7 @@ Before opening a pull request: ```bash git status ./mvnw verify -helm lint helm --strict +helm lint helm --strict --values helm/values-sit.yaml git diff --check ``` diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 405d8e3..a0761ea 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -32,18 +32,18 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: CONFIG_REPO_URI - value: {{ .Values.configRepository.uri | quote }} + value: {{ required "configRepository.uri is required" .Values.configRepository.uri | quote }} - name: CONFIG_REPO_DEFAULT_LABEL - value: {{ .Values.configRepository.defaultLabel | quote }} + value: {{ required "configRepository.defaultLabel is required" .Values.configRepository.defaultLabel | quote }} - name: CONFIG_REPO_USERNAME valueFrom: secretKeyRef: - name: {{ .Values.configRepository.credentialsSecret.name }} + name: {{ required "configRepository.credentialsSecret.name is required" .Values.configRepository.credentialsSecret.name }} key: {{ .Values.configRepository.credentialsSecret.usernameKey }} - name: CONFIG_REPO_TOKEN valueFrom: secretKeyRef: - name: {{ .Values.configRepository.credentialsSecret.name }} + name: {{ required "configRepository.credentialsSecret.name is required" .Values.configRepository.credentialsSecret.name }} key: {{ .Values.configRepository.credentialsSecret.tokenKey }} securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} diff --git a/helm/values-sit.yaml b/helm/values-sit.yaml new file mode 100644 index 0000000..1294469 --- /dev/null +++ b/helm/values-sit.yaml @@ -0,0 +1,5 @@ +configRepository: + uri: https://github.com/digital-bank-java/config-repo.git + defaultLabel: main + credentialsSecret: + name: config-server-git-credentials diff --git a/helm/values.yaml b/helm/values.yaml index fb01974..1795c75 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -9,10 +9,10 @@ image: pullPolicy: IfNotPresent configRepository: - uri: https://github.com/digital-bank-java/config-repo.git - defaultLabel: main + uri: "" + defaultLabel: "" credentialsSecret: - name: config-server-git-credentials + name: "" usernameKey: username tokenKey: token