Skip to content

Commit

Permalink
Make secrets more consistent (#106)
Browse files Browse the repository at this point in the history
* allow using existing secrets for enterprise feeds db password

Signed-off-by: Brady Todhunter <[email protected]>
  • Loading branch information
Btodhunter authored Jan 12, 2021
1 parent 1d59120 commit deeb382
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion stable/anchore-engine/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: anchore-engine
version: 1.11.1
version: 1.11.2
appVersion: 0.9.0
description: Anchore container analysis and policy evaluation engine service
keywords:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ data:
credentials:
database:
{{- if .Values.anchoreEnterpriseFeeds.dbConfig.ssl }}
db_connect: "postgresql://${ANCHORE_DB_USER}:${ANCHORE_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME}?sslmode={{- .Values.anchoreEnterpriseFeeds.dbConfig.sslMode -}}&sslrootcert=/home/anchore/certs/{{- .Values.anchoreEnterpriseFeeds.dbConfig.sslRootCertName }}"
db_connect: "postgresql://${ANCHORE_DB_USER}:${ANCHORE_FEEDS_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME}?sslmode={{- .Values.anchoreEnterpriseFeeds.dbConfig.sslMode -}}&sslrootcert=/home/anchore/certs/{{- .Values.anchoreEnterpriseFeeds.dbConfig.sslRootCertName }}"
{{- else }}
db_connect: "postgresql://${ANCHORE_DB_USER}:${ANCHORE_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME}"
db_connect: "postgresql://${ANCHORE_DB_USER}:${ANCHORE_FEEDS_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME}"
{{- end }}
db_connect_args:
timeout: {{ .Values.anchoreEnterpriseFeeds.dbConfig.timeout }}
Expand Down Expand Up @@ -103,7 +103,7 @@ data:
# rubygem data comes packaged as a PostgreSQL dump file. gem driver loads the pg dump and normalizes the data.
# To enable gem driver comment the enabled property and uncomment the db_connect property.
enabled: {{ default "false" .Values.anchoreEnterpriseFeeds.gemDriverEnabled }}
db_connect: {{ default "'postgresql://${ANCHORE_DB_USER}:${ANCHORE_DB_PASSWORD}@${ANCHORE_DB_HOST}/gems'" .Values.anchoreEnterpriseFeeds.gemDbEndpoint }}
db_connect: {{ default "'postgresql://${ANCHORE_DB_USER}:${ANCHORE_FEEDS_DB_PASSWORD}@${ANCHORE_DB_HOST}/gems'" .Values.anchoreEnterpriseFeeds.gemDbEndpoint }}
amzn:
enabled: {{ default "true" .Values.anchoreEnterpriseFeeds.amazonDriverEnabled }}
centos:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ spec:
{{- with .Values.anchoreEnterpriseFeeds.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if not .Values.inject_secrets_via_env }}
- name: ANCHORE_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "anchore-engine.fullname" . }}
key: .feedsDbPassword
{{- end }}
- name: ANCHORE_POD_NAME
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ spec:
imagePullPolicy: {{ .Values.anchoreEnterpriseGlobal.imagePullPolicy }}
image: {{ .Values.anchoreEnterpriseGlobal.image }}
{{- if .Values.anchoreGlobal.dbConfig.ssl }}
args: ["/bin/bash", "-c", "anchore-enterprise-manager db --db-use-ssl --db-connect postgresql://${ANCHORE_DB_USER}:${ANCHORE_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME}?sslmode={{ .Values.anchoreGlobal.dbConfig.sslMode }}\\&sslrootcert=/home/anchore/certs/{{ .Values.anchoreGlobal.dbConfig.sslRootCertName }} upgrade --dontask"]
args: ["/bin/bash", "-c", "anchore-enterprise-manager db --db-use-ssl --db-connect postgresql://${ANCHORE_DB_USER}:${ANCHORE_FEEDS_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME}?sslmode={{ .Values.anchoreGlobal.dbConfig.sslMode }}\\&sslrootcert=/home/anchore/certs/{{ .Values.anchoreGlobal.dbConfig.sslRootCertName }} upgrade --dontask"]
{{- else }}
args: ["/bin/bash", "-c", "anchore-enterprise-manager db --db-connect postgresql://${ANCHORE_DB_USER}:${ANCHORE_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME} upgrade --dontask"]
args: ["/bin/bash", "-c", "anchore-enterprise-manager db --db-connect postgresql://${ANCHORE_DB_USER}:${ANCHORE_FEEDS_DB_PASSWORD}@${ANCHORE_DB_HOST}/${ANCHORE_DB_NAME} upgrade --dontask"]
{{- end }}
envFrom:
{{- if not .Values.inject_secrets_via_env }}
Expand All @@ -57,11 +57,6 @@ spec:
{{- with .Values.anchoreEnterpriseFeeds.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: ANCHORE_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "anchore-engine.fullname" . }}
key: .feedsDbPassword
{{- if (.Values.anchoreGlobal.certStoreSecretName) }}
volumeMounts:
- name: certs
Expand Down
2 changes: 1 addition & 1 deletion stable/anchore-engine/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ stringData:
ANCHORE_ADMIN_PASSWORD: {{ include "anchore-engine.defaultAdminPassword" . | quote }}
ANCHORE_DB_PASSWORD: {{ index .Values "postgresql" "postgresPassword" | quote }}
{{- if and .Values.anchoreEnterpriseGlobal.enabled .Values.anchoreEnterpriseFeeds.enabled }}
.feedsDbPassword: {{ index .Values "anchore-feeds-db" "postgresPassword" | quote }}
ANCHORE_FEEDS_DB_PASSWORD: {{ index .Values "anchore-feeds-db" "postgresPassword" | quote }}
{{- end }}
{{- with .Values.anchoreGlobal.saml.secret }}
ANCHORE_SAML_SECRET: {{ . }}
Expand Down

0 comments on commit deeb382

Please sign in to comment.