-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hostpath): allow custom node affinity label (#15)
Ref: openebs/openebs#2875 provide a feature for administrators to configure a custom node affinity label in place of hostnames. This will help in scenarios, where hostnames can change when node are removed and added back to the cluster with the underlying disks intact. cluster admin can setup custom labels to the nodes and provide this information to Local PV hostpath provisioner to use via StorageClass config key called `NodeAffinityLabel` ``` + //Example: Local PV device StorageClass for using a custom + //node label as: openebs.io/node-affinity-value + //will be as follows + // + // kind: StorageClass + // metadata: + // name: openebs-hostpath + // annotations: + // openebs.io/cas-type: local + // cas.openebs.io/config: | + // - name: StorageType + // value: "device" + // - name: NodeAffinityLabel + // value: "openebs.io/node-affinity-value" + // provisioner: openebs.io/local + // volumeBindingMode: WaitForFirstConsumer + // reclaimPolicy: Delete + // ``` Signed-off-by: kmova <[email protected]>
- Loading branch information
Showing
41 changed files
with
8,696 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: busybox | ||
namespace: default | ||
spec: | ||
containers: | ||
- command: | ||
- sh | ||
- -c | ||
- 'date >> /mnt/store1/date.txt; hostname >> /mnt/store1/hostname.txt; sync; sleep 5; sync; tail -f /dev/null;' | ||
image: busybox | ||
imagePullPolicy: Always | ||
name: busybox | ||
volumeMounts: | ||
- mountPath: /mnt/store1 | ||
name: demo-vol1 | ||
volumes: | ||
- name: demo-vol1 | ||
persistentVolumeClaim: | ||
claimName: demo-vol1-claim | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: demo-vol1-claim | ||
spec: | ||
storageClassName: openebs-hostpath | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 5G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: fillup | ||
namespace: default | ||
spec: | ||
containers: | ||
- command: | ||
- sh | ||
- -c | ||
- 'dd if=/dev/zero of=/mnt/store1/dump.dd bs=1M; sync; sleep 5; sync; tail -f /dev/null;' | ||
image: busybox | ||
imagePullPolicy: Always | ||
name: fillup-bb | ||
volumeMounts: | ||
- mountPath: /mnt/store1 | ||
name: fillup | ||
volumes: | ||
- name: fillup | ||
persistentVolumeClaim: | ||
claimName: fillup-claim | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: fillup-claim | ||
spec: | ||
storageClassName: openebs-hostpath | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#Sample storage classes for OpenEBS Local PV | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: openebs-hostpath | ||
annotations: | ||
openebs.io/cas-type: local | ||
cas.openebs.io/config: | | ||
#hostpath type will create a PV by | ||
# creating a sub-directory under the | ||
# BASEPATH provided below. | ||
- name: StorageType | ||
value: "hostpath" | ||
#Specify the location (directory) where | ||
# where PV(volume) data will be saved. | ||
# A sub-directory with pv-name will be | ||
# created. When the volume is deleted, | ||
# the PV sub-directory will be deleted. | ||
#Default value is /var/openebs/local | ||
- name: BasePath | ||
value: "/var/openebs/local/" | ||
#Specify the node affinity label | ||
# to be added to the PV | ||
#Default: kubernetes.io/hostname | ||
#- name: NodeAffinityLabel | ||
# value: "openebs.io/stg-node-name" | ||
provisioner: openebs.io/local | ||
volumeBindingMode: WaitForFirstConsumer | ||
reclaimPolicy: Delete |
Oops, something went wrong.