Skip to content

Commit

Permalink
Update labels and selectors
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Mar 12, 2024
1 parent b7633cc commit 8b2eedb
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 17 deletions.
6 changes: 3 additions & 3 deletions charts/cluster-auth-manager/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ metadata:
name: cluster-auth-manager
namespace: {{ .Release.Namespace }}
labels:
app: cluster-auth-manager
{{- include "cluster-auth-manager.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: cluster-auth-manager
{{- include "cluster-auth-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: cluster-auth-manager
{{- include "cluster-auth-manager.labels" . | nindent 8 }}
spec:
{{- if .Values.kubeconfigSecretName }}
automountServiceAccountToken: false
Expand Down
6 changes: 4 additions & 2 deletions charts/cluster-gateway-manager/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ kind: Deployment
metadata:
name: cluster-gateway-manager
namespace: {{ .Release.Namespace }}
labels:
{{- include "cluster-gateway-manager.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
open-cluster-management.io/addon: cluster-gateway
{{- include "cluster-gateway-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
open-cluster-management.io/addon: cluster-gateway
{{- include "cluster-gateway-manager.labels" . | nindent 8 }}
spec:
serviceAccount: cluster-gateway-manager
automountServiceAccountToken: true
Expand Down
6 changes: 4 additions & 2 deletions charts/cluster-proxy-manager/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ kind: Deployment
metadata:
name: cluster-proxy-manager
namespace: {{ .Release.Namespace }}
labels:
{{- include "cluster-proxy-manager.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
open-cluster-management.io/addon: cluster-proxy
{{- include "cluster-proxy-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
open-cluster-management.io/addon: cluster-proxy
{{- include "cluster-proxy-manager.labels" . | nindent 8 }}
spec:
serviceAccount: cluster-proxy-manager
automountServiceAccountToken: true
Expand Down
6 changes: 3 additions & 3 deletions charts/fluxcd-manager/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ metadata:
name: fluxcd-manager
namespace: {{ .Release.Namespace }}
labels:
app: fluxcd-manager
{{- include "fluxcd-manager.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: fluxcd-manager
{{- include "fluxcd-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: fluxcd-manager
{{- include "fluxcd-manager.labels" . | nindent 8 }}
spec:
{{- if .Values.kubeconfigSecretName }}
automountServiceAccountToken: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ kind: Deployment
metadata:
name: managed-serviceaccount-manager
namespace: {{ .Release.Namespace }}
labels:
{{- include "managed-serviceaccount-manager.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas | default 1 }}
selector:
matchLabels:
open-cluster-management.io/addon: managed-serviceaccount
{{- include "managed-serviceaccount-manager.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
open-cluster-management.io/addon: managed-serviceaccount
{{- include "managed-serviceaccount-manager.labels" . | nindent 8 }}
spec:
{{- if .Values.kubeconfigSecretName }}
automountServiceAccountToken: false
Expand Down
62 changes: 62 additions & 0 deletions charts/multicluster-controlplane/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "multicluster-controlplane.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 "multicluster-controlplane.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 }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "multicluster-controlplane.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "multicluster-controlplane.labels" -}}
helm.sh/chart: {{ include "multicluster-controlplane.chart" . }}
{{ include "multicluster-controlplane.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "multicluster-controlplane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "multicluster-controlplane.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "multicluster-controlplane.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "multicluster-controlplane.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/multicluster-controlplane/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ metadata:
name: multicluster-controlplane
namespace: {{ .Release.Namespace }}
labels:
app: multicluster-controlplane
{{- include "multicluster-controlplane.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: multicluster-controlplane
{{- include "multicluster-controlplane.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: multicluster-controlplane
{{- include "multicluster-controlplane.labels" . | nindent 8 }}
spec:
serviceAccountName: multicluster-controlplane-sa
containers:
Expand Down
4 changes: 2 additions & 2 deletions charts/multicluster-controlplane/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: multicluster-controlplane
namespace: {{ .Release.Namespace }}
labels:
component: multicluster-controlplane
{{- include "multicluster-controlplane.labels" . | nindent 4 }}
spec:
{{- if eq .Values.route.enabled true }}
type: ClusterIP
Expand All @@ -20,7 +20,7 @@ spec:
type: ClusterIP
{{- end }}
selector:
app: multicluster-controlplane
{{- include "multicluster-controlplane.selectorLabels" . | nindent 4 }}
ports:
- name: app
protocol: TCP
Expand Down

0 comments on commit 8b2eedb

Please sign in to comment.