From 1828609b97f33fc668c48f4c839275342fbeba3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=9C=E6=9D=BE?= Date: Fri, 10 May 2024 11:09:32 +0800 Subject: [PATCH] feat: add helm deploy for edge --- deploy/chart/templates/plugin.yaml | 81 ++++++++++++++++++------------ deploy/chart/values-edge.yaml | 11 ---- deploy/chart/values-nodepools.yaml | 29 +++++++++++ deploy/chart/values.yaml | 5 ++ 4 files changed, 82 insertions(+), 44 deletions(-) delete mode 100644 deploy/chart/values-edge.yaml create mode 100644 deploy/chart/values-nodepools.yaml diff --git a/deploy/chart/templates/plugin.yaml b/deploy/chart/templates/plugin.yaml index 5b607d50a..5822729d5 100644 --- a/deploy/chart/templates/plugin.yaml +++ b/deploy/chart/templates/plugin.yaml @@ -1,17 +1,20 @@ -{{- if .Values.plugin.enabled -}} +{{- range .Values.nodepools -}} +{{- if $.Values.plugin.enabled }} +{{- $copy := deepCopy .csi }} +{{- $csi := mergeOverwrite $.Values.csi $copy }} kind: DaemonSet apiVersion: apps/v1 metadata: - name: csi-plugin - namespace: {{ .Release.Namespace }} + name: {{ .name }} + namespace: {{ $.Release.Namespace }} spec: selector: matchLabels: - app: csi-plugin + app: {{ .name }} template: metadata: labels: - app: csi-plugin + app: {{ .name }} spec: tolerations: - operator: Exists @@ -24,6 +27,15 @@ spec: operator: NotIn values: - virtual-kubelet +{{- if .affinity }} + - matchExpressions: + - key: {{ .affinity.key }} + operator: {{ .affinity.operator }} + values: + {{- range .affinity.values }} + - {{ . | quote }} + {{- end -}} +{{- end }} nodeSelector: kubernetes.io/os: linux serviceAccountName: alicloud-csi-node @@ -34,9 +46,9 @@ spec: dnsPolicy: ClusterFirst initContainers: - name: init - image: {{ include "workerImageSpec" (list .Values.images "pluginInit") }} + image: {{ include "workerImageSpec" (list $.Values.images "pluginInit") }} args: - - "--driver={{ include "enabledPlugins" .Values.csi }}" + - "--driver={{ include "enabledPlugins" $csi }}" securityContext: privileged: true allowPrivilegeEscalation: true @@ -57,9 +69,9 @@ spec: - name: ossconnectordir mountPath: /host/usr/ containers: -{{- if .Values.csi.disk.enabled }} +{{- if $csi.disk.enabled }} - name: disk-driver-registrar - image: {{ include "workerImageSpec" (list .Values.images "pluginRegistrar") }} + image: {{ include "workerImageSpec" (list $.Values.images "pluginRegistrar") }} resources: requests: cpu: 10m @@ -77,9 +89,9 @@ spec: - name: registration-dir mountPath: /registration {{- end -}} -{{- if .Values.csi.nas.enabled }} +{{- if $csi.nas.enabled }} - name: nas-driver-registrar - image: {{ include "workerImageSpec" (list .Values.images "pluginRegistrar") }} + image: {{ include "workerImageSpec" (list $.Values.images "pluginRegistrar") }} resources: requests: cpu: 10m @@ -97,9 +109,9 @@ spec: - name: registration-dir mountPath: /registration {{- end -}} -{{- if .Values.csi.oss.enabled }} +{{- if $csi.oss.enabled }} - name: oss-driver-registrar - image: {{ include "workerImageSpec" (list .Values.images "pluginRegistrar") }} + image: {{ include "workerImageSpec" (list $.Values.images "pluginRegistrar") }} resources: requests: cpu: 10m @@ -117,9 +129,9 @@ spec: - name: registration-dir mountPath: /registration {{- end -}} -{{- if .Values.csi.local.enabled }} +{{- if $csi.local.enabled }} - name: local-driver-registrar - image: {{ include "workerImageSpec" (list .Values.images "pluginRegistrar") }} + image: {{ include "workerImageSpec" (list $.Values.images "pluginRegistrar") }} resources: requests: cpu: 10m @@ -147,15 +159,16 @@ spec: securityContext: privileged: true allowPrivilegeEscalation: true - image: {{ include "workerImageSpec" (list .Values.images "plugin") }} + image: {{ include "workerImageSpec" (list $.Values.images "plugin") }} args: - "--endpoint=$(CSI_ENDPOINT)" - "--v=2" - - "--driver={{ include "enabledPlugins" .Values.csi }}" +<<<<<<< HEAD + - "--driver={{ include "enabledPlugins" $csi }}" {{- if .Values.deploy.featureGates }} - "--feature-gates={{ .Values.deploy.featureGates }}" {{- end -}} -{{- if not .Values.deploy.ecs }} +{{- if not $.Values.deploy.ecs }} - --nodeid=$(KUBE_NODE_NAME) {{- end }} env: @@ -169,27 +182,27 @@ spec: - name: SERVICE_TYPE value: "plugin" - name: "DEFAULT_REGISTRY" - value: {{ .Values.images.workerRegistry | default .Values.images.registry | quote }} -{{- if .Values.deploy.ecsEndpoint }} + value: {{ $.Values.images.workerRegistry | default $.Values.images.registry | quote }} +{{- if $.Values.deploy.ecsEndpoint }} - name: ECS_ENDPOINT - value: {{ .Values.deploy.ecsEndpoint | quote }} + value: {{ $.Values.deploy.ecsEndpoint | quote }} {{- end -}} -{{- if .Values.deploy.privateCloud }} +{{- if $.Values.deploy.privateCloud }} - name: ALICLOUD_CLIENT_SCHEME value: HTTP - name: PRIVATE_CLOUD_TAG value: "true" {{- end -}} -{{- if .Values.deploy.accessKey.enabled }} +{{- if $.Values.deploy.accessKey.enabled }} - name: ACCESS_KEY_ID valueFrom: secretKeyRef: - name: {{ .Values.deploy.accessKey.secretName }} + name: {{ $.Values.deploy.accessKey.secretName }} key: id - name: ACCESS_KEY_SECRET valueFrom: secretKeyRef: - name: {{ .Values.deploy.accessKey.secretName }} + name: {{ $.Values.deploy.accessKey.secretName }} key: secret {{- end }} resources: @@ -235,16 +248,16 @@ spec: mountPropagation: "HostToContainer" - mountPath: /run/kata-containers/shared/direct-volumes name: kata-direct-volumes -{{- if .Values.deploy.ack }} +{{- if $.Values.deploy.ack }} - mountPath: /var/addon name: addon-token readOnly: true {{- end -}} -{{- if .Values.csi.oss.enabled }} +{{- if $csi.oss.enabled }} - mountPath: /host/var/run/ossfs name: ossfs-metrics-dir {{- end -}} -{{- if .Values.csi.nas.enabled }} +{{- if $csi.nas.enabled }} - mountPath: /host/var/run/efc name: efc-metrics-dir {{- end }} @@ -252,7 +265,7 @@ spec: name: run-csi - mountPath: /host/sys/fs/cgroup/blkio/kubepods.slice name: cgroupv1-blkio -{{- if .Values.csi.local.enabled }} +{{- if $csi.local.enabled }} - mountPath: /tls/local/grpc name: tls-token-dir readOnly: true @@ -263,13 +276,13 @@ spec: mountPath: /mnt mountPropagation: "Bidirectional" volumes: -{{- if .Values.csi.oss.enabled }} +{{- if $csi.oss.enabled }} - name: ossfs-metrics-dir hostPath: path: /var/run/ossfs type: DirectoryOrCreate {{- end -}} -{{- if .Values.csi.nas.enabled }} +{{- if $csi.nas.enabled }} - name: efc-metrics-dir hostPath: path: /var/run/efc @@ -279,7 +292,7 @@ spec: hostPath: path: /run/csi-tool type: DirectoryOrCreate -{{- if .Values.csi.local.enabled }} +{{- if $csi.local.enabled }} - name: tls-token-dir secret: defaultMode: 420 @@ -325,7 +338,7 @@ spec: path: /run/kata-containers/shared/direct-volumes type: DirectoryOrCreate name: kata-direct-volumes -{{- if .Values.deploy.ack }} +{{- if $.Values.deploy.ack }} - name: addon-token secret: defaultMode: 420 @@ -339,4 +352,6 @@ spec: rollingUpdate: maxUnavailable: 20% type: RollingUpdate +--- {{- end -}} +{{- end -}} \ No newline at end of file diff --git a/deploy/chart/values-edge.yaml b/deploy/chart/values-edge.yaml deleted file mode 100644 index b01506832..000000000 --- a/deploy/chart/values-edge.yaml +++ /dev/null @@ -1,11 +0,0 @@ -deploy: - ecs: false - -csi: - disk: - enabled: false - local: - enabled: true - oss: - controller: - enabled: false diff --git a/deploy/chart/values-nodepools.yaml b/deploy/chart/values-nodepools.yaml new file mode 100644 index 000000000..70eb3324b --- /dev/null +++ b/deploy/chart/values-nodepools.yaml @@ -0,0 +1,29 @@ +deploy: + ecs: false + +nodepools: + default: + name: csi-plugin + csi: {} + affinity: + key: alibabacloud.com/is-edge-worker + operator: NotIn + values: + val1: "true" + edge: + name: csi-plugin-edge + csi: + disk: + enabled: false + local: + enabled: true + oss: + controller: + enabled: false + affinity: + key: alibabacloud.com/is-edge-worker + operator: NotIn + values: + val1: "false" + + # other nodepools \ No newline at end of file diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml index e763f4735..d7343953c 100644 --- a/deploy/chart/values.yaml +++ b/deploy/chart/values.yaml @@ -23,6 +23,11 @@ csi: controller: enabled: true +nodepools: + default: + name: csi-plugin + csi: {} + defaultStorageClass: enabled: true