Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added sticky passwords that do not get replaced on re-deployment #51

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions charts/common/v1.1.0/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,49 @@ Return password or secret value from values.yml or generate if it doesn't exists
{{- end -}}
{{- end -}}

{{/*
Return password or secret value from values.yml or an existing secret, or generate if it doesn't exist

Usage:
{{- include "common.stickySecretValue" (dict "Config" .Values.postgresqlPassword "Context" . ) -}}

Parameters
- Config The password config
- Context The context

*/}}
{{- define "common.stickySecretValue" -}}
{{- if .Config.value -}}
{{- .Config.value -}}
{{- else if .Config.valueFrom -}}
{{- include "common.getValueFromSecret" (dict "Namespace" .Context.Release.Namespace "Name" (default (include "common.fullname" .Context ) .Config.valueFrom.secretKeyRef.name ) "Key" .Config.valueFrom.secretKeyRef.key ) -}}
{{- end -}}
{{- end -}}


{{/*
Returns the available value for certain key in an existing secret (if it exists),
otherwise it generates a random value.

Usage:
{{- include "getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "common.fullname" .) "Length" 10 "Key" "postgis-password") -}}

Parameters:
- Namespace The release namespace to search. (default: .Release.Namespace)
- Name The name of the secret
- Length The length of the generated secret (default 10)
- Key The key within the secret to retrieve the value
*/}}
{{- define "common.getValueFromSecret" }}
{{- $len := (default 10 .Length) | int -}}
{{- $obj := (lookup "v1" "Secret" .Namespace .Name).data -}}
{{- if $obj }}
{{- index $obj .Key | b64dec -}}
{{- else -}}
{{- randAlphaNum $len -}}
{{- end -}}
{{- end }}

{{- /*
common.util.merge will merge two YAML templates and output the result.
This takes an array of three values:
Expand Down
Binary file added charts/postgis/v0.3.0/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions charts/postgis/v0.3.0/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_up

export HELM_DOCS_ARGS="-t ${PROJECT_ROOT}/charts/common/v1.0.1/_templates.gotmpl -t $(pwd)/README.md.gotmpl"
25 changes: 25 additions & 0 deletions charts/postgis/v0.3.0/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: postgis
version: 0.3.0
appVersion: 13-3.1
description: Chart for postgis
keywords:
- postgis
- postgresql
- database
- postgres
- sql
- replication
- cluster
home: https://postgis.net/
sources:
- https://github.com/kartoza/docker-postgis
maintainers:
- name: lucernae
email: [email protected]
engine: gotpl
icon: https://raw.githubusercontent.com/kartoza/charts/master/assets/logo/postgis.png
dependencies:
- name: common
version: 1.1.0
repository: "file://../../common/v1.1.0"
Loading