Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save onelittlenightmusic/217bc2f481d5f92efac68e3a9dd0741d to your computer and use it in GitHub Desktop.
Save onelittlenightmusic/217bc2f481d5f92efac68e3a9dd0741d to your computer and use it in GitHub Desktop.
global: │~
configname: post │~
│~
sub1: │~
exports: │~
data: │~
dbname: testsample │~
env: │~
data1: new
dependencies:
- name: sub1
repository: http://localhost:10191
version: 0.1.0
condition: subchart1.enabled, global.subchart1.enabled
tags:
- front-end
- subchart1
import-values:
- data
alias: sub11
- name: sub1
repository: http://localhost:10191
version: 0.1.0
condition: subchart1.enabled, global.subchart1.enabled
tags:
- front-end
- subchart1
#import-values:
# - data
alias: sub12
{{- define "test.connectconfig" -}}
{{- $methodname := .Values.methodname -}}
{{/*- include "sub1.simpleconfigname" . -*/}}
{{- include $methodname . -}}
{{- end -}}
{{- define "sub1.configname" -}}
{{- printf "%s-%s" $.Release.Name .Values.global.configname -}}
{{- end -}}
{{- define "sub1.simpleconfigname" -}}
{{/*- $configname := default .Values.exportconfigname .Values.simpleconfigname -*/}}
{{- $exportconfigname := default .Chart.Name .Values.exportconfigname -}}
{{- $configname := default $exportconfigname .Values.simpleconfigname -}}
{{- printf "%s-%s-configmap" $.Release.Name $configname -}}
{{- end -}}
exports:
data:
dbname: sample
test: test
env:
data1: old1
data2: old2
global:
configname: postold
#exportconfigname: defconf
{{- define "test.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "test.connectconfig" -}}
{{- include "configtoenvformat" . | indent 8 -}}
{{- end -}}
{{- define "configtoenvformat" -}}
{{- $test := include "importedconfigname" . }}
{{- range $key, $val := .Values.system.envmap }}
- name: {{ $key }}
valueFrom:
configMapKeyRef:
name: {{ $test }}
key: {{ $val | quote }}
{{- end }}
{{- end -}}
{{- define "importedconfigname" -}}
{{- $exportconfigname := default .Chart.Name .Values.exportconfigname -}}
{{- $configname := default $exportconfigname .Values.importedconfigname -}}
{{- printf "%s-%s-configmap" $.Release.Name $configname -}}
{{- end -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment