Automatically label clusterspiffeids with their class name (#877)

* Automatically label clusterspiffeids with their class name

Signed-off-by: Kevin Fox <[email protected]>

* Automatically label clusterspiffeids with their class name

Signed-off-by: Kevin Fox <[email protected]>

---------

Signed-off-by: Kevin Fox <[email protected]>
Co-authored-by: Faisal Memon <[email protected]>
This commit is contained in:
kfox1111
2026-07-14 14:57:46 -07:00
committed by GitHub
co-authored by Faisal Memon
parent bf6b36c807
commit f548e05899
@@ -92,6 +92,12 @@ matchLabels:
{{- end }} {{- end }}
{{- $podSelector := deepCopy (dig "podSelector" (dict) $value) }} {{- $podSelector := deepCopy (dig "podSelector" (dict) $value) }}
{{- $podSelector := merge $podSelector (include "spire-controller-manager-identity-podselector" (dict "type" $type "Release" $root.Release) | fromYaml ) }} {{- $podSelector := merge $podSelector (include "spire-controller-manager-identity-podselector" (dict "type" $type "Release" $root.Release) | fromYaml ) }}
{{- $className := include "spire-server.controller-manager-class-name" $root }}
{{- $labels := dict }}
{{- if and (hasKey $value "labels") (gt (len $value.labels) 0) }}
{{- $labels = deepCopy $value.labels }}
{{- end }}
{{- $_ := set $labels "spire.spiffe.io/class-name" $className }}
--- ---
apiVersion: spire.spiffe.io/v1alpha1 apiVersion: spire.spiffe.io/v1alpha1
kind: ClusterSPIFFEID kind: ClusterSPIFFEID
@@ -101,12 +107,12 @@ metadata:
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with $value.labels }} {{- with $labels }}
labels: labels:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
className: {{ include "spire-server.controller-manager-class-name" $root | quote }} className: {{ $className | quote }}
{{- if hasKey $value "hint" }} {{- if hasKey $value "hint" }}
{{- if ne $value.hint "" }} {{- if ne $value.hint "" }}
hint: {{ $value.hint }} hint: {{ $value.hint }}