Skip to content

Commit

Permalink
updated chart objects to have labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobfra committed Jan 27, 2023
1 parent c374389 commit 3b22406
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 4 deletions.
19 changes: 18 additions & 1 deletion charts/rancher-vsphere-cpi/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,21 @@ add below linux tolerations to workloads could be scheduled to those linux nodes

{{- define "linux-node-selector" -}}
kubernetes.io/os: linux
{{- end -}}
{{- end -}}

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

{{/*
Labels that should be added on each resource
*/}}
{{- define "labels" -}}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "chartName" . }}
{{- end -}}

1 change: 1 addition & 0 deletions charts/rancher-vsphere-cpi/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
vsphere-cpi-infra: config
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
data:
vsphere.yaml: |
Expand Down
5 changes: 5 additions & 0 deletions charts/rancher-vsphere-cpi/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
component: {{ .Chart.Name }}-cloud-controller-manager
tier: control-plane
{{- include "labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ""
Expand All @@ -21,6 +22,10 @@ spec:
name: {{ .Chart.Name }}-cloud-controller-manager
component: {{ .Chart.Name }}-cloud-controller-manager
tier: control-plane
{{- include "labels" . | nindent 8 }}
{{- with .Values.cloudControllerManager.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.cloudControllerManager.nodeSelector }}
nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
Expand Down
2 changes: 2 additions & 0 deletions charts/rancher-vsphere-cpi/templates/role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ items:
labels:
vsphere-cpi-infra: role-binding
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 6 }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand All @@ -30,6 +31,7 @@ items:
labels:
vsphere-cpi-infra: cluster-role-binding
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 6 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
1 change: 1 addition & 0 deletions charts/rancher-vsphere-cpi/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
vsphere-cpi-infra: role
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
Expand Down
1 change: 1 addition & 0 deletions charts/rancher-vsphere-cpi/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
vsphere-cpi-infra: secret
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
data:
{{ .Values.vCenter.host }}.username: {{ .Values.vCenter.username | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/rancher-vsphere-cpi/templates/service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ metadata:
labels:
vsphere-cpi-infra: service-account
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
{{- end -}}
1 change: 1 addition & 0 deletions charts/rancher-vsphere-cpi/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Service
metadata:
labels:
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 4 }}
name: {{ .Chart.Name }}-cloud-controller-manager
namespace: {{ .Release.Namespace }}
spec:
Expand Down
2 changes: 2 additions & 0 deletions charts/rancher-vsphere-cpi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ cloudControllerManager:
tag: v1.22.7
nodeSelector: {}
tolerations: []
## Optional additional labels to add to pods
podLabels: {}
rbac:
enabled: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ apiVersion: apps/v1
metadata:
name: vsphere-csi-controller
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels" . | nindent 4 }}
spec:
replicas: 3
strategy:
Expand All @@ -19,6 +21,10 @@ spec:
labels:
app: vsphere-csi-controller
role: vsphere-csi
{{- include "labels" . | nindent 8 }}
{{- with .Values.csiController.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: vsphere-csi-controller
{{- if .Values.csiController.nodeSelector }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-controller-binding
labels:
{{- include "labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: vsphere-csi-controller
Expand Down
2 changes: 2 additions & 0 deletions charts/rancher-vsphere-csi/templates/controller/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-controller-role
labels:
{{- include "labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["nodes", "pods", "configmaps"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ apiVersion: v1
metadata:
name: vsphere-csi-controller
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels" . | nindent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: vsphere-csi-controller
{{- include "labels" . | nindent 4 }}
spec:
ports:
- name: ctlr
Expand Down
6 changes: 6 additions & 0 deletions charts/rancher-vsphere-csi/templates/node/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ apiVersion: apps/v1
metadata:
name: vsphere-csi-node
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels" . | nindent 4 }}
spec:
selector:
matchLabels:
Expand All @@ -17,6 +19,10 @@ spec:
labels:
app: vsphere-csi-node
role: vsphere-csi
{{- include "labels" . | nindent 8 }}
{{- with .Values.csiNode.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.csiNode.nodeSelector }}
nodeSelector: {{ include "linux-node-selector" . | nindent 8 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/rancher-vsphere-csi/templates/node/role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-node-binding
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: vsphere-csi-node
Expand All @@ -18,6 +20,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-node-cluster-role-binding
labels:
{{- include "labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: vsphere-csi-node
Expand Down
4 changes: 4 additions & 0 deletions charts/rancher-vsphere-csi/templates/node/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-node-role
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
Expand All @@ -12,6 +14,8 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-node-cluster-role
labels:
{{- include "labels" . | nindent 4 }}
rules:
- apiGroups: ["cns.vmware.com"]
resources: ["csinodetopologies"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ apiVersion: v1
metadata:
name: vsphere-csi-node
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels" . | nindent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ apiVersion: apps/v1
metadata:
name: vsphere-csi-node-windows
namespace: {{ .Release.Namespace }}
labels:
{{- include "labels" . | nindent 4 }}
spec:
selector:
matchLabels:
Expand Down
11 changes: 8 additions & 3 deletions charts/rancher-vsphere-csi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ csiController:
# operator: Exists
# effect: NoExecute
# tolerationSeconds: 30
##
## Optional additional labels to add to pods
podLabels: {}

# Internal features
csiMigration:
Expand Down Expand Up @@ -96,6 +99,8 @@ csiNode:
nodeSelector: {}
## List of node taints to tolerate (requires Kubernetes >= 1.6)
tolerations: []
## Optional additional labels to add to pods
podLabels: {}
prefixPath: ""
image:
repository: rancher/mirrored-cloud-provider-vsphere-csi-release-driver
Expand Down Expand Up @@ -218,7 +223,7 @@ versionOverrides:
csiController:
image:
repository: rancher/mirrored-cloud-provider-vsphere-csi-release-driver
tag: v2.4.3
tag: v2.4.2
csiAttacher:
repository: rancher/mirrored-sig-storage-csi-attacher
tag: v3.3.0
Expand All @@ -230,14 +235,14 @@ versionOverrides:
tag: v2.4.0
vsphereSyncer:
repository: rancher/mirrored-cloud-provider-vsphere-csi-release-syncer
tag: v2.4.3
tag: v2.4.2
csiProvisioner:
repository: rancher/mirrored-sig-storage-csi-provisioner
tag: v3.0.0
csiNode:
image:
repository: rancher/mirrored-cloud-provider-vsphere-csi-release-driver
tag: v2.4.3
tag: v2.4.2
nodeDriverRegistrar:
repository: rancher/mirrored-sig-storage-csi-node-driver-registrar
tag: v2.3.0
Expand Down

0 comments on commit 3b22406

Please sign in to comment.