Skip to content
Snippets Groups Projects
Unverified Commit cd80daf3 authored by Bastian Scherber's avatar Bastian Scherber Committed by GitHub
Browse files

Use the node label for NodeAffinity rule (#187)

- The label `kubernetes.io/hostname` defaults
   to a node's hostname.
   However, it can be overridden with
   the kubelet flag `--hostname-override`

- Pods cannot be scheduled on clusters
  where the nodename doesn't match the `kubernetes.io/hostname` label,
  because the MatchExpression
  can never be fulfilled
parent 2b1c3d60
No related branches found
No related tags found
No related merge requests found
......@@ -216,6 +216,12 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
fs := v1.PersistentVolumeFilesystem
hostPathType := v1.HostPathDirectoryOrCreate
valueNode, ok := node.GetLabels()[KeyNode]
if !ok {
valueNode = node.Name
}
return &v1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Name: name,
......@@ -242,7 +248,7 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
Key: KeyNode,
Operator: v1.NodeSelectorOpIn,
Values: []string{
node.Name,
valueNode,
},
},
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment