Skip to content
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
29 changes: 29 additions & 0 deletions charts/pdp/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "pdp.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "pdp.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to values.yaml that selector labels won't change with the feature flag.
Consider also adding "app.kubernetes.io/name" and "app.kubernetes.io/instance" labels as standard Helm practice.

{{/*
Selector labels
*/}}
Expand All @@ -22,8 +47,12 @@ Get the secret name for the API key
{{- if .Values.pdp.existingApiKeySecret -}}
{{- .Values.pdp.existingApiKeySecret.name -}}
{{- else -}}
{{- if .Values.useStandardHelmNamingConventions }}
{{- include "pdp.fullname" . }}
{{- else -}}
permitio-pdp-secret
{{- end -}}
{{- end -}}
{{- end }}

{{/*
Expand Down
6 changes: 5 additions & 1 deletion charts/pdp/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
apiVersion: apps/v1
kind: Deployment
metadata:
{{- if .Values.useStandardHelmNamingConventions }}
name: {{ include "pdp.fullname" . }}
{{- else }}
name: permitio-pdp
{{- end }}
labels:
{{- include "pdp.labels" . | nindent 4 }}
{{- with .Values.annotations }}
Expand Down Expand Up @@ -145,7 +149,7 @@ spec:
{{- if .Values.pdp.logs_forwarder.enabled }}
- name: fluent-bit-config
configMap:
name: fluentbit-config
name: {{ include "pdp.fullname" . }}-fluentbit-config

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the condition here also for "useStandardHelmNamingConventions"

Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ConfigMap name reference is unconditionally changed to use the standard naming convention, but this will break existing deployments when useStandardHelmNamingConventions is false (the default). This should be wrapped in the same conditional logic used in other templates to maintain backward compatibility.

Copilot uses AI. Check for mistakes.
- name: logs
emptyDir: {}
{{- else if .Values.openshift.enabled }}
Expand Down
4 changes: 4 additions & 0 deletions charts/pdp/templates/logs-forwarder-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
{{- if .Values.useStandardHelmNamingConventions }}
name: {{ include "pdp.fullname" . }}-fluentbit-config
{{- else }}
name: fluentbit-config
{{- end }}
{{- with .Values.labels }}
labels:
{{- toYaml . | nindent 4 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/pdp/templates/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
{{- if .Values.useStandardHelmNamingConventions }}
name: {{ include "pdp.fullname" . }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: {{ include "pdp.fullname" . }}
name: {{ include "pdp.fullname" . }}-pdb

{{- else }}
name: permitio-pdp-pdb
{{- end }}
labels:
{{- include "pdp.labels" . | nindent 4 }}
{{- with .Values.annotations }}
Expand Down
4 changes: 4 additions & 0 deletions charts/pdp/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.useStandardHelmNamingConventions }}
name: {{ include "pdp.fullname" . }}
{{- else }}
name: permitio-pdp
{{- end }}
{{- with .Values.labels }}
labels:
{{- toYaml . | nindent 4 }}
Expand Down
24 changes: 22 additions & 2 deletions charts/pdp/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# Feature flag added to preserve backward compatibility with the old naming conventions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent docs please add te fluentbit-config ConfigMap naming (fluentbit-config vs {fullname}-fluentbit-config)

# When useStandardHelmNamingConventions is false (default):
# - Service name: permitio-pdp
# - Secret name: permitio-pdp-secret
# - Deployment name: permitio-pdp
# - PodDisruptionBudget name: permitio-pdp-pdb
#
# When useStandardHelmNamingConventions is true:
# - Service name: {release-name}-{chart-name} (e.g., my-release-pdp)
# - Secret name: {release-name}-{chart-name} (e.g., my-release-pdp)
# - Deployment name: {release-name}-{chart-name} (e.g., my-release-pdp)
# - PodDisruptionBudget name: {release-name}-{chart-name} (e.g., my-release-pdp)
#
# The standard Helm naming convention follows the pattern {release-name}-{chart-name}
# and automatically truncates names to 63 characters to comply with Kubernetes DNS naming spec.
useStandardHelmNamingConventions: false

labels: {}
annotations: {}

nameOverride: ""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are standard Helm overrides but they're only used when
useStandardHelmNamingConventions=true.
Explain it in a comment please.

fullnameOverride: ""

pdp:
pdpEnvs:
[]
Expand Down Expand Up @@ -58,11 +78,11 @@ resources:

# OpenShift configuration
openshift:
enabled: false # Set to true for OpenShift deployments
enabled: false # Set to true for OpenShift deployments
serviceAccount:
create: true
name: "permitio-pdp-sa"
sccName: "restricted-v2" # OpenShift Security Context Constraint
sccName: "restricted-v2" # OpenShift Security Context Constraint
# Security context (SCC will override user/group settings automatically)
securityContext:
runAsNonRoot: true
Expand Down
Loading