Skip to content

Commit 2126be1

Browse files
committed
feat: add option to use standard helm naming conventions
1 parent ca1a043 commit 2126be1

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed

charts/pdp/templates/_helpers.tpl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "..name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "..fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
126
{{/*
227
Selector labels
328
*/}}
@@ -22,8 +47,12 @@ Get the secret name for the API key
2247
{{- if .Values.pdp.existingApiKeySecret -}}
2348
{{- .Values.pdp.existingApiKeySecret.name -}}
2449
{{- else -}}
50+
{{- if .Values.useStandardHelmNamingConventions }}
51+
{{- include "..fullname" . }}
52+
{{- else -}}
2553
permitio-pdp-secret
2654
{{- end -}}
55+
{{- end -}}
2756
{{- end }}
2857

2958
{{/*

charts/pdp/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4+
{{- if .Values.useStandardHelmNamingConventions }}
5+
name: {{ include "..fullname" . }}
6+
{{- else }}
47
name: permitio-pdp
8+
{{- end }}
59
labels:
610
{{- include "pdp.labels" . | nindent 4 }}
711
{{- with .Values.annotations }}

charts/pdp/templates/logs-forwarder-cm.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
apiVersion: v1
33
kind: ConfigMap
44
metadata:
5+
{{- if .Values.useStandardHelmNamingConventions }}
6+
name: {{ include "..fullname" . }}-fluentbit-config
7+
{{- else }}
58
name: fluentbit-config
9+
{{- end }}
610
{{- with .Values.labels }}
711
labels:
812
{{- toYaml . | nindent 4 }}

charts/pdp/templates/poddisruptionbudget.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
apiVersion: policy/v1
33
kind: PodDisruptionBudget
44
metadata:
5+
{{- if .Values.useStandardHelmNamingConventions }}
6+
name: {{ include "..fullname" . }}
7+
{{- else }}
58
name: permitio-pdp-pdb
9+
{{- end }}
610
labels:
711
{{- include "pdp.labels" . | nindent 4 }}
812
{{- with .Values.annotations }}

charts/pdp/templates/service.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4+
{{- if .Values.useStandardHelmNamingConventions }}
5+
name: {{ include "..fullname" . }}
6+
{{- else }}
47
name: permitio-pdp
8+
{{- end }}
59
{{- with .Values.labels }}
610
labels:
711
{{- toYaml . | nindent 4 }}

charts/pdp/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
# Feature flag added to preserve backward compatibility with the old naming conventions
2+
# When useStandardHelmNamingConventions is false (default):
3+
# - Service name: permitio-pdp
4+
# - Secret name: permitio-pdp-secret
5+
# - Deployment name: permitio-pdp
6+
# - PodDisruptionBudget name: permitio-pdp-pdb
7+
#
8+
# When useStandardHelmNamingConventions is true:
9+
# - Service name: {release-name}-{chart-name} (e.g., my-release-pdp)
10+
# - Secret name: {release-name}-{chart-name} (e.g., my-release-pdp)
11+
# - Deployment name: {release-name}-{chart-name} (e.g., my-release-pdp)
12+
# - PodDisruptionBudget name: {release-name}-{chart-name} (e.g., my-release-pdp)
13+
#
14+
# The standard Helm naming convention follows the pattern {release-name}-{chart-name}
15+
# and automatically truncates names to 63 characters to comply with Kubernetes DNS naming spec.
16+
useStandardHelmNamingConventions: false
17+
118
labels: {}
219
annotations: {}
320

21+
nameOverride: ""
22+
423
pdp:
524
pdpEnvs:
625
[]

0 commit comments

Comments
 (0)