mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
implement inter pod topological affinity and anti-affinity
This commit is contained in:
@@ -126,6 +126,9 @@ func init() {
|
||||
DeepCopy_v1_PersistentVolumeSpec,
|
||||
DeepCopy_v1_PersistentVolumeStatus,
|
||||
DeepCopy_v1_Pod,
|
||||
DeepCopy_v1_PodAffinity,
|
||||
DeepCopy_v1_PodAffinityTerm,
|
||||
DeepCopy_v1_PodAntiAffinity,
|
||||
DeepCopy_v1_PodAttachOptions,
|
||||
DeepCopy_v1_PodCondition,
|
||||
DeepCopy_v1_PodExecOptions,
|
||||
@@ -172,6 +175,7 @@ func init() {
|
||||
DeepCopy_v1_Volume,
|
||||
DeepCopy_v1_VolumeMount,
|
||||
DeepCopy_v1_VolumeSource,
|
||||
DeepCopy_v1_WeightedPodAffinityTerm,
|
||||
); err != nil {
|
||||
// if one of the deep copy functions is malformed, detect it immediately.
|
||||
panic(err)
|
||||
@@ -196,6 +200,24 @@ func DeepCopy_v1_Affinity(in Affinity, out *Affinity, c *conversion.Cloner) erro
|
||||
} else {
|
||||
out.NodeAffinity = nil
|
||||
}
|
||||
if in.PodAffinity != nil {
|
||||
in, out := in.PodAffinity, &out.PodAffinity
|
||||
*out = new(PodAffinity)
|
||||
if err := DeepCopy_v1_PodAffinity(*in, *out, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PodAffinity = nil
|
||||
}
|
||||
if in.PodAntiAffinity != nil {
|
||||
in, out := in.PodAntiAffinity, &out.PodAntiAffinity
|
||||
*out = new(PodAntiAffinity)
|
||||
if err := DeepCopy_v1_PodAntiAffinity(*in, *out, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.PodAntiAffinity = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1911,6 +1933,79 @@ func DeepCopy_v1_Pod(in Pod, out *Pod, c *conversion.Cloner) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_v1_PodAffinity(in PodAffinity, out *PodAffinity, c *conversion.Cloner) error {
|
||||
if in.RequiredDuringSchedulingIgnoredDuringExecution != nil {
|
||||
in, out := in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution
|
||||
*out = make([]PodAffinityTerm, len(in))
|
||||
for i := range in {
|
||||
if err := DeepCopy_v1_PodAffinityTerm(in[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.RequiredDuringSchedulingIgnoredDuringExecution = nil
|
||||
}
|
||||
if in.PreferredDuringSchedulingIgnoredDuringExecution != nil {
|
||||
in, out := in.PreferredDuringSchedulingIgnoredDuringExecution, &out.PreferredDuringSchedulingIgnoredDuringExecution
|
||||
*out = make([]WeightedPodAffinityTerm, len(in))
|
||||
for i := range in {
|
||||
if err := DeepCopy_v1_WeightedPodAffinityTerm(in[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.PreferredDuringSchedulingIgnoredDuringExecution = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_v1_PodAffinityTerm(in PodAffinityTerm, out *PodAffinityTerm, c *conversion.Cloner) error {
|
||||
if in.LabelSelector != nil {
|
||||
in, out := in.LabelSelector, &out.LabelSelector
|
||||
*out = new(unversioned.LabelSelector)
|
||||
if err := unversioned.DeepCopy_unversioned_LabelSelector(*in, *out, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.LabelSelector = nil
|
||||
}
|
||||
if in.Namespaces != nil {
|
||||
in, out := in.Namespaces, &out.Namespaces
|
||||
*out = make([]string, len(in))
|
||||
copy(*out, in)
|
||||
} else {
|
||||
out.Namespaces = nil
|
||||
}
|
||||
out.TopologyKey = in.TopologyKey
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_v1_PodAntiAffinity(in PodAntiAffinity, out *PodAntiAffinity, c *conversion.Cloner) error {
|
||||
if in.RequiredDuringSchedulingIgnoredDuringExecution != nil {
|
||||
in, out := in.RequiredDuringSchedulingIgnoredDuringExecution, &out.RequiredDuringSchedulingIgnoredDuringExecution
|
||||
*out = make([]PodAffinityTerm, len(in))
|
||||
for i := range in {
|
||||
if err := DeepCopy_v1_PodAffinityTerm(in[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.RequiredDuringSchedulingIgnoredDuringExecution = nil
|
||||
}
|
||||
if in.PreferredDuringSchedulingIgnoredDuringExecution != nil {
|
||||
in, out := in.PreferredDuringSchedulingIgnoredDuringExecution, &out.PreferredDuringSchedulingIgnoredDuringExecution
|
||||
*out = make([]WeightedPodAffinityTerm, len(in))
|
||||
for i := range in {
|
||||
if err := DeepCopy_v1_WeightedPodAffinityTerm(in[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.PreferredDuringSchedulingIgnoredDuringExecution = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_v1_PodAttachOptions(in PodAttachOptions, out *PodAttachOptions, c *conversion.Cloner) error {
|
||||
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
|
||||
return err
|
||||
@@ -2998,3 +3093,11 @@ func DeepCopy_v1_VolumeSource(in VolumeSource, out *VolumeSource, c *conversion.
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeepCopy_v1_WeightedPodAffinityTerm(in WeightedPodAffinityTerm, out *WeightedPodAffinityTerm, c *conversion.Cloner) error {
|
||||
out.Weight = in.Weight
|
||||
if err := DeepCopy_v1_PodAffinityTerm(in.PodAffinityTerm, &out.PodAffinityTerm, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user