From 49dc99726b0fbab869a201b034a489d6a2b1f688 Mon Sep 17 00:00:00 2001 From: Pawan Date: Wed, 29 Apr 2020 21:56:28 +0530 Subject: [PATCH] fix(topokey): changing topology key to unique name There are setups where nodename is different than the hostname. The driver uses the nodename and tries to set the "kubernetes.io/hostname" node label to the nodename. Which will fail if nodename is not same as hostname. Here, changing the key to unique name so that the driver can set that key as node label and also it can not modify/touch the existing node labels. Now onwards, the driver will use "openebs.io/nodename" key to set the PV node affinity. Old volumes will have "kubernetes.io/hostname" affinity, and they will also work as after the PR https://github.com/openebs/zfs-localpv/pull/94, it supports all the node labels as topology key and all the nodes have "kubernetes.io/hostname" label set. So old volumes will work without any issue. Also for the same reason old stoarge classes which are using "kubernetes.io/hostname" as topology key, will work as that key is supported. This fixes the issue where the driver was trying to create the PV on the master node as master node is having "kubernetes.io/hostname" label, so it is also becoming a valid candidate for provisioning the PV. After changing the key to unique name, since the driver will not run on master node, so it will not set "openebs.io/nodename" label to this node hence this node will never become a valid candidate for the provisioning the volume. Signed-off-by: Pawan --- pkg/zfs/volume.go | 2 +- unreleased/101-pawanpraka1 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 unreleased/101-pawanpraka1 diff --git a/pkg/zfs/volume.go b/pkg/zfs/volume.go index ff17299..d7ca48f 100644 --- a/pkg/zfs/volume.go +++ b/pkg/zfs/volume.go @@ -42,7 +42,7 @@ const ( // ZFSNodeKey will be used to insert Label in ZfsVolume CR ZFSNodeKey string = "kubernetes.io/nodename" // ZFSTopologyKey is supported topology key for the zfs driver - ZFSTopologyKey string = "kubernetes.io/hostname" + ZFSTopologyKey string = "openebs.io/nodename" // ZFSStatusPending shows object has not handled yet ZFSStatusPending string = "Pending" // ZFSStatusReady shows object has been processed diff --git a/unreleased/101-pawanpraka1 b/unreleased/101-pawanpraka1 new file mode 100644 index 0000000..c8e6da1 --- /dev/null +++ b/unreleased/101-pawanpraka1 @@ -0,0 +1 @@ + changing topology key to unique name to avoid collision with the existing node label