Skip to content

Commit

Permalink
feat:support static custompath
Browse files Browse the repository at this point in the history
  • Loading branch information
houkunpeng committed Feb 21, 2023
1 parent 43acdeb commit dc40b36
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const (
)

const (
KeyNode = "kubernetes.io/hostname"
KeyNode = "kubernetes.io/hostname"
customPathAnnotation = "rancher.io/customPath"

NodeDefaultNonListedNodes = "DEFAULT_PATH_FOR_NON_LISTED_NODES"

Expand Down Expand Up @@ -266,7 +267,9 @@ func (p *LocalPathProvisioner) Provision(ctx context.Context, opts pvController.
} else {
logrus.Infof("Creating volume %v at %v:%v", name, nodeName, path)
}

if pvc.GetAnnotations()[customPathAnnotation] != "" {
path = pvc.GetAnnotations()[customPathAnnotation]
}
storage := pvc.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
provisionCmd := []string{"/bin/sh", "/script/setup"}
if err := p.createHelperPod(ActionTypeCreate, provisionCmd, volumeOptions{
Expand Down

0 comments on commit dc40b36

Please sign in to comment.