1/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Code generated by applyconfiguration-gen. DO NOT EDIT.
18
19package v1
20
21import (
22	corev1 "k8s.io/api/core/v1"
23)
24
25// PodSpecApplyConfiguration represents an declarative configuration of the PodSpec type for use
26// with apply.
27type PodSpecApplyConfiguration struct {
28	Volumes                       []VolumeApplyConfiguration                   `json:"volumes,omitempty"`
29	InitContainers                []ContainerApplyConfiguration                `json:"initContainers,omitempty"`
30	Containers                    []ContainerApplyConfiguration                `json:"containers,omitempty"`
31	EphemeralContainers           []EphemeralContainerApplyConfiguration       `json:"ephemeralContainers,omitempty"`
32	RestartPolicy                 *corev1.RestartPolicy                        `json:"restartPolicy,omitempty"`
33	TerminationGracePeriodSeconds *int64                                       `json:"terminationGracePeriodSeconds,omitempty"`
34	ActiveDeadlineSeconds         *int64                                       `json:"activeDeadlineSeconds,omitempty"`
35	DNSPolicy                     *corev1.DNSPolicy                            `json:"dnsPolicy,omitempty"`
36	NodeSelector                  map[string]string                            `json:"nodeSelector,omitempty"`
37	ServiceAccountName            *string                                      `json:"serviceAccountName,omitempty"`
38	DeprecatedServiceAccount      *string                                      `json:"serviceAccount,omitempty"`
39	AutomountServiceAccountToken  *bool                                        `json:"automountServiceAccountToken,omitempty"`
40	NodeName                      *string                                      `json:"nodeName,omitempty"`
41	HostNetwork                   *bool                                        `json:"hostNetwork,omitempty"`
42	HostPID                       *bool                                        `json:"hostPID,omitempty"`
43	HostIPC                       *bool                                        `json:"hostIPC,omitempty"`
44	ShareProcessNamespace         *bool                                        `json:"shareProcessNamespace,omitempty"`
45	SecurityContext               *PodSecurityContextApplyConfiguration        `json:"securityContext,omitempty"`
46	ImagePullSecrets              []LocalObjectReferenceApplyConfiguration     `json:"imagePullSecrets,omitempty"`
47	Hostname                      *string                                      `json:"hostname,omitempty"`
48	Subdomain                     *string                                      `json:"subdomain,omitempty"`
49	Affinity                      *AffinityApplyConfiguration                  `json:"affinity,omitempty"`
50	SchedulerName                 *string                                      `json:"schedulerName,omitempty"`
51	Tolerations                   []TolerationApplyConfiguration               `json:"tolerations,omitempty"`
52	HostAliases                   []HostAliasApplyConfiguration                `json:"hostAliases,omitempty"`
53	PriorityClassName             *string                                      `json:"priorityClassName,omitempty"`
54	Priority                      *int32                                       `json:"priority,omitempty"`
55	DNSConfig                     *PodDNSConfigApplyConfiguration              `json:"dnsConfig,omitempty"`
56	ReadinessGates                []PodReadinessGateApplyConfiguration         `json:"readinessGates,omitempty"`
57	RuntimeClassName              *string                                      `json:"runtimeClassName,omitempty"`
58	EnableServiceLinks            *bool                                        `json:"enableServiceLinks,omitempty"`
59	PreemptionPolicy              *corev1.PreemptionPolicy                     `json:"preemptionPolicy,omitempty"`
60	Overhead                      *corev1.ResourceList                         `json:"overhead,omitempty"`
61	TopologySpreadConstraints     []TopologySpreadConstraintApplyConfiguration `json:"topologySpreadConstraints,omitempty"`
62	SetHostnameAsFQDN             *bool                                        `json:"setHostnameAsFQDN,omitempty"`
63}
64
65// PodSpecApplyConfiguration constructs an declarative configuration of the PodSpec type for use with
66// apply.
67func PodSpec() *PodSpecApplyConfiguration {
68	return &PodSpecApplyConfiguration{}
69}
70
71// WithVolumes adds the given value to the Volumes field in the declarative configuration
72// and returns the receiver, so that objects can be build by chaining "With" function invocations.
73// If called multiple times, values provided by each call will be appended to the Volumes field.
74func (b *PodSpecApplyConfiguration) WithVolumes(values ...*VolumeApplyConfiguration) *PodSpecApplyConfiguration {
75	for i := range values {
76		if values[i] == nil {
77			panic("nil value passed to WithVolumes")
78		}
79		b.Volumes = append(b.Volumes, *values[i])
80	}
81	return b
82}
83
84// WithInitContainers adds the given value to the InitContainers field in the declarative configuration
85// and returns the receiver, so that objects can be build by chaining "With" function invocations.
86// If called multiple times, values provided by each call will be appended to the InitContainers field.
87func (b *PodSpecApplyConfiguration) WithInitContainers(values ...*ContainerApplyConfiguration) *PodSpecApplyConfiguration {
88	for i := range values {
89		if values[i] == nil {
90			panic("nil value passed to WithInitContainers")
91		}
92		b.InitContainers = append(b.InitContainers, *values[i])
93	}
94	return b
95}
96
97// WithContainers adds the given value to the Containers field in the declarative configuration
98// and returns the receiver, so that objects can be build by chaining "With" function invocations.
99// If called multiple times, values provided by each call will be appended to the Containers field.
100func (b *PodSpecApplyConfiguration) WithContainers(values ...*ContainerApplyConfiguration) *PodSpecApplyConfiguration {
101	for i := range values {
102		if values[i] == nil {
103			panic("nil value passed to WithContainers")
104		}
105		b.Containers = append(b.Containers, *values[i])
106	}
107	return b
108}
109
110// WithEphemeralContainers adds the given value to the EphemeralContainers field in the declarative configuration
111// and returns the receiver, so that objects can be build by chaining "With" function invocations.
112// If called multiple times, values provided by each call will be appended to the EphemeralContainers field.
113func (b *PodSpecApplyConfiguration) WithEphemeralContainers(values ...*EphemeralContainerApplyConfiguration) *PodSpecApplyConfiguration {
114	for i := range values {
115		if values[i] == nil {
116			panic("nil value passed to WithEphemeralContainers")
117		}
118		b.EphemeralContainers = append(b.EphemeralContainers, *values[i])
119	}
120	return b
121}
122
123// WithRestartPolicy sets the RestartPolicy field in the declarative configuration to the given value
124// and returns the receiver, so that objects can be built by chaining "With" function invocations.
125// If called multiple times, the RestartPolicy field is set to the value of the last call.
126func (b *PodSpecApplyConfiguration) WithRestartPolicy(value corev1.RestartPolicy) *PodSpecApplyConfiguration {
127	b.RestartPolicy = &value
128	return b
129}
130
131// WithTerminationGracePeriodSeconds sets the TerminationGracePeriodSeconds field in the declarative configuration to the given value
132// and returns the receiver, so that objects can be built by chaining "With" function invocations.
133// If called multiple times, the TerminationGracePeriodSeconds field is set to the value of the last call.
134func (b *PodSpecApplyConfiguration) WithTerminationGracePeriodSeconds(value int64) *PodSpecApplyConfiguration {
135	b.TerminationGracePeriodSeconds = &value
136	return b
137}
138
139// WithActiveDeadlineSeconds sets the ActiveDeadlineSeconds field in the declarative configuration to the given value
140// and returns the receiver, so that objects can be built by chaining "With" function invocations.
141// If called multiple times, the ActiveDeadlineSeconds field is set to the value of the last call.
142func (b *PodSpecApplyConfiguration) WithActiveDeadlineSeconds(value int64) *PodSpecApplyConfiguration {
143	b.ActiveDeadlineSeconds = &value
144	return b
145}
146
147// WithDNSPolicy sets the DNSPolicy field in the declarative configuration to the given value
148// and returns the receiver, so that objects can be built by chaining "With" function invocations.
149// If called multiple times, the DNSPolicy field is set to the value of the last call.
150func (b *PodSpecApplyConfiguration) WithDNSPolicy(value corev1.DNSPolicy) *PodSpecApplyConfiguration {
151	b.DNSPolicy = &value
152	return b
153}
154
155// WithNodeSelector puts the entries into the NodeSelector field in the declarative configuration
156// and returns the receiver, so that objects can be build by chaining "With" function invocations.
157// If called multiple times, the entries provided by each call will be put on the NodeSelector field,
158// overwriting an existing map entries in NodeSelector field with the same key.
159func (b *PodSpecApplyConfiguration) WithNodeSelector(entries map[string]string) *PodSpecApplyConfiguration {
160	if b.NodeSelector == nil && len(entries) > 0 {
161		b.NodeSelector = make(map[string]string, len(entries))
162	}
163	for k, v := range entries {
164		b.NodeSelector[k] = v
165	}
166	return b
167}
168
169// WithServiceAccountName sets the ServiceAccountName field in the declarative configuration to the given value
170// and returns the receiver, so that objects can be built by chaining "With" function invocations.
171// If called multiple times, the ServiceAccountName field is set to the value of the last call.
172func (b *PodSpecApplyConfiguration) WithServiceAccountName(value string) *PodSpecApplyConfiguration {
173	b.ServiceAccountName = &value
174	return b
175}
176
177// WithDeprecatedServiceAccount sets the DeprecatedServiceAccount field in the declarative configuration to the given value
178// and returns the receiver, so that objects can be built by chaining "With" function invocations.
179// If called multiple times, the DeprecatedServiceAccount field is set to the value of the last call.
180func (b *PodSpecApplyConfiguration) WithDeprecatedServiceAccount(value string) *PodSpecApplyConfiguration {
181	b.DeprecatedServiceAccount = &value
182	return b
183}
184
185// WithAutomountServiceAccountToken sets the AutomountServiceAccountToken field in the declarative configuration to the given value
186// and returns the receiver, so that objects can be built by chaining "With" function invocations.
187// If called multiple times, the AutomountServiceAccountToken field is set to the value of the last call.
188func (b *PodSpecApplyConfiguration) WithAutomountServiceAccountToken(value bool) *PodSpecApplyConfiguration {
189	b.AutomountServiceAccountToken = &value
190	return b
191}
192
193// WithNodeName sets the NodeName field in the declarative configuration to the given value
194// and returns the receiver, so that objects can be built by chaining "With" function invocations.
195// If called multiple times, the NodeName field is set to the value of the last call.
196func (b *PodSpecApplyConfiguration) WithNodeName(value string) *PodSpecApplyConfiguration {
197	b.NodeName = &value
198	return b
199}
200
201// WithHostNetwork sets the HostNetwork field in the declarative configuration to the given value
202// and returns the receiver, so that objects can be built by chaining "With" function invocations.
203// If called multiple times, the HostNetwork field is set to the value of the last call.
204func (b *PodSpecApplyConfiguration) WithHostNetwork(value bool) *PodSpecApplyConfiguration {
205	b.HostNetwork = &value
206	return b
207}
208
209// WithHostPID sets the HostPID field in the declarative configuration to the given value
210// and returns the receiver, so that objects can be built by chaining "With" function invocations.
211// If called multiple times, the HostPID field is set to the value of the last call.
212func (b *PodSpecApplyConfiguration) WithHostPID(value bool) *PodSpecApplyConfiguration {
213	b.HostPID = &value
214	return b
215}
216
217// WithHostIPC sets the HostIPC field in the declarative configuration to the given value
218// and returns the receiver, so that objects can be built by chaining "With" function invocations.
219// If called multiple times, the HostIPC field is set to the value of the last call.
220func (b *PodSpecApplyConfiguration) WithHostIPC(value bool) *PodSpecApplyConfiguration {
221	b.HostIPC = &value
222	return b
223}
224
225// WithShareProcessNamespace sets the ShareProcessNamespace field in the declarative configuration to the given value
226// and returns the receiver, so that objects can be built by chaining "With" function invocations.
227// If called multiple times, the ShareProcessNamespace field is set to the value of the last call.
228func (b *PodSpecApplyConfiguration) WithShareProcessNamespace(value bool) *PodSpecApplyConfiguration {
229	b.ShareProcessNamespace = &value
230	return b
231}
232
233// WithSecurityContext sets the SecurityContext field in the declarative configuration to the given value
234// and returns the receiver, so that objects can be built by chaining "With" function invocations.
235// If called multiple times, the SecurityContext field is set to the value of the last call.
236func (b *PodSpecApplyConfiguration) WithSecurityContext(value *PodSecurityContextApplyConfiguration) *PodSpecApplyConfiguration {
237	b.SecurityContext = value
238	return b
239}
240
241// WithImagePullSecrets adds the given value to the ImagePullSecrets field in the declarative configuration
242// and returns the receiver, so that objects can be build by chaining "With" function invocations.
243// If called multiple times, values provided by each call will be appended to the ImagePullSecrets field.
244func (b *PodSpecApplyConfiguration) WithImagePullSecrets(values ...*LocalObjectReferenceApplyConfiguration) *PodSpecApplyConfiguration {
245	for i := range values {
246		if values[i] == nil {
247			panic("nil value passed to WithImagePullSecrets")
248		}
249		b.ImagePullSecrets = append(b.ImagePullSecrets, *values[i])
250	}
251	return b
252}
253
254// WithHostname sets the Hostname field in the declarative configuration to the given value
255// and returns the receiver, so that objects can be built by chaining "With" function invocations.
256// If called multiple times, the Hostname field is set to the value of the last call.
257func (b *PodSpecApplyConfiguration) WithHostname(value string) *PodSpecApplyConfiguration {
258	b.Hostname = &value
259	return b
260}
261
262// WithSubdomain sets the Subdomain field in the declarative configuration to the given value
263// and returns the receiver, so that objects can be built by chaining "With" function invocations.
264// If called multiple times, the Subdomain field is set to the value of the last call.
265func (b *PodSpecApplyConfiguration) WithSubdomain(value string) *PodSpecApplyConfiguration {
266	b.Subdomain = &value
267	return b
268}
269
270// WithAffinity sets the Affinity field in the declarative configuration to the given value
271// and returns the receiver, so that objects can be built by chaining "With" function invocations.
272// If called multiple times, the Affinity field is set to the value of the last call.
273func (b *PodSpecApplyConfiguration) WithAffinity(value *AffinityApplyConfiguration) *PodSpecApplyConfiguration {
274	b.Affinity = value
275	return b
276}
277
278// WithSchedulerName sets the SchedulerName field in the declarative configuration to the given value
279// and returns the receiver, so that objects can be built by chaining "With" function invocations.
280// If called multiple times, the SchedulerName field is set to the value of the last call.
281func (b *PodSpecApplyConfiguration) WithSchedulerName(value string) *PodSpecApplyConfiguration {
282	b.SchedulerName = &value
283	return b
284}
285
286// WithTolerations adds the given value to the Tolerations field in the declarative configuration
287// and returns the receiver, so that objects can be build by chaining "With" function invocations.
288// If called multiple times, values provided by each call will be appended to the Tolerations field.
289func (b *PodSpecApplyConfiguration) WithTolerations(values ...*TolerationApplyConfiguration) *PodSpecApplyConfiguration {
290	for i := range values {
291		if values[i] == nil {
292			panic("nil value passed to WithTolerations")
293		}
294		b.Tolerations = append(b.Tolerations, *values[i])
295	}
296	return b
297}
298
299// WithHostAliases adds the given value to the HostAliases field in the declarative configuration
300// and returns the receiver, so that objects can be build by chaining "With" function invocations.
301// If called multiple times, values provided by each call will be appended to the HostAliases field.
302func (b *PodSpecApplyConfiguration) WithHostAliases(values ...*HostAliasApplyConfiguration) *PodSpecApplyConfiguration {
303	for i := range values {
304		if values[i] == nil {
305			panic("nil value passed to WithHostAliases")
306		}
307		b.HostAliases = append(b.HostAliases, *values[i])
308	}
309	return b
310}
311
312// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value
313// and returns the receiver, so that objects can be built by chaining "With" function invocations.
314// If called multiple times, the PriorityClassName field is set to the value of the last call.
315func (b *PodSpecApplyConfiguration) WithPriorityClassName(value string) *PodSpecApplyConfiguration {
316	b.PriorityClassName = &value
317	return b
318}
319
320// WithPriority sets the Priority field in the declarative configuration to the given value
321// and returns the receiver, so that objects can be built by chaining "With" function invocations.
322// If called multiple times, the Priority field is set to the value of the last call.
323func (b *PodSpecApplyConfiguration) WithPriority(value int32) *PodSpecApplyConfiguration {
324	b.Priority = &value
325	return b
326}
327
328// WithDNSConfig sets the DNSConfig field in the declarative configuration to the given value
329// and returns the receiver, so that objects can be built by chaining "With" function invocations.
330// If called multiple times, the DNSConfig field is set to the value of the last call.
331func (b *PodSpecApplyConfiguration) WithDNSConfig(value *PodDNSConfigApplyConfiguration) *PodSpecApplyConfiguration {
332	b.DNSConfig = value
333	return b
334}
335
336// WithReadinessGates adds the given value to the ReadinessGates field in the declarative configuration
337// and returns the receiver, so that objects can be build by chaining "With" function invocations.
338// If called multiple times, values provided by each call will be appended to the ReadinessGates field.
339func (b *PodSpecApplyConfiguration) WithReadinessGates(values ...*PodReadinessGateApplyConfiguration) *PodSpecApplyConfiguration {
340	for i := range values {
341		if values[i] == nil {
342			panic("nil value passed to WithReadinessGates")
343		}
344		b.ReadinessGates = append(b.ReadinessGates, *values[i])
345	}
346	return b
347}
348
349// WithRuntimeClassName sets the RuntimeClassName field in the declarative configuration to the given value
350// and returns the receiver, so that objects can be built by chaining "With" function invocations.
351// If called multiple times, the RuntimeClassName field is set to the value of the last call.
352func (b *PodSpecApplyConfiguration) WithRuntimeClassName(value string) *PodSpecApplyConfiguration {
353	b.RuntimeClassName = &value
354	return b
355}
356
357// WithEnableServiceLinks sets the EnableServiceLinks field in the declarative configuration to the given value
358// and returns the receiver, so that objects can be built by chaining "With" function invocations.
359// If called multiple times, the EnableServiceLinks field is set to the value of the last call.
360func (b *PodSpecApplyConfiguration) WithEnableServiceLinks(value bool) *PodSpecApplyConfiguration {
361	b.EnableServiceLinks = &value
362	return b
363}
364
365// WithPreemptionPolicy sets the PreemptionPolicy field in the declarative configuration to the given value
366// and returns the receiver, so that objects can be built by chaining "With" function invocations.
367// If called multiple times, the PreemptionPolicy field is set to the value of the last call.
368func (b *PodSpecApplyConfiguration) WithPreemptionPolicy(value corev1.PreemptionPolicy) *PodSpecApplyConfiguration {
369	b.PreemptionPolicy = &value
370	return b
371}
372
373// WithOverhead sets the Overhead field in the declarative configuration to the given value
374// and returns the receiver, so that objects can be built by chaining "With" function invocations.
375// If called multiple times, the Overhead field is set to the value of the last call.
376func (b *PodSpecApplyConfiguration) WithOverhead(value corev1.ResourceList) *PodSpecApplyConfiguration {
377	b.Overhead = &value
378	return b
379}
380
381// WithTopologySpreadConstraints adds the given value to the TopologySpreadConstraints field in the declarative configuration
382// and returns the receiver, so that objects can be build by chaining "With" function invocations.
383// If called multiple times, values provided by each call will be appended to the TopologySpreadConstraints field.
384func (b *PodSpecApplyConfiguration) WithTopologySpreadConstraints(values ...*TopologySpreadConstraintApplyConfiguration) *PodSpecApplyConfiguration {
385	for i := range values {
386		if values[i] == nil {
387			panic("nil value passed to WithTopologySpreadConstraints")
388		}
389		b.TopologySpreadConstraints = append(b.TopologySpreadConstraints, *values[i])
390	}
391	return b
392}
393
394// WithSetHostnameAsFQDN sets the SetHostnameAsFQDN field in the declarative configuration to the given value
395// and returns the receiver, so that objects can be built by chaining "With" function invocations.
396// If called multiple times, the SetHostnameAsFQDN field is set to the value of the last call.
397func (b *PodSpecApplyConfiguration) WithSetHostnameAsFQDN(value bool) *PodSpecApplyConfiguration {
398	b.SetHostnameAsFQDN = &value
399	return b
400}
401