From 75f9bcccbc307e59b9cf4daf83efb255666ff05e Mon Sep 17 00:00:00 2001 From: Peter Grant Date: Thu, 15 Mar 2018 16:51:25 +0100 Subject: [PATCH] Add namespace extended attributes to directory --- cmd/nfs-client-provisioner/provisioner.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/nfs-client-provisioner/provisioner.go b/cmd/nfs-client-provisioner/provisioner.go index ccb0292b..79c051df 100644 --- a/cmd/nfs-client-provisioner/provisioner.go +++ b/cmd/nfs-client-provisioner/provisioner.go @@ -26,6 +26,7 @@ import ( "github.com/golang/glog" "github.com/kubernetes-incubator/external-storage/lib/controller" + "github.com/pkg/xattr" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" @@ -65,6 +66,9 @@ func (p *nfsProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis if err := os.MkdirAll(fullPath, 0777); err != nil { return nil, errors.New("unable to create directory to provision new pv: " + err.Error()) } + if err := xattr.Set(fullPath, "namespace", []byte(pvcNamespace)); err != nil { + return nil, errors.New("unable to set extended attributes on directory to provision new pv: " + err.Error()) + } os.Chmod(fullPath, 0777) path := filepath.Join(p.path, pvName)