Skip to content

Commit

Permalink
applied DRY on storage node daemonset
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey1330 committed Sep 27, 2024
1 parent d9396f8 commit 8cda85d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 68 deletions.
23 changes: 17 additions & 6 deletions charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,23 @@ The following table lists the configurable parameters of the latest Simplyblock
| `cachingnode.cpuMask` | the cpu mask for the spdk app to use for caching node | `<empty>` | |
| `cachingnode.spdkMem` | the amount of hugepage memory to allocate for caching node | `<empty>` | |
| `cachingnode.spdkImage` | SPDK image uri for caching node | `<empty>` | |
| `cachingnode.multipathing` | Enable multipathing for lvol connection | `true` | |
| `storagenode.tolerations.create` | Whether to create tolerations for the storage node | `false` | |
| `storagenode.tolerations.effect` | the effect of tolerations on the storage node | `NoSchedule` | |
| `storagenode.tolerations.key ` | the key of tolerations for the storage node | `dedicated` | |
| `storagenode.tolerations.operator ` | the operator for the storage node tolerations | `Equal` | |
| `storagenode.tolerations.value ` | the value of tolerations for the storage node | `simplyblock-cache` | |
| `cachingnode.multipathing` | Enable multipathing for lvol connection | `true` | |
| `storagenode.daemonsets[0].name` | The name of the storage node DaemonSet | `storage-node-ds` | |
| `storagenode.daemonsets[0].appLabel` | The label applied to the storage node DaemonSet for identification | `storage-node` | |
| `storagenode.daemonsets[0].nodeSelector` | The node selector to specify which nodes the storage node DaemonSet should run on | `storage-node` | |
| `storagenode.daemonsets[0].tolerations.create` | Whether to create tolerations for the storage node | `false` | |
| `storagenode.daemonsets[0].tolerations.effect` | the effect of tolerations on the storage node | `NoSchedule` | |
| `storagenode.daemonsets[0].tolerations.key ` | the key of tolerations for the storage node | `dedicated` | |
| `storagenode.daemonsets[0].tolerations.operator ` | the operator for the storage node tolerations | `Equal` | |
| `storagenode.daemonsets[0].tolerations.value ` | the value of tolerations for the storage node | `simplyblock-cache` | |
| `storagenode.daemonsets[1].name` | The name of the reserve storage node DaemonSet | `storage-node-ds` | |
| `storagenode.daemonsets[1].appLabel` | The label applied to the reserve storage node DaemonSet for identification | `storage-node` | |
| `storagenode.daemonsets[1].nodeSelector` | The node selector to specify which nodes the reserve storage node DaemonSet should run on | `storage-node` | |
| `storagenode.daemonsets[1].tolerations.create` | Whether to create tolerations for the reserve storage node | `false` | |
| `storagenode.daemonsets[1].tolerations.effect` | the effect of tolerations on the reserve storage node | `NoSchedule` | |
| `storagenode.daemonsets[1].tolerations.key ` | the key of tolerations for the reserve storage node | `dedicated` | |
| `storagenode.daemonsets[1].tolerations.operator ` | the operator for the reserve storage node tolerations | `Equal` | |
| `storagenode.daemonsets[1].tolerations.value ` | the value of tolerations for the reserve storage node | `simplyblock-cache` | |
| `storagenode.ifname` | the default interface to be used for binding the storage node to host interface | `eth0` | |
| `storagenode.cpuMask` | the cpu mask for the spdk app to use for storage node | `<empty>` | |
| `storagenode.spdkImage` | SPDK image uri for storage node | `<empty>` | |
Expand Down
67 changes: 11 additions & 56 deletions charts/latest/spdk-csi/templates/storage-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,37 @@ roleRef:
name: storage-node-role
apiGroup: rbac.authorization.k8s.io

{{- range .Values.storagenode.daemonsets }}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: storage-node-ds
name: {{ .name }}
annotations:
helm.sh/hook: post-install
spec:
selector:
matchLabels:
app: storage-node
app: {{ .appLabel }}
template:
metadata:
labels:
app: storage-node
app: {{ .appLabel }}
spec:
serviceAccountName: storage-node-sa
nodeSelector:
type: simplyblock-storage-plane
type: {{ .nodeSelector }}
volumes:
- name: dev-vol
hostPath:
path: /dev
hostNetwork: true
{{- if .Values.storagenode.tolerations.create }}
{{- if .tolerations.create }}
tolerations:
- effect: {{ .Values.storagenode.tolerations.effect }}
key: {{ .Values.storagenode.tolerations.key }}
operator: {{ .Values.storagenode.tolerations.operator }}
value: {{ .Values.storagenode.tolerations.value }}
- effect: {{ .tolerations.effect }}
key: {{ .tolerations.key }}
operator: {{ .tolerations.operator }}
value: {{ .tolerations.value }}
{{- end }}
containers:
- name: s-node-api-container
Expand All @@ -77,50 +78,4 @@ spec:
volumeMounts:
- name: dev-vol
mountPath: /dev

---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: storage-node-ds-reserve
annotations:
helm.sh/hook: post-install
spec:
selector:
matchLabels:
app: storage-node-reserve
template:
metadata:
labels:
app: storage-node-reserve
spec:
serviceAccountName: storage-node-sa
nodeSelector:
type: simplyblock-storage-plane-reserve
volumes:
- name: dev-vol
hostPath:
path: /dev
hostNetwork: true
{{- if .Values.storagenode.tolerations.create }}
tolerations:
- effect: {{ .Values.storagenode.tolerations.effect }}
key: {{ .Values.storagenode.tolerations.key }}
operator: {{ .Values.storagenode.tolerations.operator }}
value: {{ .Values.storagenode.tolerations.value }}
{{- end }}
containers:
- name: s-node-api-container
image: "{{ .Values.image.simplyblock.repository }}:{{ .Values.image.simplyblock.tag }}"
imagePullPolicy: "{{ .Values.image.simplyblock.pullPolicy }}"
command: ["python", "simplyblock_web/snode_app_k8s.py"]
env:
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
securityContext:
privileged: true
volumeMounts:
- name: dev-vol
mountPath: /dev
{{- end }}
26 changes: 20 additions & 6 deletions charts/latest/spdk-csi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ benchmarks: 0
# FIXME: this will not work if there are group of nodes with different AMI types like: AL2, AL2023
# AL2_x86_64: eth0
# AL2023_x86_64_STANDARD: ens5

cachingnode:
tolerations:
create: false
Expand All @@ -111,12 +112,6 @@ cachingnode:
multipathing: true

storagenode:
tolerations:
create: false
effect: NoSchedule
key: dedicated
operator: Equal
value: simplyblock-storage-plane
ifname: eth0
cpuMask:
spdkImage:
Expand All @@ -128,3 +123,22 @@ storagenode:
numDevices: 1
iobufSmallPoolCount:
iobufLargePoolCount:
daemonsets:
- name: storage-node-ds
appLabel: storage-node
nodeSelector: simplyblock-storage-plane
tolerations:
create: false
effect: NoSchedule
key: dedicated
operator: Equal
value: simplyblock-storage-plane
- name: storage-node-ds-reserve
appLabel: storage-node-reserve
nodeSelector: simplyblock-storage-plane-reserve
tolerations:
create: false
effect: NoSchedule
key: dedicated
operator: Equal
value: simplyblock-storage-plane-reserve

0 comments on commit 8cda85d

Please sign in to comment.