Is there any method to set nodeselector for pod using golang api

516 views Asked by At

Basically need a way to set nodeselector for Pod using GoLang API

Pod.Spec.NodeSelector["failure-domain.beta.kubernetes.io/zone"] = zone is giving out error

1

There are 1 answers

0
Rajjy On BEST ANSWER

You should initialize the map before setting it. something like this

pod.Spec.NodeSelector = make(map[string]string)
pod.Spec.NodeSelector["failure-domain.beta.kubernetes.io/zone"] = "zone1"