Skip to content

Commit

Permalink
charts: update lvm csi driver webhook related charts
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
  • Loading branch information
Vicente-Cheng committed Sep 24, 2024
1 parent 21c2d91 commit 3e75f7c
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 16 deletions.
80 changes: 80 additions & 0 deletions charts/harvester-csi-driver-lvm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "harvester-csi-driver-lvm.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
CSI-plugin labels
*/}}
{{- define "harvester-csi-driver-lvm.labels" -}}
helm.sh/chart: {{ include "harvester-csi-driver-lvm.chart" . }}
{{ include "harvester-csi-driver-lvm.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: storage
{{- end }}

{{/*
CSI-plugin Selector labels
*/}}
{{- define "harvester-csi-driver-lvm.selectorLabels" -}}
app.kubernetes.io/name: {{ include "harvester-csi-driver-lvm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
CSI-controller labels
*/}}
{{- define "harvester-csi-driver-lvm-controller.labels" -}}
helm.sh/chart: {{ include "harvester-csi-driver-lvm.chart" . }}
{{ include "harvester-csi-driver-lvm-controller.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: storage
{{- end }}

{{/*
CSI-controller Selector labels
*/}}
{{- define "harvester-csi-driver-lvm-controller.selectorLabels" -}}
app.kubernetes.io/name: {{ include "harvester-csi-driver-lvm.name" . }}-controller
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
CSI-webhook labels
*/}}
{{- define "harvester-csi-driver-lvm-webhook.labels" -}}
helm.sh/chart: {{ include "harvester-csi-driver-lvm.chart" . }}
{{ include "harvester-csi-driver-lvm-webhook.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: webhook
{{- end }}

{{/*
CSI-webhook Selector labels
*/}}
{{- define "harvester-csi-driver-lvm-webhook.selectorLabels" -}}
app.kubernetes.io/name: {{ include "harvester-csi-driver-lvm.name" . }}-webhook
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
CSI components
*/}}
{{- define "externalImages.csiAttacher" -}}
{{- if .Values.customCSISidecars.enabled -}}
{{- print .Values.customCSISidecars.attacher -}}
Expand Down
11 changes: 5 additions & 6 deletions charts/harvester-csi-driver-lvm/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ apiVersion: apps/v1
metadata:
name: harvester-csi-driver-lvm-controller
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "harvester-csi-driver-lvm-controller.labels" . | nindent 4 }}
spec:
serviceName: harvester-csi-driver-lvm-controller
replicas: 1
selector:
matchLabels:
app: harvester-csi-driver-lvm-controller
{{- include "harvester-csi-driver-lvm-controller.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: harvester-csi-driver-lvm-controller
{{- include "harvester-csi-driver-lvm-controller.labels" . | nindent 8 }}
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
- key: app.kubernetes.io/name
operator: In
values:
- harvester-csi-driver-lvm-plugin
- harvester-csi-driver-lvm
topologyKey: kubernetes.io/hostname
{{- if .Values.nodeSelector.provisioner }}
nodeSelector:
Expand Down
7 changes: 3 additions & 4 deletions charts/harvester-csi-driver-lvm/templates/csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ kind: DaemonSet
metadata:
name: harvester-csi-driver-lvm-plugin
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "harvester-csi-driver-lvm.labels" . | nindent 4 }}
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
app: harvester-csi-driver-lvm-plugin
{{- include "harvester-csi-driver-lvm.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: harvester-csi-driver-lvm-plugin
{{- include "harvester-csi-driver-lvm.labels" . | nindent 8 }}
spec:
serviceAccountName: harvester-csi-driver-lvm
{{- if .Values.tolerations.plugin }}
Expand Down
41 changes: 40 additions & 1 deletion charts/harvester-csi-driver-lvm/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,43 @@ roleRef:
kind: ClusterRole
name: harvester-csi-driver-lvm
apiGroup: rbac.authorization.k8s.io
---
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: harvester-csi-driver-lvm-webhook
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: harvester-csi-driver-lvm-webhook
rules:
- apiGroups: [ "" ]
resources: [ "secrets", "configmaps" ]
verbs: [ "*" ]
- apiGroups: [ "storage.k8s.io" ]
resources: [ "storageclasses" ]
verbs: [ "*" ]
- apiGroups: [ "apiregistration.k8s.io" ]
resources: [ "apiservices" ]
verbs: [ "get", "watch", "list" ]
- apiGroups: [ "apiextensions.k8s.io" ]
resources: [ "customresourcedefinitions" ]
verbs: [ "get", "watch", "list" ]
- apiGroups: [ "admissionregistration.k8s.io" ]
resources: [ "validatingwebhookconfigurations", "mutatingwebhookconfigurations" ]
verbs: [ "*" ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: harvester-csi-driver-lvm-webhook
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: harvester-csi-driver-lvm-webhook
subjects:
- kind: ServiceAccount
name: harvester-csi-driver-lvm-webhook
namespace: {{ .Release.Namespace }}
57 changes: 57 additions & 0 deletions charts/harvester-csi-driver-lvm/templates/webhook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "harvester-csi-driver-lvm-webhook.labels" . | nindent 4 }}
{{- if .Values.webhook.replicas }}
# The annotation does not support 0 replicas.
annotations:
management.cattle.io/scale-available: "{{ .Values.webhook.replicas }}"
{{- end }}
name: harvester-csi-driver-lvm-webhook
spec:
{{- if not .Values.webhook.replicas }}
# Use this field instead of the scale-available annotation when it is 0 replicas.
replicas: {{ .Values.webhook.replicas }}
{{- end }}
selector:
matchLabels:
{{- include "harvester-csi-driver-lvm-webhook.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "harvester-csi-driver-lvm-webhook.labels" . | nindent 8 }}
spec:
serviceAccountName: harvester-csi-driver-lvm-webhook
{{- if .Values.tolerations.webhook }}
tolerations:
{{ toYaml .Values.tolerations.webhook | indent 8 }}
{{- end }}
containers:
- name: harvester-csi-driver-lvm-webhook
image: "{{ .Values.webhook.image.repository }}:{{ .Values.webhook.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.webhook.image.pullPolicy }}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command:
- csi-driver-lvm-webhook
---
apiVersion: v1
kind: Service
metadata:
name: harvester-csi-driver-lvm-webhook
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
selector:
{{- include "harvester-csi-driver-lvm-webhook.selectorLabels" . | nindent 4 }}
ports:
- name: https
port: 443
protocol: TCP
targetPort: {{ .Values.webhook.httpsPort }}
30 changes: 25 additions & 5 deletions charts/harvester-csi-driver-lvm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@ provisionerImage:
# Overrides the image tag whose default is the chart appVersion.
tag: "main-head"

nameOverride: ""

lvm:
# You will want to change this for read-only filesystems
# For example, in Talos OS, set this to "/var/etc/lvm"
hostWritePath: /etc/lvm

driverName: lvm.driver.harvesterhci.io

webhook:
replicas: 1
image:
repository: rancher/harvester-lvm-csi-driver-webhook
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "main-head"
httpsPort: 8443

rbac:
create: true

Expand Down Expand Up @@ -48,11 +59,12 @@ customCSISidecars:

## uncomment and set these if enabled=true

# attacher: k8s.gcr.io/sig-storage/csi-attacher:v3.5.0
# livenessprobe: k8s.gcr.io/sig-storage/livenessprobe:v2.7.0
# provisioner: k8s.gcr.io/sig-storage/csi-provisioner:v3.2.1
# registrar: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.5.1
# resizer: k8s.gcr.io/sig-storage/csi-resizer:v1.6.0
# attacher: registry.k8s.io/sig-storage/csi-attacher:v4.4.2
# livenessprobe: registry.k8s.io/sig-storage/livenessprobe:v2.12.0
# provisioner: registry.k8s.io/sig-storage/csi-provisioner:v3.6.2
# registrar: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.9.2
# resizer: registry.k8s.io/sig-storage/csi-resizer:v1.9.2
# snapshotter: registry.k8s.io/sig-storage/csi-snapshotter:v6.3.4

nodeSelector:
# The plugin daemonset will run on all nodes if it has a toleration,
Expand Down Expand Up @@ -86,3 +98,11 @@ tolerations:
# - key: node-role.kubernetes.io/control-plane
# operator: Exists
# effect: NoSchedule
webhook:
# - key: node-role.kubernetes.io/master
# operator: Exists
# effect: NoSchedule
# - key: node-role.kubernetes.io/control-plane
# operator: Exists
# effect: NoSchedule

Check failure on line 108 in charts/harvester-csi-driver-lvm/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

[new-line-at-end-of-file] no new line character at the end of file

Check failure on line 108 in charts/harvester-csi-driver-lvm/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

[trailing-spaces] trailing spaces

0 comments on commit 3e75f7c

Please sign in to comment.