mirror of https://github.com/k3s-io/k3s
Merge pull request #3816 from brendandburns/api2
Add NodeSelector to the PodTemplate in v1beta1.pull/6/head
commit
c3da4f0b19
|
@ -91,7 +91,6 @@ func fuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
||||||
j.Template = &api.PodTemplateSpec{}
|
j.Template = &api.PodTemplateSpec{}
|
||||||
}
|
}
|
||||||
j.Template.ObjectMeta = api.ObjectMeta{Labels: j.Template.ObjectMeta.Labels}
|
j.Template.ObjectMeta = api.ObjectMeta{Labels: j.Template.ObjectMeta.Labels}
|
||||||
j.Template.Spec.NodeSelector = nil
|
|
||||||
c.Fuzz(&j.Selector)
|
c.Fuzz(&j.Selector)
|
||||||
j.Replicas = int(c.RandUint64())
|
j.Replicas = int(c.RandUint64())
|
||||||
},
|
},
|
||||||
|
|
|
@ -410,6 +410,9 @@ func init() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
out.DesiredState.Host = in.Spec.Host
|
out.DesiredState.Host = in.Spec.Host
|
||||||
|
if err := s.Convert(&in.Spec.NodeSelector, &out.NodeSelector, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -420,6 +423,9 @@ func init() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
out.Spec.Host = in.DesiredState.Host
|
out.Spec.Host = in.DesiredState.Host
|
||||||
|
if err := s.Convert(&in.NodeSelector, &out.Spec.NodeSelector, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,6 +457,7 @@ type ReplicationController struct {
|
||||||
// PodTemplate holds the information used for creating pods.
|
// PodTemplate holds the information used for creating pods.
|
||||||
type PodTemplate struct {
|
type PodTemplate struct {
|
||||||
DesiredState PodState `json:"desiredState,omitempty" description:"specification of the desired state of pods created from this template"`
|
DesiredState PodState `json:"desiredState,omitempty" description:"specification of the desired state of pods created from this template"`
|
||||||
|
NodeSelector map[string]string `json:"nodeSelector,omitempty" description:"a selector which must be true for the pod to fit on a node"`
|
||||||
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize the pods created from the template; must match the selector of the replication controller to which the template belongs; may match selectors of services"`
|
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize the pods created from the template; must match the selector of the replication controller to which the template belongs; may match selectors of services"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,6 +274,9 @@ func init() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
out.DesiredState.Host = in.Spec.Host
|
out.DesiredState.Host = in.Spec.Host
|
||||||
|
if err := s.Convert(&in.Spec.NodeSelector, &out.NodeSelector, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
if err := s.Convert(&in.ObjectMeta.Labels, &out.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -284,6 +287,9 @@ func init() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
out.Spec.Host = in.DesiredState.Host
|
out.Spec.Host = in.DesiredState.Host
|
||||||
|
if err := s.Convert(&in.NodeSelector, &out.Spec.NodeSelector, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
if err := s.Convert(&in.Labels, &out.ObjectMeta.Labels, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -420,6 +420,7 @@ type ReplicationController struct {
|
||||||
// PodTemplate holds the information used for creating pods.
|
// PodTemplate holds the information used for creating pods.
|
||||||
type PodTemplate struct {
|
type PodTemplate struct {
|
||||||
DesiredState PodState `json:"desiredState,omitempty" description:"specification of the desired state of pods created from this template"`
|
DesiredState PodState `json:"desiredState,omitempty" description:"specification of the desired state of pods created from this template"`
|
||||||
|
NodeSelector map[string]string `json:"nodeSelector,omitempty" description:"a selector which must be true for the pod to fit on a node"`
|
||||||
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize the pods created from the template; must match the selector of the replication controller to which the template belongs; may match selectors of services"`
|
Labels map[string]string `json:"labels,omitempty" description:"map of string keys and values that can be used to organize and categorize the pods created from the template; must match the selector of the replication controller to which the template belongs; may match selectors of services"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue