Skip to content

Instantly share code, notes, and snippets.

@moolen
Created January 14, 2022 11:38
Show Gist options
  • Save moolen/4313754c376d3f81d5e15147463aea85 to your computer and use it in GitHub Desktop.
Save moolen/4313754c376d3f81d5e15147463aea85 to your computer and use it in GitHub Desktop.
kubeedge / csi integration example
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: csi-hostpath-controller
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: csi-hostpath-controller
serviceName: csi-hostpath-controller
template:
metadata:
creationTimestamp: null
labels:
app: csi-hostpath-controller
spec:
containers:
- args:
- -v=5
- --csi-address=/csi/csi.sock
- --feature-gates=Topology=true
- --strict-topology
- --timeout=120s
image: k8s.gcr.io/sig-storage/csi-provisioner:v3.0.0
name: csi-provisioner
volumeMounts:
- mountPath: /csi
name: csi-socket-dir
- args:
- --v=5
- --csi-address=/csi/csi.sock
- --timeout=120s
image: quay.io/k8scsi/csi-attacher:v2.1.0
name: csi-attacher
volumeMounts:
- mountPath: /csi
name: csi-socket-dir
- args:
- --v=10
- --drivername=$(CSI_DRIVERNAME)
- --endpoint=$(CSI_ENDPOINT)
- --kubeedge-endpoint=$(KUBEEDGE_ENDPOINT)
- --state-path=$(STATE_PATH)
env:
- name: CSI_DRIVERNAME
value: csi-hostpath
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
- name: KUBEEDGE_ENDPOINT
value: unix:///kubeedge/kubeedge.sock
- name: STATE_PATH
value: /kubeedge/csidriver
image: docker.io/moolen/kubeedge-csidriver:topo-integration
imagePullPolicy: Always
name: csi-driver
resources: {}
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: csi-socket-dir
- mountPath: /kubeedge
name: kubeedge-socket-dir
nodeSelector:
kubernetes.io/hostname: xxxxx # must be on node that runs cloudcore
volumes:
- hostPath:
path: /var/lib/kubelet/plugins/csi-hostpath
type: DirectoryOrCreate
name: csi-socket-dir
- hostPath:
path: /var/lib/kubeedge
type: DirectoryOrCreate
name: kubeedge-socket-dir
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: csi-hostpath-edge
namespace: default
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
node-role.kubernetes.io/edge: "" # these are the edge nodes
template:
metadata:
labels:
node-role.kubernetes.io/edge: ""
spec:
containers:
- args:
- --v=5
- --csi-address=/csi/csi.sock
- --kubelet-registration-path=/var/lib/edged/plugins/csi-hostpath/csi.sock
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.4.0
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- rm -rf /registration/csi-hostpath /registration/csi-hostpath-reg.sock
name: node-driver-registrar
securityContext:
privileged: true
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: /registration
name: registration-dir
- args:
- --drivername=csi-hostpath
- --v=5
- --nodeid=$(KUBE_NODE_NAME)
- --statedir=/csi-state-dir
- --endpoint=unix:///csi/csi.sock
env:
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
image: k8s.gcr.io/sig-storage/hostpathplugin:v1.7.3
imagePullPolicy: IfNotPresent
name: csi-hostpath-driver
securityContext:
allowPrivilegeEscalation: true
capabilities:
add:
- SYS_ADMIN
privileged: true
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: /var/lib/edged/plugins
mountPropagation: Bidirectional
name: plugins-dir
- mountPath: /var/lib/edged/pods
mountPropagation: Bidirectional
name: mountpoint-dir
- mountPath: /csi-state-dir
name: csi-state-dir
dnsPolicy: ClusterFirst
hostNetwork: true
volumes:
- hostPath:
path: /var/lib/edged/plugins/csi-hostpath
type: DirectoryOrCreate
name: socket-dir
- hostPath:
path: /var/lib/edged/plugins_registry
type: DirectoryOrCreate
name: registration-dir
- hostPath:
path: /var/lib/edged/plugins
type: DirectoryOrCreate
name: plugins-dir
- hostPath:
path: /var/lib/edged/pods
type: DirectoryOrCreate
name: mountpoint-dir
- hostPath:
path: /var/lib/csi-hostpath-state
type: DirectoryOrCreate
name: csi-state-dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment