| 1 | /* |
| 2 | Copyright The Kubernetes Authors. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // Code generated by applyconfiguration-gen. DO NOT EDIT. |
| 18 | |
| 19 | package v1 |
| 20 | |
| 21 | import ( |
| 22 | corev1 "k8s.io/api/core/v1" |
| 23 | metav1 "k8s.io/client-go/applyconfigurations/meta/v1" |
| 24 | ) |
| 25 | |
| 26 | // TopologySpreadConstraintApplyConfiguration represents a declarative configuration of the TopologySpreadConstraint type for use |
| 27 | // with apply. |
| 28 | type TopologySpreadConstraintApplyConfiguration struct { |
| 29 | MaxSkew *int32 `json:"maxSkew,omitempty"` |
| 30 | TopologyKey *string `json:"topologyKey,omitempty"` |
| 31 | WhenUnsatisfiable *corev1.UnsatisfiableConstraintAction `json:"whenUnsatisfiable,omitempty"` |
| 32 | LabelSelector *metav1.LabelSelectorApplyConfiguration `json:"labelSelector,omitempty"` |
| 33 | MinDomains *int32 `json:"minDomains,omitempty"` |
| 34 | NodeAffinityPolicy *corev1.NodeInclusionPolicy `json:"nodeAffinityPolicy,omitempty"` |
| 35 | NodeTaintsPolicy *corev1.NodeInclusionPolicy `json:"nodeTaintsPolicy,omitempty"` |
| 36 | MatchLabelKeys []string `json:"matchLabelKeys,omitempty"` |
| 37 | } |
| 38 | |
| 39 | // TopologySpreadConstraintApplyConfiguration constructs a declarative configuration of the TopologySpreadConstraint type for use with |
| 40 | // apply. |
| 41 | func TopologySpreadConstraint() *TopologySpreadConstraintApplyConfiguration { |
| 42 | return &TopologySpreadConstraintApplyConfiguration{} |
| 43 | } |
| 44 | |
| 45 | // WithMaxSkew sets the MaxSkew field in the declarative configuration to the given value |
| 46 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 47 | // If called multiple times, the MaxSkew field is set to the value of the last call. |
| 48 | func (b *TopologySpreadConstraintApplyConfiguration) WithMaxSkew(value int32) *TopologySpreadConstraintApplyConfiguration { |
| 49 | b.MaxSkew = &value |
| 50 | return b |
| 51 | } |
| 52 | |
| 53 | // WithTopologyKey sets the TopologyKey field in the declarative configuration to the given value |
| 54 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 55 | // If called multiple times, the TopologyKey field is set to the value of the last call. |
| 56 | func (b *TopologySpreadConstraintApplyConfiguration) WithTopologyKey(value string) *TopologySpreadConstraintApplyConfiguration { |
| 57 | b.TopologyKey = &value |
| 58 | return b |
| 59 | } |
| 60 | |
| 61 | // WithWhenUnsatisfiable sets the WhenUnsatisfiable field in the declarative configuration to the given value |
| 62 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 63 | // If called multiple times, the WhenUnsatisfiable field is set to the value of the last call. |
| 64 | func (b *TopologySpreadConstraintApplyConfiguration) WithWhenUnsatisfiable(value corev1.UnsatisfiableConstraintAction) *TopologySpreadConstraintApplyConfiguration { |
| 65 | b.WhenUnsatisfiable = &value |
| 66 | return b |
| 67 | } |
| 68 | |
| 69 | // WithLabelSelector sets the LabelSelector field in the declarative configuration to the given value |
| 70 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 71 | // If called multiple times, the LabelSelector field is set to the value of the last call. |
| 72 | func (b *TopologySpreadConstraintApplyConfiguration) WithLabelSelector(value *metav1.LabelSelectorApplyConfiguration) *TopologySpreadConstraintApplyConfiguration { |
| 73 | b.LabelSelector = value |
| 74 | return b |
| 75 | } |
| 76 | |
| 77 | // WithMinDomains sets the MinDomains field in the declarative configuration to the given value |
| 78 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 79 | // If called multiple times, the MinDomains field is set to the value of the last call. |
| 80 | func (b *TopologySpreadConstraintApplyConfiguration) WithMinDomains(value int32) *TopologySpreadConstraintApplyConfiguration { |
| 81 | b.MinDomains = &value |
| 82 | return b |
| 83 | } |
| 84 | |
| 85 | // WithNodeAffinityPolicy sets the NodeAffinityPolicy field in the declarative configuration to the given value |
| 86 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 87 | // If called multiple times, the NodeAffinityPolicy field is set to the value of the last call. |
| 88 | func (b *TopologySpreadConstraintApplyConfiguration) WithNodeAffinityPolicy(value corev1.NodeInclusionPolicy) *TopologySpreadConstraintApplyConfiguration { |
| 89 | b.NodeAffinityPolicy = &value |
| 90 | return b |
| 91 | } |
| 92 | |
| 93 | // WithNodeTaintsPolicy sets the NodeTaintsPolicy field in the declarative configuration to the given value |
| 94 | // and returns the receiver, so that objects can be built by chaining "With" function invocations. |
| 95 | // If called multiple times, the NodeTaintsPolicy field is set to the value of the last call. |
| 96 | func (b *TopologySpreadConstraintApplyConfiguration) WithNodeTaintsPolicy(value corev1.NodeInclusionPolicy) *TopologySpreadConstraintApplyConfiguration { |
| 97 | b.NodeTaintsPolicy = &value |
| 98 | return b |
| 99 | } |
| 100 | |
| 101 | // WithMatchLabelKeys adds the given value to the MatchLabelKeys field in the declarative configuration |
| 102 | // and returns the receiver, so that objects can be build by chaining "With" function invocations. |
| 103 | // If called multiple times, values provided by each call will be appended to the MatchLabelKeys field. |
| 104 | func (b *TopologySpreadConstraintApplyConfiguration) WithMatchLabelKeys(values ...string) *TopologySpreadConstraintApplyConfiguration { |
| 105 | for i := range values { |
| 106 | b.MatchLabelKeys = append(b.MatchLabelKeys, values[i]) |
| 107 | } |
| 108 | return b |
| 109 | } |