Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(helm): address review findings on infisical-nkp chart
ArshBallagandf2c37059bca
diff --git a/helm-charts/infisical-nkp/templates/_helpers.tpl b/helm-charts/infisical-nkp/templates/_helpers.tplindex 7f7ee18049..e9c7e204b3 100644--- a/helm-charts/infisical-nkp/templates/_helpers.tpl+++ b/helm-charts/infisical-nkp/templates/_helpers.tpl@@ -8,7 +8,12 @@{{- if .Values.fullnameOverride -}}{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}{{- else -}}-{{- printf "%s" (include "infisical.name" .) | trunc 63 | trimSuffix "-" -}}+{{- $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 -}}@@ -23,6 +28,7 @@ helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" }}{{/* Selector labels */}}{{- define "infisical.selectorLabels" -}}app.kubernetes.io/name: {{ include "infisical.name" . }}+app.kubernetes.io/instance: {{ .Release.Name }}app.kubernetes.io/component: backend{{- end -}}@@ -61,12 +67,18 @@ use the external URI stored in the chart's own secret.{{- end }}{{- end -}}-{{/* REDIS_URL: in-cluster Redis service when enabled, else the external URL. */}}-{{- define "infisical.redisUrl" -}}-{{- if .Values.redis.enabled -}}-redis://{{ include "infisical.fullname" . }}-redis:{{ .Values.redis.port }}+{{/*+Password for the bundled Redis: reuse the one already stored in the Secret+(so upgrades don't rotate it), else generate a new one. Call this exactly once+per render and reuse the result (each call generates a fresh random value on+first install).+*/}}+{{- define "infisical.redisPassword" -}}+{{- $existing := lookup "v1" "Secret" .Release.Namespace (printf "%s-secrets" (include "infisical.fullname" .)) -}}+{{- if and $existing $existing.data.REDIS_PASSWORD -}}+{{- $existing.data.REDIS_PASSWORD | b64dec -}}{{- else -}}-{{ .Values.secrets.redisUrl }}+{{- randAlphaNum 32 -}}{{- end -}}{{- end -}}diff --git a/helm-charts/infisical-nkp/templates/deployment.yaml b/helm-charts/infisical-nkp/templates/deployment.yamlindex e63ba0bbe0..1d7175ba80 100644--- a/helm-charts/infisical-nkp/templates/deployment.yaml+++ b/helm-charts/infisical-nkp/templates/deployment.yaml@@ -11,6 +11,10 @@ spec:{{- include "infisical.selectorLabels" . | nindent 6 }}template:metadata:+ annotations:+ # Roll pods when generated configuration changes.+ checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}+ checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}labels:{{- include "infisical.selectorLabels" . | nindent 8 }}spec:@@ -56,7 +60,7 @@ spec:imagePullPolicy: {{ .Values.image.pullPolicy }}ports:- name: http- containerPort: 8080+ containerPort: {{ .Values.config.port }}protocol: TCPenvFrom:- configMapRef:diff --git a/helm-charts/infisical-nkp/templates/redis.yaml b/helm-charts/infisical-nkp/templates/redis.yamlindex 1993c50f9c..0f88b69e52 100644--- a/helm-charts/infisical-nkp/templates/redis.yaml+++ b/helm-charts/infisical-nkp/templates/redis.yaml@@ -11,17 +11,32 @@ spec:selector:matchLabels:app.kubernetes.io/name: {{ include "infisical.name" . }}+ app.kubernetes.io/instance: {{ .Release.Name }}app.kubernetes.io/component: redistemplate:metadata:labels:app.kubernetes.io/name: {{ include "infisical.name" . }}+ app.kubernetes.io/instance: {{ .Release.Name }}app.kubernetes.io/component: redisspec:containers:- name: redisimage: "{{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}"imagePullPolicy: {{ .Values.redis.image.pullPolicy }}+ # $(REDIS_PASSWORD) is expanded by the kubelet from the env var below,+ # so the password itself never appears in the pod spec.+ args:+ - --port+ - {{ .Values.redis.port | quote }}+ - --requirepass+ - $(REDIS_PASSWORD)+ env:+ - name: REDIS_PASSWORD+ valueFrom:+ secretKeyRef:+ name: {{ include "infisical.fullname" . }}-secrets+ key: REDIS_PASSWORDports:- name: rediscontainerPort: {{ .Values.redis.port }}@@ -49,10 +64,39 @@ spec:type: ClusterIPselector:app.kubernetes.io/name: {{ include "infisical.name" . }}+ app.kubernetes.io/instance: {{ .Release.Name }}app.kubernetes.io/component: redisports:- name: redisport: {{ .Values.redis.port }}targetPort: redisprotocol: TCP+{{- if .Values.redis.networkPolicy }}+---+# Defense in depth alongside requirepass: only Infisical pods may reach Redis.+# Enforced only where the cluster CNI supports NetworkPolicy (NKP's does).+apiVersion: networking.k8s.io/v1+kind: NetworkPolicy+metadata:+ name: {{ include "infisical.fullname" . }}-redis+ labels:+ {{- include "infisical.labels" . | nindent 4 }}+ app.kubernetes.io/component: redis+spec:+ podSelector:+ matchLabels:+ app.kubernetes.io/name: {{ include "infisical.name" . }}+ app.kubernetes.io/instance: {{ .Release.Name }}+ app.kubernetes.io/component: redis+ policyTypes:+ - Ingress+ ingress:+ - from:+ - podSelector:+ matchLabels:+ {{- include "infisical.selectorLabels" . | nindent 14 }}+ ports:+ - protocol: TCP+ port: {{ .Values.redis.port }}+{{- end }}{{- end }}diff --git a/helm-charts/infisical-nkp/templates/secret.yaml b/helm-charts/infisical-nkp/templates/secret.yamlindex 526ee7237d..e523866072 100644--- a/helm-charts/infisical-nkp/templates/secret.yaml+++ b/helm-charts/infisical-nkp/templates/secret.yaml@@ -8,7 +8,13 @@ type: OpaquestringData:ENCRYPTION_KEY: {{ include "infisical.encryptionKey" . | quote }}AUTH_SECRET: {{ include "infisical.authSecret" . | quote }}- REDIS_URL: {{ include "infisical.redisUrl" . | quote }}+ {{- if .Values.redis.enabled }}+ {{- $redisPassword := include "infisical.redisPassword" . }}+ REDIS_PASSWORD: {{ $redisPassword | quote }}+ REDIS_URL: {{ printf "redis://:%s@%s-redis:%v" $redisPassword (include "infisical.fullname" .) .Values.redis.port | quote }}+ {{- else }}+ REDIS_URL: {{ .Values.secrets.redisUrl | quote }}+ {{- end }}{{- if not .Values.postgres.cnpg.enabled }}# Only used when CNPG is disabled and an external Postgres is provided.DB_CONNECTION_URI: {{ .Values.postgres.externalConnectionUri | quote }}diff --git a/helm-charts/infisical-nkp/values.yaml b/helm-charts/infisical-nkp/values.yamlindex 57cdbc0fe2..87b8698e53 100644--- a/helm-charts/infisical-nkp/values.yaml+++ b/helm-charts/infisical-nkp/values.yaml@@ -34,6 +34,10 @@ redis:tag: "7.4-alpine"pullPolicy: IfNotPresentport: 6379+ # Restrict Redis ingress to the Infisical pods (enforced where the CNI+ # supports NetworkPolicy). The bundled Redis is also password-protected with+ # a generated password stored in the chart Secret (REDIS_PASSWORD).+ networkPolicy: true# PostgreSQL is provided by the NKP CloudNativePG (CNPG) operator.# REQUIRES the CloudNativePG platform application to be enabled in the@@ -61,6 +65,8 @@ service:type: ClusterIPport: 8080+# TLS is handled by the NKP kommander-traefik controller via the router+# annotations below; there is no separate tls toggle.ingress:enabled: trueclassName: kommander-traefik@@ -68,7 +74,6 @@ ingress:annotations:traefik.ingress.kubernetes.io/router.tls: "true"traefik.ingress.kubernetes.io/router.entrypoints: websecure- tls: trueresources:requests: