feature(scheduler): implement matchLabelKeys in PodAffinity and PodAntiAffinity

Kubernetes-commit: d5d3c26337af418555fe6f62f86b9aaf38dc59d3
This commit is contained in:
Kensei Nakada 2023-02-26 04:25:59 +00:00 committed by Kubernetes Publisher
parent 5f697abdfd
commit a46288252b
2 changed files with 34 additions and 0 deletions

View File

@ -29,6 +29,8 @@ type PodAffinityTermApplyConfiguration struct {
Namespaces []string `json:"namespaces,omitempty"`
TopologyKey *string `json:"topologyKey,omitempty"`
NamespaceSelector *v1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"`
MatchLabelKeys []string `json:"matchLabelKeys,omitempty"`
MismatchLabelKeys []string `json:"mismatchLabelKeys,omitempty"`
}
// PodAffinityTermApplyConfiguration constructs an declarative configuration of the PodAffinityTerm type for use with
@ -70,3 +72,23 @@ func (b *PodAffinityTermApplyConfiguration) WithNamespaceSelector(value *v1.Labe
b.NamespaceSelector = value
return b
}
// WithMatchLabelKeys adds the given value to the MatchLabelKeys field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the MatchLabelKeys field.
func (b *PodAffinityTermApplyConfiguration) WithMatchLabelKeys(values ...string) *PodAffinityTermApplyConfiguration {
for i := range values {
b.MatchLabelKeys = append(b.MatchLabelKeys, values[i])
}
return b
}
// WithMismatchLabelKeys adds the given value to the MismatchLabelKeys field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the MismatchLabelKeys field.
func (b *PodAffinityTermApplyConfiguration) WithMismatchLabelKeys(values ...string) *PodAffinityTermApplyConfiguration {
for i := range values {
b.MismatchLabelKeys = append(b.MismatchLabelKeys, values[i])
}
return b
}

View File

@ -6272,6 +6272,18 @@ var schemaYAML = typed.YAMLObject(`types:
- name: labelSelector
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector
- name: matchLabelKeys
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: mismatchLabelKeys
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: namespaceSelector
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector