-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy path_helpers.tpl
More file actions
102 lines (94 loc) · 3.41 KB
/
_helpers.tpl
File metadata and controls
102 lines (94 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{{/*
Expand the name of the chart.
*/}}
{{- define "wso2-amp-gateway-extension.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "wso2-amp-gateway-extension.labels" -}}
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{ include "wso2-amp-gateway-extension.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "wso2-amp-gateway-extension.selectorLabels" -}}
app.kubernetes.io/name: {{ include "wso2-amp-gateway-extension.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Name of the K8s Secret holding the gateway registration token (created by bootstrap job).
Defaults to "<release-name>-token" when not explicitly set.
*/}}
{{- define "wso2-amp-gateway-extension.tokenSecretName" -}}
{{- if .Values.gateway.tokenSecret.name }}
{{- .Values.gateway.tokenSecret.name }}
{{- else }}
{{- printf "%s-token" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{/*
Name of the ConfigMap holding gateway Helm values (referenced by APIGateway CR configRef).
Defaults to "<release-name>-config" when not explicitly set.
*/}}
{{- define "wso2-amp-gateway-extension.configMapName" -}}
{{- if .Values.apiGateway.config.configMapName }}
{{- .Values.apiGateway.config.configMapName }}
{{- else }}
{{- printf "%s-config" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{/*
Name of the APIGateway CR.
Defaults to "api-platform-<orgName>-<environment>" when gateway.name is not explicitly set.
*/}}
{{- define "wso2-amp-gateway-extension.apiGatewayName" -}}
{{- if .Values.gateway.name }}
{{- .Values.gateway.name }}
{{- else }}
{{- printf "api-platform-%s-%s" .Values.agentManager.orgName .Values.gateway.environment | lower | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{/*
Bootstrap resource name prefix. All bootstrap resources (ServiceAccount, Role,
RoleBinding, Job) are derived from this to avoid collisions across releases.
*/}}
{{- define "wso2-amp-gateway-extension.bootstrapName" -}}
{{- printf "%s-bootstrap" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Resolve the IDP client ID from secret or direct value
*/}}
{{- define "wso2-amp-gateway-extension.idpClientIdEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ required "agentManager.idp.existingSecretClientIdKey is required when using existingSecret" .Values.agentManager.idp.existingSecretClientIdKey }}
{{- else }}
- name: IDP_CLIENT_ID
value: {{ .Values.agentManager.idp.clientId | quote }}
{{- end }}
{{- end }}
{{/*
Resolve the IDP client secret from secret or direct value
*/}}
{{- define "wso2-amp-gateway-extension.idpClientSecretEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ required "agentManager.idp.existingSecretClientSecretKey is required when using existingSecret" .Values.agentManager.idp.existingSecretClientSecretKey }}
{{- else }}
- name: IDP_CLIENT_SECRET
value: {{ .Values.agentManager.idp.clientSecret | quote }}
{{- end }}
{{- end }}