Skip to content

Commit 07c6560

Browse files
authored
[common] rename templates from common.* to cloudpirates.* to prevent collisions (CloudPirates-io#377)
1 parent 395898c commit 07c6560

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

charts/common/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: common
33
description: A library chart for common templates and helper functions
44
type: library
5-
version: 1.1.2
6-
appVersion: "1.0.0"
5+
version: 2.0.0
6+
appVersion: "2.0.0"
77

88
home: https://www.cloudpirates.io
99

charts/common/templates/_helpers.tpl

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{/*
22
Expand the name of the chart.
33
*/}}
4-
{{- define "common.name" -}}
4+
{{- define "cloudpirates.name" -}}
55
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

@@ -10,7 +10,7 @@ Create a default fully qualified app name.
1010
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
1111
If release name contains chart name it will be used as a full name.
1212
*/}}
13-
{{- define "common.fullname" -}}
13+
{{- define "cloudpirates.fullname" -}}
1414
{{- if .Values.fullnameOverride }}
1515
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
1616
{{- else }}
@@ -28,23 +28,23 @@ Return the namespace to use for resources.
2828
Defaults to .Release.Namespace but can be overridden via .Values.namespaceOverride.
2929
Useful for multi-namespace deployments in combined charts.
3030
*/}}
31-
{{- define "common.namespace" -}}
31+
{{- define "cloudpirates.namespace" -}}
3232
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" }}
3333
{{- end }}
3434

3535
{{/*
3636
Create chart name and version as used by the chart label.
3737
*/}}
38-
{{- define "common.chart" -}}
38+
{{- define "cloudpirates.chart" -}}
3939
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
4040
{{- end }}
4141

4242
{{/*
4343
Common labels
4444
*/}}
45-
{{- define "common.labels" -}}
46-
helm.sh/chart: {{ include "common.chart" . }}
47-
{{ include "common.selectorLabels" . }}
45+
{{- define "cloudpirates.labels" -}}
46+
helm.sh/chart: {{ include "cloudpirates.chart" . }}
47+
{{ include "cloudpirates.selectorLabels" . }}
4848
{{- if .Chart.AppVersion }}
4949
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
5050
{{- end }}
@@ -57,15 +57,15 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
5757
{{/*
5858
Selector labels
5959
*/}}
60-
{{- define "common.selectorLabels" -}}
61-
app.kubernetes.io/name: {{ include "common.name" . }}
60+
{{- define "cloudpirates.selectorLabels" -}}
61+
app.kubernetes.io/name: {{ include "cloudpirates.name" . }}
6262
app.kubernetes.io/instance: {{ .Release.Name }}
6363
{{- end }}
6464

6565
{{/*
6666
Common annotations
6767
*/}}
68-
{{- define "common.annotations" -}}
68+
{{- define "cloudpirates.annotations" -}}
6969
{{- with .Values.commonAnnotations }}
7070
{{ toYaml . }}
7171
{{- end }}
@@ -74,7 +74,7 @@ Common annotations
7474
{{/*
7575
Return the proper image name with registry and tag (tag includes digest if present)
7676
*/}}
77-
{{- define "common.image" -}}
77+
{{- define "cloudpirates.image" -}}
7878
{{- $registryName := .image.registry -}}
7979
{{- $repositoryName := .image.repository -}}
8080
{{- $tag := .image.tag | toString -}}
@@ -93,14 +93,14 @@ Return the proper image name with registry and tag (tag includes digest if prese
9393
{{/*
9494
Return the proper image pull policy
9595
*/}}
96-
{{- define "common.imagePullPolicy" -}}
96+
{{- define "cloudpirates.imagePullPolicy" -}}
9797
{{- .image.imagePullPolicy | default .image.pullPolicy | default "Always" -}}
9898
{{- end }}
9999

100100
{{/*
101101
Return the proper Docker Image Registry Secret Names
102102
*/}}
103-
{{- define "common.imagePullSecrets" -}}
103+
{{- define "cloudpirates.imagePullSecrets" -}}
104104
{{- $pullSecrets := list }}
105105

106106
{{- if .global }}
@@ -136,7 +136,7 @@ imagePullSecrets:
136136
{{/*
137137
Validate required fields
138138
*/}}
139-
{{- define "common.validateRequired" -}}
139+
{{- define "cloudpirates.validateRequired" -}}
140140
{{- $context := index . 0 -}}
141141
{{- $field := index . 1 -}}
142142
{{- $message := index . 2 -}}
@@ -148,7 +148,7 @@ Validate required fields
148148
{{/*
149149
Return a soft nodeAffinity definition
150150
*/}}
151-
{{- define "common.affinities.nodes.soft" -}}
151+
{{- define "cloudpirates.affinities.nodes.soft" -}}
152152
{{- $key := index . 0 -}}
153153
{{- $values := index . 1 -}}
154154
preferredDuringSchedulingIgnoredDuringExecution:
@@ -166,7 +166,7 @@ preferredDuringSchedulingIgnoredDuringExecution:
166166
{{/*
167167
Return a hard nodeAffinity definition
168168
*/}}
169-
{{- define "common.affinities.nodes.hard" -}}
169+
{{- define "cloudpirates.affinities.nodes.hard" -}}
170170
{{- $key := index . 0 -}}
171171
{{- $values := index . 1 -}}
172172
requiredDuringSchedulingIgnoredDuringExecution:
@@ -183,13 +183,13 @@ requiredDuringSchedulingIgnoredDuringExecution:
183183
{{/*
184184
Return a soft podAffinity/podAntiAffinity definition
185185
*/}}
186-
{{- define "common.affinities.pods.soft" -}}
186+
{{- define "cloudpirates.affinities.pods.soft" -}}
187187
{{- $component := index . 0 -}}
188188
{{- $context := index . 1 -}}
189189
preferredDuringSchedulingIgnoredDuringExecution:
190190
- podAffinityTerm:
191191
labelSelector:
192-
matchLabels: {{- (include "common.selectorLabels" $context) | nindent 10 }}
192+
matchLabels: {{- (include "cloudpirates.selectorLabels" $context) | nindent 10 }}
193193
{{- if $component }}
194194
app.kubernetes.io/component: {{ $component }}
195195
{{- end }}
@@ -200,12 +200,12 @@ preferredDuringSchedulingIgnoredDuringExecution:
200200
{{/*
201201
Return a hard podAffinity/podAntiAffinity definition
202202
*/}}
203-
{{- define "common.affinities.pods.hard" -}}
203+
{{- define "cloudpirates.affinities.pods.hard" -}}
204204
{{- $component := index . 0 -}}
205205
{{- $context := index . 1 -}}
206206
requiredDuringSchedulingIgnoredDuringExecution:
207207
- labelSelector:
208-
matchLabels: {{- (include "common.selectorLabels" $context) | nindent 8 }}
208+
matchLabels: {{- (include "cloudpirates.selectorLabels" $context) | nindent 8 }}
209209
{{- if $component }}
210210
app.kubernetes.io/component: {{ $component }}
211211
{{- end }}
@@ -215,7 +215,7 @@ requiredDuringSchedulingIgnoredDuringExecution:
215215
{{/*
216216
Render a value that contains template perhaps
217217
*/}}
218-
{{- define "common.tplvalues.render" -}}
218+
{{- define "cloudpirates.tplvalues.render" -}}
219219
{{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }}
220220
{{- if contains "{{" (toString $value) }}
221221
{{- tpl $value .context }}
@@ -226,26 +226,26 @@ Render a value that contains template perhaps
226226

227227
{{/*
228228
Return the proper Docker Image Registry Secret Names evaluating values as templates
229-
{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
229+
{{ include "cloudpirates.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
230230
*/}}
231-
{{- define "common.images.renderPullSecrets" -}}
231+
{{- define "cloudpirates.images.renderPullSecrets" -}}
232232
{{- $pullSecrets := list }}
233233
{{- $context := .context }}
234234

235235
{{- range (($context.Values.global).imagePullSecrets) -}}
236236
{{- if kindIs "map" . -}}
237-
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" $context)) -}}
237+
{{- $pullSecrets = append $pullSecrets (include "cloudpirates.tplvalues.render" (dict "value" .name "context" $context)) -}}
238238
{{- else -}}
239-
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
239+
{{- $pullSecrets = append $pullSecrets (include "cloudpirates.tplvalues.render" (dict "value" . "context" $context)) -}}
240240
{{- end -}}
241241
{{- end -}}
242242

243243
{{- range .images -}}
244244
{{- range .pullSecrets -}}
245245
{{- if kindIs "map" . -}}
246-
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" $context)) -}}
246+
{{- $pullSecrets = append $pullSecrets (include "cloudpirates.tplvalues.render" (dict "value" .name "context" $context)) -}}
247247
{{- else -}}
248-
{{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
248+
{{- $pullSecrets = append $pullSecrets (include "cloudpirates.tplvalues.render" (dict "value" . "context" $context)) -}}
249249
{{- end -}}
250250
{{- end -}}
251251
{{- end -}}
@@ -260,9 +260,9 @@ imagePullSecrets:
260260

261261
{{/*
262262
Detect if the target platform is OpenShift (via .Values.targetPlatform or API group).
263-
Usage: {{ include "common.isOpenshift" . }}
263+
Usage: {{ include "cloudpirates.isOpenshift" . }}
264264
*/}}
265-
{{- define "common.isOpenshift" -}}
265+
{{- define "cloudpirates.isOpenshift" -}}
266266
{{- if or (eq (lower (default "" .Values.targetPlatform)) "openshift") (.Capabilities.APIVersions.Has "route.openshift.io/v1") -}}
267267
true
268268
{{- else -}}
@@ -272,10 +272,10 @@ false
272272

273273
{{/*
274274
Render podSecurityContext, omitting runAsUser, runAsGroup, fsGroup, and seLinuxOptions if OpenShift is detected.
275-
Usage: {{ include "common.renderPodSecurityContext" . }}
275+
Usage: {{ include "cloudpirates.renderPodSecurityContext" . }}
276276
*/}}
277-
{{- define "common.renderPodSecurityContext" -}}
278-
{{- $isOpenshift := include "common.isOpenshift" . | trim }}
277+
{{- define "cloudpirates.renderPodSecurityContext" -}}
278+
{{- $isOpenshift := include "cloudpirates.isOpenshift" . | trim }}
279279
{{- if eq $isOpenshift "true" }}
280280
{{- omit .Values.podSecurityContext "runAsUser" "runAsGroup" "fsGroup" "seLinuxOptions" | toYaml }}
281281
{{- else }}
@@ -285,10 +285,10 @@ Usage: {{ include "common.renderPodSecurityContext" . }}
285285

286286
{{/*
287287
Render containerSecurityContext, omitting runAsUser, runAsGroup, and seLinuxOptions if OpenShift is detected.
288-
Usage: {{ include "common.renderContainerSecurityContext" . }}
288+
Usage: {{ include "cloudpirates.renderContainerSecurityContext" . }}
289289
*/}}
290-
{{- define "common.renderContainerSecurityContext" -}}
291-
{{- $isOpenshift := include "common.isOpenshift" . | trim }}
290+
{{- define "cloudpirates.renderContainerSecurityContext" -}}
291+
{{- $isOpenshift := include "cloudpirates.isOpenshift" . | trim }}
292292
{{- if eq $isOpenshift "true" }}
293293
{{- omit .Values.containerSecurityContext "runAsUser" "runAsGroup" "seLinuxOptions" | toYaml }}
294294
{{- else }}

0 commit comments

Comments
 (0)