Skip to content

Commit

Permalink
feat: add helm deploy for edge
Browse files Browse the repository at this point in the history
  • Loading branch information
vie-serendipity committed May 13, 2024
1 parent 1cdda69 commit 1828609
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 44 deletions.
81 changes: 48 additions & 33 deletions deploy/chart/templates/plugin.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -235,24 +248,24 @@ 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 }}
- mountPath: /host/run/csi-tool
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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -339,4 +352,6 @@ spec:
rollingUpdate:
maxUnavailable: 20%
type: RollingUpdate
---
{{- end -}}
{{- end -}}
11 changes: 0 additions & 11 deletions deploy/chart/values-edge.yaml

This file was deleted.

29 changes: 29 additions & 0 deletions deploy/chart/values-nodepools.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions deploy/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ csi:
controller:
enabled: true

nodepools:
default:
name: csi-plugin
csi: {}

defaultStorageClass:
enabled: true

Expand Down

0 comments on commit 1828609

Please sign in to comment.