1from pydantic import BaseModel, ConfigDict, Field
2from typing import Optional, List, Dict, Union
3
4
[docs]
5class Conditions(BaseModel):
6 """JobCondition describes current state of a job."""
7
8 model_config = ConfigDict(extra="forbid")
9
10 lastProbeTime: Optional[str] = Field(
11 default=None,
12 alias="last_probe_time",
13 description="Last time the condition was checked.",
14 )
15 lastTransitionTime: Optional[str] = Field(
16 default=None,
17 alias="last_transition_time",
18 description="Last time the condition transit from one status to another.",
19 )
20 message: Optional[str] = Field(
21 default=None,
22 description="Human readable message indicating details about last transition.",
23 )
24 reason: Optional[str] = Field(
25 default=None, description="(brief) reason for the condition's last transition."
26 )
27 status: str = Field(
28 description="Status of the condition, one of True, False, Unknown."
29 )
30 type: str = Field(description="Type of job condition, Complete or Failed.")
31
32
[docs]
33class JobPods(BaseModel):
34 """ObjectReference contains enough information to let you inspect or modify the referred object."""
35
36 model_config = ConfigDict(extra="forbid")
37
38 apiVersion: Optional[str] = Field(
39 default=None, alias="api_version", description="API version of the referent."
40 )
41 fieldPath: Optional[str] = Field(
42 default=None,
43 alias="field_path",
44 description='If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.',
45 )
46 kind: Optional[str] = Field(
47 default=None,
48 description="Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
49 )
50 name: Optional[str] = Field(
51 default=None,
52 description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
53 )
54 namespace: Optional[str] = Field(
55 default=None,
56 description="Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/",
57 )
58 resourceVersion: Optional[str] = Field(
59 default=None,
60 alias="resource_version",
61 description="Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
62 )
63 uid: Optional[str] = Field(
64 default=None,
65 description="UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids",
66 )
67
68
[docs]
69class ManagerPods(BaseModel):
70 """Pod Manager pods"""
71
72 model_config = ConfigDict(extra="forbid")
73
74 apiVersion: Optional[str] = Field(
75 default=None, alias="api_version", description="API version of the referent."
76 )
77 fieldPath: Optional[str] = Field(
78 default=None,
79 alias="field_path",
80 description='If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.',
81 )
82 kind: Optional[str] = Field(
83 default=None,
84 description="Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
85 )
86 name: Optional[str] = Field(
87 default=None,
88 description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
89 )
90 namespace: Optional[str] = Field(
91 default=None,
92 description="Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/",
93 )
94 resourceVersion: Optional[str] = Field(
95 default=None,
96 alias="resource_version",
97 description="Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
98 )
99 uid: Optional[str] = Field(
100 default=None,
101 description="UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids",
102 )
103
104
[docs]
105class PodManagerStatuses(BaseModel):
106 """ObjectReference contains enough information to let you inspect or modify the referred object."""
107
108 model_config = ConfigDict(extra="forbid")
109
110 apiVersion: Optional[str] = Field(
111 default=None, alias="api_version", description="API version of the referent."
112 )
113 fieldPath: Optional[str] = Field(
114 default=None,
115 alias="field_path",
116 description='If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.',
117 )
118 kind: Optional[str] = Field(
119 default=None,
120 description="Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
121 )
122 name: Optional[str] = Field(
123 default=None,
124 description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
125 )
126 namespace: Optional[str] = Field(
127 default=None,
128 description="Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/",
129 )
130 resourceVersion: Optional[str] = Field(
131 default=None,
132 alias="resource_version",
133 description="Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
134 )
135 uid: Optional[str] = Field(
136 default=None,
137 description="UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids",
138 )
139
140
[docs]
141class Tolerations(BaseModel):
142 """The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator <operator>."""
143
144 model_config = ConfigDict(extra="forbid")
145
146 effect: Optional[str] = Field(
147 default=None,
148 description="Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.",
149 )
150 key: Optional[str] = Field(
151 default=None,
152 description="Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.",
153 )
154 operator: Optional[str] = Field(
155 default=None,
156 description="Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.",
157 )
158 tolerationSeconds: Optional[int] = Field(
159 default=None,
160 alias="toleration_seconds",
161 description="TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.",
162 )
163 value: Optional[str] = Field(
164 default=None,
165 description="Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.",
166 )
167
168
[docs]
169class PodSetInfo(BaseModel):
170 """DEPRECATED podSetInfo to include pod set information provided by Kueue in podSetInfos PodSetInformation assigned to the HyperPodPytorchJob's PodSet by Kueue podSetInfo is retained here to support operator upgrade"""
171
172 model_config = ConfigDict(extra="forbid")
173
174 annotations: Optional[Dict[str, str]] = Field(
175 default=None, description="Annotations to be added to the PodSpecTemplate"
176 )
177 labels: Optional[Dict[str, str]] = Field(
178 default=None, description="Labels to be added to the PodSepcTemplate"
179 )
180 nodeSelector: Optional[Dict[str, str]] = Field(
181 default=None,
182 alias="node_selector",
183 description="NodeSelectors to be added to the PodSpecTemplate",
184 )
185 tolerations: Optional[List[Tolerations]] = Field(
186 default=None, description="Tolerations to be added to the PodSpecTemplate"
187 )
188
189
[docs]
190class PodSetInfos(BaseModel):
191 """PodSetInformation contains the data that Kueue wants to inject into an admitted PodSpecTemplate"""
192
193 model_config = ConfigDict(extra="forbid")
194
195 annotations: Optional[Dict[str, str]] = Field(
196 default=None, description="Annotations to be added to the PodSpecTemplate"
197 )
198 labels: Optional[Dict[str, str]] = Field(
199 default=None, description="Labels to be added to the PodSepcTemplate"
200 )
201 nodeSelector: Optional[Dict[str, str]] = Field(
202 default=None,
203 alias="node_selector",
204 description="NodeSelectors to be added to the PodSpecTemplate",
205 )
206 tolerations: Optional[List[Tolerations]] = Field(
207 default=None, description="Tolerations to be added to the PodSpecTemplate"
208 )
209
210
221
222
[docs]
223class MatchExpressions(BaseModel):
224 """A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values."""
225
226 model_config = ConfigDict(extra="forbid")
227
228 key: str = Field(description="The label key that the selector applies to.")
229 operator: str = Field(
230 description="Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt."
231 )
232 values: Optional[List[str]] = Field(
233 default=None,
234 description="An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.",
235 )
236
237
[docs]
238class MatchFields(BaseModel):
239 """A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values."""
240
241 model_config = ConfigDict(extra="forbid")
242
243 key: str = Field(description="The label key that the selector applies to.")
244 operator: str = Field(
245 description="Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt."
246 )
247 values: Optional[List[str]] = Field(
248 default=None,
249 description="An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.",
250 )
251
252
[docs]
253class Preference(BaseModel):
254 """A node selector term, associated with the corresponding weight."""
255
256 model_config = ConfigDict(extra="forbid")
257
258 matchExpressions: Optional[List[MatchExpressions]] = Field(
259 default=None,
260 alias="match_expressions",
261 description="A list of node selector requirements by node's labels.",
262 )
263 matchFields: Optional[List[MatchFields]] = Field(
264 default=None,
265 alias="match_fields",
266 description="A list of node selector requirements by node's fields.",
267 )
268
269
[docs]
270class PreferredDuringSchedulingIgnoredDuringExecution(BaseModel):
271 """An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op)."""
272
273 model_config = ConfigDict(extra="forbid")
274
275 preference: Preference = Field(
276 description="A node selector term, associated with the corresponding weight."
277 )
278 weight: int = Field(
279 description="Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100."
280 )
281
282
[docs]
283class NodeSelectorTerms(BaseModel):
284 """A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm."""
285
286 model_config = ConfigDict(extra="forbid")
287
288 matchExpressions: Optional[List[MatchExpressions]] = Field(
289 default=None,
290 alias="match_expressions",
291 description="A list of node selector requirements by node's labels.",
292 )
293 matchFields: Optional[List[MatchFields]] = Field(
294 default=None,
295 alias="match_fields",
296 description="A list of node selector requirements by node's fields.",
297 )
298
299
[docs]
300class RequiredDuringSchedulingIgnoredDuringExecution(BaseModel):
301 """If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node."""
302
303 model_config = ConfigDict(extra="forbid")
304
305 nodeSelectorTerms: List[NodeSelectorTerms] = Field(
306 alias="node_selector_terms",
307 description="Required. A list of node selector terms. The terms are ORed.",
308 )
309
310
[docs]
311class NodeAffinity(BaseModel):
312 """Describes node affinity scheduling rules for the pod."""
313
314 model_config = ConfigDict(extra="forbid")
315
316 preferredDuringSchedulingIgnoredDuringExecution: Optional[
317 List[PreferredDuringSchedulingIgnoredDuringExecution]
318 ] = Field(
319 default=None,
320 alias="preferred_during_scheduling_ignored_during_execution",
321 description='The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.',
322 )
323 requiredDuringSchedulingIgnoredDuringExecution: Optional[
324 RequiredDuringSchedulingIgnoredDuringExecution
325 ] = Field(
326 default=None,
327 alias="required_during_scheduling_ignored_during_execution",
328 description="If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.",
329 )
330
331
[docs]
332class PodAffinity(BaseModel):
333 """Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s))."""
334
335 model_config = ConfigDict(extra="forbid")
336
337 preferredDuringSchedulingIgnoredDuringExecution: Optional[
338 List[PreferredDuringSchedulingIgnoredDuringExecution]
339 ] = Field(
340 default=None,
341 alias="preferred_during_scheduling_ignored_during_execution",
342 description='The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.',
343 )
344 requiredDuringSchedulingIgnoredDuringExecution: Optional[
345 List[RequiredDuringSchedulingIgnoredDuringExecution]
346 ] = Field(
347 default=None,
348 alias="required_during_scheduling_ignored_during_execution",
349 description="If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
350 )
351
352
[docs]
353class PodAntiAffinity(BaseModel):
354 """Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s))."""
355
356 model_config = ConfigDict(extra="forbid")
357
358 preferredDuringSchedulingIgnoredDuringExecution: Optional[
359 List[PreferredDuringSchedulingIgnoredDuringExecution]
360 ] = Field(
361 default=None,
362 alias="preferred_during_scheduling_ignored_during_execution",
363 description='The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.',
364 )
365 requiredDuringSchedulingIgnoredDuringExecution: Optional[
366 List[RequiredDuringSchedulingIgnoredDuringExecution]
367 ] = Field(
368 default=None,
369 alias="required_during_scheduling_ignored_during_execution",
370 description="If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.",
371 )
372
373
[docs]
374class Affinity(BaseModel):
375 """If specified, the pod's scheduling constraints"""
376
377 model_config = ConfigDict(extra="forbid")
378
379 nodeAffinity: Optional[NodeAffinity] = Field(
380 default=None,
381 alias="node_affinity",
382 description="Describes node affinity scheduling rules for the pod.",
383 )
384 podAffinity: Optional[PodAffinity] = Field(
385 default=None,
386 alias="pod_affinity",
387 description="Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).",
388 )
389 podAntiAffinity: Optional[PodAntiAffinity] = Field(
390 default=None,
391 alias="pod_anti_affinity",
392 description="Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).",
393 )
394
395
[docs]
396class ConfigMapKeyRef(BaseModel):
397 """Selects a key of a ConfigMap."""
398
399 model_config = ConfigDict(extra="forbid")
400
401 key: str = Field(description="The key to select.")
402 name: Optional[str] = Field(
403 default="",
404 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
405 )
406 optional: Optional[bool] = Field(
407 default=None,
408 description="Specify whether the ConfigMap or its key must be defined",
409 )
410
411
[docs]
412class FieldRef(BaseModel):
413 """Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs."""
414
415 model_config = ConfigDict(extra="forbid")
416
417 apiVersion: Optional[str] = Field(
418 default=None,
419 alias="api_version",
420 description='Version of the schema the FieldPath is written in terms of, defaults to "v1".',
421 )
422 fieldPath: str = Field(
423 alias="field_path",
424 description="Path of the field to select in the specified API version.",
425 )
426
427
[docs]
428class ResourceFieldRef(BaseModel):
429 """Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported."""
430
431 model_config = ConfigDict(extra="forbid")
432
433 containerName: Optional[str] = Field(
434 default=None,
435 alias="container_name",
436 description="Container name: required for volumes, optional for env vars",
437 )
438 divisor: Optional[Union[int, str]] = Field(
439 default=None,
440 description='Specifies the output format of the exposed resources, defaults to "1"',
441 )
442 resource: str = Field(description="Required: resource to select")
443
444
[docs]
445class SecretKeyRef(BaseModel):
446 """Selects a key of a secret in the pod's namespace"""
447
448 model_config = ConfigDict(extra="forbid")
449
450 key: str = Field(
451 description="The key of the secret to select from. Must be a valid secret key."
452 )
453 name: Optional[str] = Field(
454 default="",
455 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
456 )
457 optional: Optional[bool] = Field(
458 default=None,
459 description="Specify whether the Secret or its key must be defined",
460 )
461
462
[docs]
463class ValueFrom(BaseModel):
464 """Source for the environment variable's value. Cannot be used if value is not empty."""
465
466 model_config = ConfigDict(extra="forbid")
467
468 configMapKeyRef: Optional[ConfigMapKeyRef] = Field(
469 default=None,
470 alias="config_map_key_ref",
471 description="Selects a key of a ConfigMap.",
472 )
473 fieldRef: Optional[FieldRef] = Field(
474 default=None,
475 alias="field_ref",
476 description="Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.",
477 )
478 resourceFieldRef: Optional[ResourceFieldRef] = Field(
479 default=None,
480 alias="resource_field_ref",
481 description="Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.",
482 )
483 secretKeyRef: Optional[SecretKeyRef] = Field(
484 default=None,
485 alias="secret_key_ref",
486 description="Selects a key of a secret in the pod's namespace",
487 )
488
489
[docs]
490class Env(BaseModel):
491 """EnvVar represents an environment variable present in a Container."""
492
493 model_config = ConfigDict(extra="forbid")
494
495 name: str = Field(
496 description="Name of the environment variable. Must be a C_IDENTIFIER."
497 )
498 value: Optional[str] = Field(
499 default=None,
500 description='Variable references $(VAR_NAME) are expanded using the previously defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "".',
501 )
502 valueFrom: Optional[ValueFrom] = Field(
503 default=None,
504 alias="value_from",
505 description="Source for the environment variable's value. Cannot be used if value is not empty.",
506 )
507
508
[docs]
509class ConfigMapRef(BaseModel):
510 """The ConfigMap to select from"""
511
512 model_config = ConfigDict(extra="forbid")
513
514 name: Optional[str] = Field(
515 default="",
516 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
517 )
518 optional: Optional[bool] = Field(
519 default=None, description="Specify whether the ConfigMap must be defined"
520 )
521
522
[docs]
523class SecretRef(BaseModel):
524 """The Secret to select from"""
525
526 model_config = ConfigDict(extra="forbid")
527
528 name: Optional[str] = Field(
529 default="",
530 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
531 )
532 optional: Optional[bool] = Field(
533 default=None, description="Specify whether the Secret must be defined"
534 )
535
536
[docs]
537class EnvFrom(BaseModel):
538 """EnvFromSource represents the source of a set of ConfigMaps"""
539
540 model_config = ConfigDict(extra="forbid")
541
542 configMapRef: Optional[ConfigMapRef] = Field(
543 default=None, alias="config_map_ref", description="The ConfigMap to select from"
544 )
545 prefix: Optional[str] = Field(
546 default=None,
547 description="An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.",
548 )
549 secretRef: Optional[SecretRef] = Field(
550 default=None, alias="secret_ref", description="The Secret to select from"
551 )
552
553
[docs]
554class Exec(BaseModel):
555 """Exec specifies the action to take."""
556
557 model_config = ConfigDict(extra="forbid")
558
559 command: Optional[List[str]] = Field(
560 default=None,
561 description="Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.",
562 )
563
564
574
575
[docs]
576class HttpGet(BaseModel):
577 """HTTPGet specifies the http request to perform."""
578
579 model_config = ConfigDict(extra="forbid")
580
581 host: Optional[str] = Field(
582 default=None,
583 description='Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead.',
584 )
585 httpHeaders: Optional[List[HttpHeaders]] = Field(
586 default=None,
587 alias="http_headers",
588 description="Custom headers to set in the request. HTTP allows repeated headers.",
589 )
590 path: Optional[str] = Field(
591 default=None, description="Path to access on the HTTP server."
592 )
593 port: Union[int, str] = Field(
594 description="Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME."
595 )
596 scheme: Optional[str] = Field(
597 default=None,
598 description="Scheme to use for connecting to the host. Defaults to HTTP.",
599 )
600
601
[docs]
602class Sleep(BaseModel):
603 """Sleep represents the duration that the container should sleep before being terminated."""
604
605 model_config = ConfigDict(extra="forbid")
606
607 seconds: int = Field(description="Seconds is the number of seconds to sleep.")
608
609
[docs]
610class TcpSocket(BaseModel):
611 """Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified."""
612
613 model_config = ConfigDict(extra="forbid")
614
615 host: Optional[str] = Field(
616 default=None,
617 description="Optional: Host name to connect to, defaults to the pod IP.",
618 )
619 port: Union[int, str] = Field(
620 description="Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME."
621 )
622
623
[docs]
624class PostStart(BaseModel):
625 """PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"""
626
627 model_config = ConfigDict(extra="forbid")
628
629 exec: Optional[Exec] = Field(
630 default=None, description="Exec specifies the action to take."
631 )
632 httpGet: Optional[HttpGet] = Field(
633 default=None,
634 alias="http_get",
635 description="HTTPGet specifies the http request to perform.",
636 )
637 sleep: Optional[Sleep] = Field(
638 default=None,
639 description="Sleep represents the duration that the container should sleep before being terminated.",
640 )
641 tcpSocket: Optional[TcpSocket] = Field(
642 default=None,
643 alias="tcp_socket",
644 description="Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified.",
645 )
646
647
[docs]
648class PreStop(BaseModel):
649 """PreStop is called immediately before a container is terminated due to an API request or management event such as liveness/startup probe failure, preemption, resource contention, etc. The handler is not called if the container crashes or exits. The Pod's termination grace period countdown begins before the PreStop hook is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period (unless delayed by finalizers). Other management of the container blocks until the hook completes or until the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"""
650
651 model_config = ConfigDict(extra="forbid")
652
653 exec: Optional[Exec] = Field(
654 default=None, description="Exec specifies the action to take."
655 )
656 httpGet: Optional[HttpGet] = Field(
657 default=None,
658 alias="http_get",
659 description="HTTPGet specifies the http request to perform.",
660 )
661 sleep: Optional[Sleep] = Field(
662 default=None,
663 description="Sleep represents the duration that the container should sleep before being terminated.",
664 )
665 tcpSocket: Optional[TcpSocket] = Field(
666 default=None,
667 alias="tcp_socket",
668 description="Deprecated. TCPSocket is NOT supported as a LifecycleHandler and kept for the backward compatibility. There are no validation of this field and lifecycle hooks will fail in runtime when tcp handler is specified.",
669 )
670
671
[docs]
672class Lifecycle(BaseModel):
673 """Actions that the management system should take in response to container lifecycle events. Cannot be updated."""
674
675 model_config = ConfigDict(extra="forbid")
676
677 postStart: Optional[PostStart] = Field(
678 default=None,
679 alias="post_start",
680 description="PostStart is called immediately after a container is created. If the handler fails, the container is terminated and restarted according to its restart policy. Other management of the container blocks until the hook completes. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks",
681 )
682 preStop: Optional[PreStop] = Field(
683 default=None,
684 alias="pre_stop",
685 description="PreStop is called immediately before a container is terminated due to an API request or management event such as liveness/startup probe failure, preemption, resource contention, etc. The handler is not called if the container crashes or exits. The Pod's termination grace period countdown begins before the PreStop hook is executed. Regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period (unless delayed by finalizers). Other management of the container blocks until the hook completes or until the termination grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks",
686 )
687
688
[docs]
689class Grpc(BaseModel):
690 """GRPC specifies an action involving a GRPC port."""
691
692 model_config = ConfigDict(extra="forbid")
693
694 port: int = Field(
695 description="Port number of the gRPC service. Number must be in the range 1 to 65535."
696 )
697 service: Optional[str] = Field(
698 default="",
699 description="Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). If this is not specified, the default behavior is defined by gRPC.",
700 )
701
702
[docs]
703class LivenessProbe(BaseModel):
704 """Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"""
705
706 model_config = ConfigDict(extra="forbid")
707
708 exec: Optional[Exec] = Field(
709 default=None, description="Exec specifies the action to take."
710 )
711 failureThreshold: Optional[int] = Field(
712 default=None,
713 alias="failure_threshold",
714 description="Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.",
715 )
716 grpc: Optional[Grpc] = Field(
717 default=None, description="GRPC specifies an action involving a GRPC port."
718 )
719 httpGet: Optional[HttpGet] = Field(
720 default=None,
721 alias="http_get",
722 description="HTTPGet specifies the http request to perform.",
723 )
724 initialDelaySeconds: Optional[int] = Field(
725 default=None,
726 alias="initial_delay_seconds",
727 description="Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
728 )
729 periodSeconds: Optional[int] = Field(
730 default=None,
731 alias="period_seconds",
732 description="How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.",
733 )
734 successThreshold: Optional[int] = Field(
735 default=None,
736 alias="success_threshold",
737 description="Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.",
738 )
739 tcpSocket: Optional[TcpSocket] = Field(
740 default=None,
741 alias="tcp_socket",
742 description="TCPSocket specifies an action involving a TCP port.",
743 )
744 terminationGracePeriodSeconds: Optional[int] = Field(
745 default=None,
746 alias="termination_grace_period_seconds",
747 description="Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.",
748 )
749 timeoutSeconds: Optional[int] = Field(
750 default=None,
751 alias="timeout_seconds",
752 description="Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
753 )
754
755
[docs]
756class Ports(BaseModel):
757 """ContainerPort represents a network port in a single container."""
758
759 model_config = ConfigDict(extra="forbid")
760
761 containerPort: int = Field(
762 alias="container_port",
763 description="Number of port to expose on the pod's IP address. This must be a valid port number, 0 < x < 65536.",
764 )
765 hostIP: Optional[str] = Field(
766 default=None,
767 alias="host_ip",
768 description="What host IP to bind the external port to.",
769 )
770 hostPort: Optional[int] = Field(
771 default=None,
772 alias="host_port",
773 description="Number of port to expose on the host. If specified, this must be a valid port number, 0 < x < 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.",
774 )
775 name: Optional[str] = Field(
776 default=None,
777 description="If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.",
778 )
779 protocol: Optional[str] = Field(
780 default="TCP",
781 description='Protocol for port. Must be UDP, TCP, or SCTP. Defaults to "TCP".',
782 )
783
784
[docs]
785class ReadinessProbe(BaseModel):
786 """Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"""
787
788 model_config = ConfigDict(extra="forbid")
789
790 exec: Optional[Exec] = Field(
791 default=None, description="Exec specifies the action to take."
792 )
793 failureThreshold: Optional[int] = Field(
794 default=None,
795 alias="failure_threshold",
796 description="Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.",
797 )
798 grpc: Optional[Grpc] = Field(
799 default=None, description="GRPC specifies an action involving a GRPC port."
800 )
801 httpGet: Optional[HttpGet] = Field(
802 default=None,
803 alias="http_get",
804 description="HTTPGet specifies the http request to perform.",
805 )
806 initialDelaySeconds: Optional[int] = Field(
807 default=None,
808 alias="initial_delay_seconds",
809 description="Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
810 )
811 periodSeconds: Optional[int] = Field(
812 default=None,
813 alias="period_seconds",
814 description="How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.",
815 )
816 successThreshold: Optional[int] = Field(
817 default=None,
818 alias="success_threshold",
819 description="Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.",
820 )
821 tcpSocket: Optional[TcpSocket] = Field(
822 default=None,
823 alias="tcp_socket",
824 description="TCPSocket specifies an action involving a TCP port.",
825 )
826 terminationGracePeriodSeconds: Optional[int] = Field(
827 default=None,
828 alias="termination_grace_period_seconds",
829 description="Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.",
830 )
831 timeoutSeconds: Optional[int] = Field(
832 default=None,
833 alias="timeout_seconds",
834 description="Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
835 )
836
837
[docs]
838class ResizePolicy(BaseModel):
839 """ContainerResizePolicy represents resource resize policy for the container."""
840
841 model_config = ConfigDict(extra="forbid")
842
843 resourceName: str = Field(
844 alias="resource_name",
845 description="Name of the resource to which this resource resize policy applies. Supported values: cpu, memory.",
846 )
847 restartPolicy: str = Field(
848 alias="restart_policy",
849 description="Restart policy to apply when specified resource is resized. If not specified, it defaults to NotRequired.",
850 )
851
852
[docs]
853class Claims(BaseModel):
854 """ResourceClaim references one entry in PodSpec.ResourceClaims."""
855
856 model_config = ConfigDict(extra="forbid")
857
858 name: str = Field(
859 description="Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container."
860 )
861 request: Optional[str] = Field(
862 default=None,
863 description="Request is the name chosen for a request in the referenced claim. If empty, everything from the claim is made available, otherwise only the result of this request.",
864 )
865
866
[docs]
867class Resources(BaseModel):
868 """Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/"""
869
870 model_config = ConfigDict(extra="forbid")
871
872 claims: Optional[List[Claims]] = Field(
873 default=None,
874 description="Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container. This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. This field is immutable. It can only be set for containers.",
875 )
876 limits: Optional[Dict[str, Union[int, str]]] = Field(
877 default=None,
878 description="Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
879 )
880 requests: Optional[Dict[str, Union[int, str]]] = Field(
881 default=None,
882 description="Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
883 )
884
885
[docs]
886class AppArmorProfile(BaseModel):
887 """appArmorProfile is the AppArmor options to use by this container. If set, this profile overrides the pod's appArmorProfile. Note that this field cannot be set when spec.os.name is windows."""
888
889 model_config = ConfigDict(extra="forbid")
890
891 localhostProfile: Optional[str] = Field(
892 default=None,
893 alias="localhost_profile",
894 description='localhostProfile indicates a profile loaded on the node that should be used. The profile must be preconfigured on the node to work. Must match the loaded name of the profile. Must be set if and only if type is "Localhost".',
895 )
896 type: str = Field(
897 description="type indicates which kind of AppArmor profile will be applied. Valid options are: Localhost - a profile pre-loaded on the node. RuntimeDefault - the container runtime's default profile. Unconfined - no AppArmor enforcement."
898 )
899
900
[docs]
901class Capabilities(BaseModel):
902 """The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime. Note that this field cannot be set when spec.os.name is windows."""
903
904 model_config = ConfigDict(extra="forbid")
905
906 add: Optional[List[str]] = Field(default=None, description="Added capabilities")
907 drop: Optional[List[str]] = Field(default=None, description="Removed capabilities")
908
909
[docs]
910class SeLinuxOptions(BaseModel):
911 """The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows."""
912
913 model_config = ConfigDict(extra="forbid")
914
915 level: Optional[str] = Field(
916 default=None,
917 description="Level is SELinux level label that applies to the container.",
918 )
919 role: Optional[str] = Field(
920 default=None,
921 description="Role is a SELinux role label that applies to the container.",
922 )
923 type: Optional[str] = Field(
924 default=None,
925 description="Type is a SELinux type label that applies to the container.",
926 )
927 user: Optional[str] = Field(
928 default=None,
929 description="User is a SELinux user label that applies to the container.",
930 )
931
932
[docs]
933class SeccompProfile(BaseModel):
934 """The seccomp options to use by this container. If seccomp options are provided at both the pod & container level, the container options override the pod options. Note that this field cannot be set when spec.os.name is windows."""
935
936 model_config = ConfigDict(extra="forbid")
937
938 localhostProfile: Optional[str] = Field(
939 default=None,
940 alias="localhost_profile",
941 description='localhostProfile indicates a profile defined in a file on the node should be used. The profile must be preconfigured on the node to work. Must be a descending path, relative to the kubelet\'s configured seccomp profile location. Must be set if type is "Localhost". Must NOT be set for any other type.',
942 )
943 type: str = Field(
944 description="type indicates which kind of seccomp profile will be applied. Valid options are: Localhost - a profile defined in a file on the node should be used. RuntimeDefault - the container runtime default profile should be used. Unconfined - no profile should be applied."
945 )
946
947
[docs]
948class WindowsOptions(BaseModel):
949 """The Windows specific settings applied to all containers. If unspecified, the options from the PodSecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux."""
950
951 model_config = ConfigDict(extra="forbid")
952
953 gmsaCredentialSpec: Optional[str] = Field(
954 default=None,
955 alias="gmsa_credential_spec",
956 description="GMSACredentialSpec is where the GMSA admission webhook (https://github.com/kubernetes-sigs/windows-gmsa) inlines the contents of the GMSA credential spec named by the GMSACredentialSpecName field.",
957 )
958 gmsaCredentialSpecName: Optional[str] = Field(
959 default=None,
960 alias="gmsa_credential_spec_name",
961 description="GMSACredentialSpecName is the name of the GMSA credential spec to use.",
962 )
963 hostProcess: Optional[bool] = Field(
964 default=None,
965 alias="host_process",
966 description="HostProcess determines if a container should be run as a 'Host Process' container. All of a Pod's containers must have the same effective HostProcess value (it is not allowed to have a mix of HostProcess containers and non-HostProcess containers). In addition, if HostProcess is true then HostNetwork must also be set to true.",
967 )
968 runAsUserName: Optional[str] = Field(
969 default=None,
970 alias="run_as_user_name",
971 description="The UserName in Windows to run the entrypoint of the container process. Defaults to the user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.",
972 )
973
974
[docs]
975class SecurityContext(BaseModel):
976 """SecurityContext defines the security options the container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/"""
977
978 model_config = ConfigDict(extra="forbid")
979
980 allowPrivilegeEscalation: Optional[bool] = Field(
981 default=None,
982 alias="allow_privilege_escalation",
983 description="AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN Note that this field cannot be set when spec.os.name is windows.",
984 )
985 appArmorProfile: Optional[AppArmorProfile] = Field(
986 default=None,
987 alias="app_armor_profile",
988 description="appArmorProfile is the AppArmor options to use by this container. If set, this profile overrides the pod's appArmorProfile. Note that this field cannot be set when spec.os.name is windows.",
989 )
990 capabilities: Optional[Capabilities] = Field(
991 default=None,
992 description="The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime. Note that this field cannot be set when spec.os.name is windows.",
993 )
994 privileged: Optional[bool] = Field(
995 default=None,
996 description="Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. Note that this field cannot be set when spec.os.name is windows.",
997 )
998 procMount: Optional[str] = Field(
999 default=None,
1000 alias="proc_mount",
1001 description="procMount denotes the type of proc mount to use for the containers. The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.",
1002 )
1003 readOnlyRootFilesystem: Optional[bool] = Field(
1004 default=None,
1005 alias="read_only_root_filesystem",
1006 description="Whether this container has a read-only root filesystem. Default is false. Note that this field cannot be set when spec.os.name is windows.",
1007 )
1008 runAsGroup: Optional[int] = Field(
1009 default=None,
1010 alias="run_as_group",
1011 description="The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.",
1012 )
1013 runAsNonRoot: Optional[bool] = Field(
1014 default=None,
1015 alias="run_as_non_root",
1016 description="Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.",
1017 )
1018 runAsUser: Optional[int] = Field(
1019 default=None,
1020 alias="run_as_user",
1021 description="The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.",
1022 )
1023 seLinuxOptions: Optional[SeLinuxOptions] = Field(
1024 default=None,
1025 alias="se_linux_options",
1026 description="The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.",
1027 )
1028 seccompProfile: Optional[SeccompProfile] = Field(
1029 default=None,
1030 alias="seccomp_profile",
1031 description="The seccomp options to use by this container. If seccomp options are provided at both the pod & container level, the container options override the pod options. Note that this field cannot be set when spec.os.name is windows.",
1032 )
1033 windowsOptions: Optional[WindowsOptions] = Field(
1034 default=None,
1035 alias="windows_options",
1036 description="The Windows specific settings applied to all containers. If unspecified, the options from the PodSecurityContext will be used. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is linux.",
1037 )
1038
1039
[docs]
1040class StartupProbe(BaseModel):
1041 """StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"""
1042
1043 model_config = ConfigDict(extra="forbid")
1044
1045 exec: Optional[Exec] = Field(
1046 default=None, description="Exec specifies the action to take."
1047 )
1048 failureThreshold: Optional[int] = Field(
1049 default=None,
1050 alias="failure_threshold",
1051 description="Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.",
1052 )
1053 grpc: Optional[Grpc] = Field(
1054 default=None, description="GRPC specifies an action involving a GRPC port."
1055 )
1056 httpGet: Optional[HttpGet] = Field(
1057 default=None,
1058 alias="http_get",
1059 description="HTTPGet specifies the http request to perform.",
1060 )
1061 initialDelaySeconds: Optional[int] = Field(
1062 default=None,
1063 alias="initial_delay_seconds",
1064 description="Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1065 )
1066 periodSeconds: Optional[int] = Field(
1067 default=None,
1068 alias="period_seconds",
1069 description="How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.",
1070 )
1071 successThreshold: Optional[int] = Field(
1072 default=None,
1073 alias="success_threshold",
1074 description="Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.",
1075 )
1076 tcpSocket: Optional[TcpSocket] = Field(
1077 default=None,
1078 alias="tcp_socket",
1079 description="TCPSocket specifies an action involving a TCP port.",
1080 )
1081 terminationGracePeriodSeconds: Optional[int] = Field(
1082 default=None,
1083 alias="termination_grace_period_seconds",
1084 description="Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.",
1085 )
1086 timeoutSeconds: Optional[int] = Field(
1087 default=None,
1088 alias="timeout_seconds",
1089 description="Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1090 )
1091
1092
[docs]
1093class VolumeDevices(BaseModel):
1094 """volumeDevice describes a mapping of a raw block device within a container."""
1095
1096 model_config = ConfigDict(extra="forbid")
1097
1098 devicePath: str = Field(
1099 alias="device_path",
1100 description="devicePath is the path inside of the container that the device will be mapped to.",
1101 )
1102 name: str = Field(
1103 description="name must match the name of a persistentVolumeClaim in the pod"
1104 )
1105
1106
[docs]
1107class VolumeMounts(BaseModel):
1108 """VolumeMount describes a mounting of a Volume within a container."""
1109
1110 model_config = ConfigDict(extra="forbid")
1111
1112 mountPath: str = Field(
1113 alias="mount_path",
1114 description="Path within the container at which the volume should be mounted. Must not contain ':'.",
1115 )
1116 mountPropagation: Optional[str] = Field(
1117 default=None,
1118 alias="mount_propagation",
1119 description="mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified (which defaults to None).",
1120 )
1121 name: str = Field(description="This must match the Name of a Volume.")
1122 readOnly: Optional[bool] = Field(
1123 default=None,
1124 alias="read_only",
1125 description="Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.",
1126 )
1127 recursiveReadOnly: Optional[str] = Field(
1128 default=None,
1129 alias="recursive_read_only",
1130 description="RecursiveReadOnly specifies whether read-only mounts should be handled recursively. If ReadOnly is false, this field has no meaning and must be unspecified. If ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. If this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None). If this field is not specified, it is treated as an equivalent of Disabled.",
1131 )
1132 subPath: Optional[str] = Field(
1133 default=None,
1134 alias="sub_path",
1135 description="Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).",
1136 )
1137 subPathExpr: Optional[str] = Field(
1138 default=None,
1139 alias="sub_path_expr",
1140 description="Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to \"\" (volume's root). SubPathExpr and SubPath are mutually exclusive.",
1141 )
1142
1143
[docs]
1144class Containers(BaseModel):
1145 """A single application container that you want to run within a pod."""
1146
1147 model_config = ConfigDict(extra="forbid")
1148
1149 args: Optional[List[str]] = Field(
1150 default=None,
1151 description='Arguments to the entrypoint. The container image\'s CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container\'s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell',
1152 )
1153 command: Optional[List[str]] = Field(
1154 default=None,
1155 description='Entrypoint array. Not executed within a shell. The container image\'s ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container\'s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell',
1156 )
1157 env: Optional[List[Env]] = Field(
1158 default=None,
1159 description="List of environment variables to set in the container. Cannot be updated.",
1160 )
1161 envFrom: Optional[List[EnvFrom]] = Field(
1162 default=None,
1163 alias="env_from",
1164 description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
1165 )
1166 image: Optional[str] = Field(
1167 default=None,
1168 description="Container image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.",
1169 )
1170 imagePullPolicy: Optional[str] = Field(
1171 default=None,
1172 alias="image_pull_policy",
1173 description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images",
1174 )
1175 lifecycle: Optional[Lifecycle] = Field(
1176 default=None,
1177 description="Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
1178 )
1179 livenessProbe: Optional[LivenessProbe] = Field(
1180 default=None,
1181 alias="liveness_probe",
1182 description="Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1183 )
1184 name: str = Field(
1185 description="Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated."
1186 )
1187 ports: Optional[List[Ports]] = Field(
1188 default=None,
1189 description='List of ports to expose from the container. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.',
1190 )
1191 readinessProbe: Optional[ReadinessProbe] = Field(
1192 default=None,
1193 alias="readiness_probe",
1194 description="Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1195 )
1196 resizePolicy: Optional[List[ResizePolicy]] = Field(
1197 default=None,
1198 alias="resize_policy",
1199 description="Resources resize policy for the container.",
1200 )
1201 resources: Optional[Resources] = Field(
1202 default=None,
1203 description="Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
1204 )
1205 restartPolicy: Optional[str] = Field(
1206 default=None,
1207 alias="restart_policy",
1208 description='RestartPolicy defines the restart behavior of individual containers in a pod. This field may only be set for init containers, and the only allowed value is "Always". For non-init containers or when this field is not specified, the restart behavior is defined by the Pod\'s restart policy and the container type. Setting the RestartPolicy as "Always" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy "Always" will be shut down. This lifecycle differs from normal init containers and is often referred to as a "sidecar" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed.',
1209 )
1210 securityContext: Optional[SecurityContext] = Field(
1211 default=None,
1212 alias="security_context",
1213 description="SecurityContext defines the security options the container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/",
1214 )
1215 startupProbe: Optional[StartupProbe] = Field(
1216 default=None,
1217 alias="startup_probe",
1218 description="StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1219 )
1220 stdin: Optional[bool] = Field(
1221 default=None,
1222 description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.",
1223 )
1224 stdinOnce: Optional[bool] = Field(
1225 default=None,
1226 alias="stdin_once",
1227 description="Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false",
1228 )
1229 terminationMessagePath: Optional[str] = Field(
1230 default=None,
1231 alias="termination_message_path",
1232 description="Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.",
1233 )
1234 terminationMessagePolicy: Optional[str] = Field(
1235 default=None,
1236 alias="termination_message_policy",
1237 description="Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.",
1238 )
1239 tty: Optional[bool] = Field(
1240 default=None,
1241 description="Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.",
1242 )
1243 volumeDevices: Optional[List[VolumeDevices]] = Field(
1244 default=None,
1245 alias="volume_devices",
1246 description="volumeDevices is the list of block devices to be used by the container.",
1247 )
1248 volumeMounts: Optional[List[VolumeMounts]] = Field(
1249 default=None,
1250 alias="volume_mounts",
1251 description="Pod volumes to mount into the container's filesystem. Cannot be updated.",
1252 )
1253 workingDir: Optional[str] = Field(
1254 default=None,
1255 alias="working_dir",
1256 description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
1257 )
1258
1259
[docs]
1260class Options(BaseModel):
1261 """PodDNSConfigOption defines DNS resolver options of a pod."""
1262
1263 model_config = ConfigDict(extra="forbid")
1264
1265 name: Optional[str] = Field(default=None, description="Required.")
1266 value: Optional[str] = None
1267
1268
[docs]
1269class DnsConfig(BaseModel):
1270 """Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy."""
1271
1272 model_config = ConfigDict(extra="forbid")
1273
1274 nameservers: Optional[List[str]] = Field(
1275 default=None,
1276 description="A list of DNS name server IP addresses. This will be appended to the base nameservers generated from DNSPolicy. Duplicated nameservers will be removed.",
1277 )
1278 options: Optional[List[Options]] = Field(
1279 default=None,
1280 description="A list of DNS resolver options. This will be merged with the base options generated from DNSPolicy. Duplicated entries will be removed. Resolution options given in Options will override those that appear in the base DNSPolicy.",
1281 )
1282 searches: Optional[List[str]] = Field(
1283 default=None,
1284 description="A list of DNS search domains for host-name lookup. This will be appended to the base search paths generated from DNSPolicy. Duplicated search paths will be removed.",
1285 )
1286
1287
[docs]
1288class EphemeralContainers(BaseModel):
1289 """An EphemeralContainer is a temporary container that you may add to an existing Pod for user-initiated activities such as debugging. Ephemeral containers have no resource or scheduling guarantees, and they will not be restarted when they exit or when a Pod is removed or restarted. The kubelet may evict a Pod if an ephemeral container causes the Pod to exceed its resource allocation. To add an ephemeral container, use the ephemeralcontainers subresource of an existing Pod. Ephemeral containers may not be removed or restarted."""
1290
1291 model_config = ConfigDict(extra="forbid")
1292
1293 args: Optional[List[str]] = Field(
1294 default=None,
1295 description='Arguments to the entrypoint. The image\'s CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container\'s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell',
1296 )
1297 command: Optional[List[str]] = Field(
1298 default=None,
1299 description='Entrypoint array. Not executed within a shell. The image\'s ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container\'s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell',
1300 )
1301 env: Optional[List[Env]] = Field(
1302 default=None,
1303 description="List of environment variables to set in the container. Cannot be updated.",
1304 )
1305 envFrom: Optional[List[EnvFrom]] = Field(
1306 default=None,
1307 alias="env_from",
1308 description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
1309 )
1310 image: Optional[str] = Field(
1311 default=None,
1312 description="Container image name. More info: https://kubernetes.io/docs/concepts/containers/images",
1313 )
1314 imagePullPolicy: Optional[str] = Field(
1315 default=None,
1316 alias="image_pull_policy",
1317 description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images",
1318 )
1319 lifecycle: Optional[Lifecycle] = Field(
1320 default=None, description="Lifecycle is not allowed for ephemeral containers."
1321 )
1322 livenessProbe: Optional[LivenessProbe] = Field(
1323 default=None,
1324 alias="liveness_probe",
1325 description="Probes are not allowed for ephemeral containers.",
1326 )
1327 name: str = Field(
1328 description="Name of the ephemeral container specified as a DNS_LABEL. This name must be unique among all containers, init containers and ephemeral containers."
1329 )
1330 ports: Optional[List[Ports]] = Field(
1331 default=None, description="Ports are not allowed for ephemeral containers."
1332 )
1333 readinessProbe: Optional[ReadinessProbe] = Field(
1334 default=None,
1335 alias="readiness_probe",
1336 description="Probes are not allowed for ephemeral containers.",
1337 )
1338 resizePolicy: Optional[List[ResizePolicy]] = Field(
1339 default=None,
1340 alias="resize_policy",
1341 description="Resources resize policy for the container.",
1342 )
1343 resources: Optional[Resources] = Field(
1344 default=None,
1345 description="Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources already allocated to the pod.",
1346 )
1347 restartPolicy: Optional[str] = Field(
1348 default=None,
1349 alias="restart_policy",
1350 description="Restart policy for the container to manage the restart behavior of each container within a pod. This may only be set for init containers. You cannot set this field on ephemeral containers.",
1351 )
1352 securityContext: Optional[SecurityContext] = Field(
1353 default=None,
1354 alias="security_context",
1355 description="Optional: SecurityContext defines the security options the ephemeral container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.",
1356 )
1357 startupProbe: Optional[StartupProbe] = Field(
1358 default=None,
1359 alias="startup_probe",
1360 description="Probes are not allowed for ephemeral containers.",
1361 )
1362 stdin: Optional[bool] = Field(
1363 default=None,
1364 description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.",
1365 )
1366 stdinOnce: Optional[bool] = Field(
1367 default=None,
1368 alias="stdin_once",
1369 description="Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false",
1370 )
1371 targetContainerName: Optional[str] = Field(
1372 default=None,
1373 alias="target_container_name",
1374 description="If set, the name of the container from PodSpec that this ephemeral container targets. The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. If not set then the ephemeral container uses the namespaces configured in the Pod spec. The container runtime must implement support for this feature. If the runtime does not support namespace targeting then the result of setting this field is undefined.",
1375 )
1376 terminationMessagePath: Optional[str] = Field(
1377 default=None,
1378 alias="termination_message_path",
1379 description="Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.",
1380 )
1381 terminationMessagePolicy: Optional[str] = Field(
1382 default=None,
1383 alias="termination_message_policy",
1384 description="Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.",
1385 )
1386 tty: Optional[bool] = Field(
1387 default=None,
1388 description="Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.",
1389 )
1390 volumeDevices: Optional[List[VolumeDevices]] = Field(
1391 default=None,
1392 alias="volume_devices",
1393 description="volumeDevices is the list of block devices to be used by the container.",
1394 )
1395 volumeMounts: Optional[List[VolumeMounts]] = Field(
1396 default=None,
1397 alias="volume_mounts",
1398 description="Pod volumes to mount into the container's filesystem. Subpath mounts are not allowed for ephemeral containers. Cannot be updated.",
1399 )
1400 workingDir: Optional[str] = Field(
1401 default=None,
1402 alias="working_dir",
1403 description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
1404 )
1405
1406
[docs]
1407class HostAliases(BaseModel):
1408 """HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file."""
1409
1410 model_config = ConfigDict(extra="forbid")
1411
1412 hostnames: Optional[List[str]] = Field(
1413 default=None, description="Hostnames for the above IP address."
1414 )
1415 ip: str = Field(description="IP address of the host file entry.")
1416
1417
[docs]
1418class ImagePullSecrets(BaseModel):
1419 """LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace."""
1420
1421 model_config = ConfigDict(extra="forbid")
1422
1423 name: Optional[str] = Field(
1424 default="",
1425 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
1426 )
1427
1428
[docs]
1429class InitContainers(BaseModel):
1430 """A single application container that you want to run within a pod."""
1431
1432 model_config = ConfigDict(extra="forbid")
1433
1434 args: Optional[List[str]] = Field(
1435 default=None,
1436 description='Arguments to the entrypoint. The container image\'s CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container\'s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell',
1437 )
1438 command: Optional[List[str]] = Field(
1439 default=None,
1440 description='Entrypoint array. Not executed within a shell. The container image\'s ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container\'s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell',
1441 )
1442 env: Optional[List[Env]] = Field(
1443 default=None,
1444 description="List of environment variables to set in the container. Cannot be updated.",
1445 )
1446 envFrom: Optional[List[EnvFrom]] = Field(
1447 default=None,
1448 alias="env_from",
1449 description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
1450 )
1451 image: Optional[str] = Field(
1452 default=None,
1453 description="Container image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.",
1454 )
1455 imagePullPolicy: Optional[str] = Field(
1456 default=None,
1457 alias="image_pull_policy",
1458 description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images",
1459 )
1460 lifecycle: Optional[Lifecycle] = Field(
1461 default=None,
1462 description="Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
1463 )
1464 livenessProbe: Optional[LivenessProbe] = Field(
1465 default=None,
1466 alias="liveness_probe",
1467 description="Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1468 )
1469 name: str = Field(
1470 description="Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated."
1471 )
1472 ports: Optional[List[Ports]] = Field(
1473 default=None,
1474 description='List of ports to expose from the container. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.',
1475 )
1476 readinessProbe: Optional[ReadinessProbe] = Field(
1477 default=None,
1478 alias="readiness_probe",
1479 description="Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1480 )
1481 resizePolicy: Optional[List[ResizePolicy]] = Field(
1482 default=None,
1483 alias="resize_policy",
1484 description="Resources resize policy for the container.",
1485 )
1486 resources: Optional[Resources] = Field(
1487 default=None,
1488 description="Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
1489 )
1490 restartPolicy: Optional[str] = Field(
1491 default=None,
1492 alias="restart_policy",
1493 description='RestartPolicy defines the restart behavior of individual containers in a pod. This field may only be set for init containers, and the only allowed value is "Always". For non-init containers or when this field is not specified, the restart behavior is defined by the Pod\'s restart policy and the container type. Setting the RestartPolicy as "Always" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy "Always" will be shut down. This lifecycle differs from normal init containers and is often referred to as a "sidecar" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed.',
1494 )
1495 securityContext: Optional[SecurityContext] = Field(
1496 default=None,
1497 alias="security_context",
1498 description="SecurityContext defines the security options the container should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/",
1499 )
1500 startupProbe: Optional[StartupProbe] = Field(
1501 default=None,
1502 alias="startup_probe",
1503 description="StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
1504 )
1505 stdin: Optional[bool] = Field(
1506 default=None,
1507 description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.",
1508 )
1509 stdinOnce: Optional[bool] = Field(
1510 default=None,
1511 alias="stdin_once",
1512 description="Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false",
1513 )
1514 terminationMessagePath: Optional[str] = Field(
1515 default=None,
1516 alias="termination_message_path",
1517 description="Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.",
1518 )
1519 terminationMessagePolicy: Optional[str] = Field(
1520 default=None,
1521 alias="termination_message_policy",
1522 description="Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.",
1523 )
1524 tty: Optional[bool] = Field(
1525 default=None,
1526 description="Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.",
1527 )
1528 volumeDevices: Optional[List[VolumeDevices]] = Field(
1529 default=None,
1530 alias="volume_devices",
1531 description="volumeDevices is the list of block devices to be used by the container.",
1532 )
1533 volumeMounts: Optional[List[VolumeMounts]] = Field(
1534 default=None,
1535 alias="volume_mounts",
1536 description="Pod volumes to mount into the container's filesystem. Cannot be updated.",
1537 )
1538 workingDir: Optional[str] = Field(
1539 default=None,
1540 alias="working_dir",
1541 description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
1542 )
1543
1544
[docs]
1545class Os(BaseModel):
1546 """Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set. If the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions If the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.appArmorProfile - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.securityContext.supplementalGroupsPolicy - spec.containers[*].securityContext.appArmorProfile - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup"""
1547
1548 model_config = ConfigDict(extra="forbid")
1549
1550 name: str = Field(
1551 description="Name is the name of the operating system. The currently supported values are linux and windows. Additional value may be defined in future and can be one of: https://github.com/opencontainers/runtime-spec/blob/master/config.md#platform-specific-configuration Clients should expect to handle additional values and treat unrecognized values in this field as os: null"
1552 )
1553
1554
[docs]
1555class ReadinessGates(BaseModel):
1556 """PodReadinessGate contains the reference to a pod condition"""
1557
1558 model_config = ConfigDict(extra="forbid")
1559
1560 conditionType: str = Field(
1561 alias="condition_type",
1562 description="ConditionType refers to a condition in the pod's condition list with matching type.",
1563 )
1564
1565
[docs]
1566class ResourceClaims(BaseModel):
1567 """PodResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the pod. It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name."""
1568
1569 model_config = ConfigDict(extra="forbid")
1570
1571 name: str = Field(
1572 description="Name uniquely identifies this resource claim inside the pod. This must be a DNS_LABEL."
1573 )
1574 resourceClaimName: Optional[str] = Field(
1575 default=None,
1576 alias="resource_claim_name",
1577 description="ResourceClaimName is the name of a ResourceClaim object in the same namespace as this pod. Exactly one of ResourceClaimName and ResourceClaimTemplateName must be set.",
1578 )
1579 resourceClaimTemplateName: Optional[str] = Field(
1580 default=None,
1581 alias="resource_claim_template_name",
1582 description="ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod. The template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The pod name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. This field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim. Exactly one of ResourceClaimName and ResourceClaimTemplateName must be set.",
1583 )
1584
1585
[docs]
1586class SchedulingGates(BaseModel):
1587 """PodSchedulingGate is associated to a Pod to guard its scheduling."""
1588
1589 model_config = ConfigDict(extra="forbid")
1590
1591 name: str = Field(
1592 description="Name of the scheduling gate. Each scheduling gate must have a unique name field."
1593 )
1594
1595
[docs]
1596class LabelSelector(BaseModel):
1597 """LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain."""
1598
1599 model_config = ConfigDict(extra="forbid")
1600
1601 matchExpressions: Optional[List[MatchExpressions]] = Field(
1602 default=None,
1603 alias="match_expressions",
1604 description="matchExpressions is a list of label selector requirements. The requirements are ANDed.",
1605 )
1606 matchLabels: Optional[Dict[str, str]] = Field(
1607 default=None,
1608 alias="match_labels",
1609 description='matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.',
1610 )
1611
1612
[docs]
1613class NamespaceSelector(BaseModel):
1614 """A label query over the set of namespaces that the term applies to. The term is applied to the union of the namespaces selected by this field and the ones listed in the namespaces field. null selector and null or empty namespaces list means "this pod's namespace". An empty selector ({}) matches all namespaces."""
1615
1616 model_config = ConfigDict(extra="forbid")
1617
1618 matchExpressions: Optional[List[MatchExpressions]] = Field(
1619 default=None,
1620 alias="match_expressions",
1621 description="matchExpressions is a list of label selector requirements. The requirements are ANDed.",
1622 )
1623 matchLabels: Optional[Dict[str, str]] = Field(
1624 default=None,
1625 alias="match_labels",
1626 description='matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.',
1627 )
1628
1629
[docs]
1630class TopologySpreadConstraints(BaseModel):
1631 """TopologySpreadConstraint specifies how to spread matching pods among the given topology."""
1632
1633 model_config = ConfigDict(extra="forbid")
1634
1635 labelSelector: Optional[LabelSelector] = Field(
1636 default=None,
1637 alias="label_selector",
1638 description="LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain.",
1639 )
1640 matchLabelKeys: Optional[List[str]] = Field(
1641 default=None,
1642 alias="match_label_keys",
1643 description="MatchLabelKeys is a set of pod label keys to select the pods over which spreading will be calculated. The keys are used to lookup values from the incoming pod labels, those key-value labels are ANDed with labelSelector to select the group of existing pods over which spreading will be calculated for the incoming pod. The same key is forbidden to exist in both MatchLabelKeys and LabelSelector. MatchLabelKeys cannot be set when LabelSelector isn't set. Keys that don't exist in the incoming pod labels will be ignored. A null or empty list means only match against labelSelector. This is a beta field and requires the MatchLabelKeysInPodTopologySpread feature gate to be enabled (enabled by default).",
1644 )
1645 maxSkew: int = Field(
1646 alias="max_skew",
1647 description="MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. The global minimum is the minimum number of matching pods in an eligible domain or zero if the number of eligible domains is less than MinDomains. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 2/2/1: In this case, the global minimum is 1. | zone1 | zone2 | zone3 | | P P | P P | P | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 2/2/2; scheduling it onto zone1(zone2) would make the ActualSkew(3-1) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It's a required field. Default value is 1 and 0 is not allowed.",
1648 )
1649 minDomains: Optional[int] = Field(
1650 default=None,
1651 alias="min_domains",
1652 description='MinDomains indicates a minimum number of eligible domains. When the number of eligible domains with matching topology keys is less than minDomains, Pod Topology Spread treats "global minimum" as 0, and then the calculation of Skew is performed. And when the number of eligible domains with matching topology keys equals or greater than minDomains, this value has no effect on scheduling. As a result, when the number of eligible domains is less than minDomains, scheduler won\'t schedule more than maxSkew Pods to those domains. If value is nil, the constraint behaves as if MinDomains is equal to 1. Valid values are integers greater than 0. When value is not nil, WhenUnsatisfiable must be DoNotSchedule. For example, in a 3-zone cluster, MaxSkew is set to 2, MinDomains is set to 5 and pods with the same labelSelector spread as 2/2/2: | zone1 | zone2 | zone3 | | P P | P P | P P | The number of domains is less than 5(MinDomains), so "global minimum" is treated as 0. In this situation, new pod with the same labelSelector cannot be scheduled, because computed skew will be 3(3 - 0) if new Pod is scheduled to any of the three zones, it will violate MaxSkew.',
1653 )
1654 nodeAffinityPolicy: Optional[str] = Field(
1655 default=None,
1656 alias="node_affinity_policy",
1657 description="NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector when calculating pod topology spread skew. Options are: - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations. - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations. If this value is nil, the behavior is equivalent to the Honor policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.",
1658 )
1659 nodeTaintsPolicy: Optional[str] = Field(
1660 default=None,
1661 alias="node_taints_policy",
1662 description="NodeTaintsPolicy indicates how we will treat node taints when calculating pod topology spread skew. Options are: - Honor: nodes without taints, along with tainted nodes for which the incoming pod has a toleration, are included. - Ignore: node taints are ignored. All nodes are included. If this value is nil, the behavior is equivalent to the Ignore policy. This is a beta-level feature default enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.",
1663 )
1664 topologyKey: str = Field(
1665 alias="topology_key",
1666 description='TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each <key, value> as a "bucket", and try to put balanced number of pods into each bucket. We define a domain as a particular instance of a topology. Also, we define an eligible domain as a domain whose nodes meet the requirements of nodeAffinityPolicy and nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", each Node is a domain of that topology. And, if TopologyKey is "topology.kubernetes.io/zone", each zone is a domain of that topology. It\'s a required field.',
1667 )
1668 whenUnsatisfiable: str = Field(
1669 alias="when_unsatisfiable",
1670 description='WhenUnsatisfiable indicates how to deal with a pod if it doesn\'t satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location, but giving higher precedence to topologies that would help reduce the skew. A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assignment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P | P | P | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won\'t make it *more* imbalanced. It\'s a required field.',
1671 )
1672
1673
[docs]
1674class AwsElasticBlockStore(BaseModel):
1675 """awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore"""
1676
1677 model_config = ConfigDict(extra="forbid")
1678
1679 fsType: Optional[str] = Field(
1680 default=None,
1681 alias="fs_type",
1682 description='fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore',
1683 )
1684 partition: Optional[int] = Field(
1685 default=None,
1686 description='partition is the partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).',
1687 )
1688 readOnly: Optional[bool] = Field(
1689 default=None,
1690 alias="read_only",
1691 description="readOnly value true will force the readOnly setting in VolumeMounts. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore",
1692 )
1693 volumeID: str = Field(
1694 alias="volume_id",
1695 description="volumeID is unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore",
1696 )
1697
1698
[docs]
1699class AzureDisk(BaseModel):
1700 """azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod."""
1701
1702 model_config = ConfigDict(extra="forbid")
1703
1704 cachingMode: Optional[str] = Field(
1705 default=None,
1706 alias="caching_mode",
1707 description="cachingMode is the Host Caching mode: None, Read Only, Read Write.",
1708 )
1709 diskName: str = Field(
1710 alias="disk_name",
1711 description="diskName is the Name of the data disk in the blob storage",
1712 )
1713 diskURI: str = Field(
1714 alias="disk_uri",
1715 description="diskURI is the URI of data disk in the blob storage",
1716 )
1717 fsType: Optional[str] = Field(
1718 default="ext4",
1719 alias="fs_type",
1720 description='fsType is Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.',
1721 )
1722 kind: Optional[str] = Field(
1723 default=None,
1724 description="kind expected values are Shared: multiple blob disks per storage account Dedicated: single blob disk per storage account Managed: azure managed data disk (only in managed availability set). defaults to shared",
1725 )
1726 readOnly: Optional[bool] = Field(
1727 default=False,
1728 alias="read_only",
1729 description="readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
1730 )
1731
1732
[docs]
1733class AzureFile(BaseModel):
1734 """azureFile represents an Azure File Service mount on the host and bind mount to the pod."""
1735
1736 model_config = ConfigDict(extra="forbid")
1737
1738 readOnly: Optional[bool] = Field(
1739 default=None,
1740 alias="read_only",
1741 description="readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
1742 )
1743 secretName: str = Field(
1744 alias="secret_name",
1745 description="secretName is the name of secret that contains Azure Storage Account Name and Key",
1746 )
1747 shareName: str = Field(
1748 alias="share_name", description="shareName is the azure share Name"
1749 )
1750
1751
[docs]
1752class Cephfs(BaseModel):
1753 """cephFS represents a Ceph FS mount on the host that shares a pod's lifetime"""
1754
1755 model_config = ConfigDict(extra="forbid")
1756
1757 monitors: List[str] = Field(
1758 description="monitors is Required: Monitors is a collection of Ceph monitors More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it"
1759 )
1760 path: Optional[str] = Field(
1761 default=None,
1762 description="path is Optional: Used as the mounted root, rather than the full Ceph tree, default is /",
1763 )
1764 readOnly: Optional[bool] = Field(
1765 default=None,
1766 alias="read_only",
1767 description="readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
1768 )
1769 secretFile: Optional[str] = Field(
1770 default=None,
1771 alias="secret_file",
1772 description="secretFile is Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
1773 )
1774 secretRef: Optional[SecretRef] = Field(
1775 default=None,
1776 alias="secret_ref",
1777 description="secretRef is Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
1778 )
1779 user: Optional[str] = Field(
1780 default=None,
1781 description="user is optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it",
1782 )
1783
1784
[docs]
1785class Cinder(BaseModel):
1786 """cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md"""
1787
1788 model_config = ConfigDict(extra="forbid")
1789
1790 fsType: Optional[str] = Field(
1791 default=None,
1792 alias="fs_type",
1793 description='fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://examples.k8s.io/mysql-cinder-pd/README.md',
1794 )
1795 readOnly: Optional[bool] = Field(
1796 default=None,
1797 alias="read_only",
1798 description="readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. More info: https://examples.k8s.io/mysql-cinder-pd/README.md",
1799 )
1800 secretRef: Optional[SecretRef] = Field(
1801 default=None,
1802 alias="secret_ref",
1803 description="secretRef is optional: points to a secret object containing parameters used to connect to OpenStack.",
1804 )
1805 volumeID: str = Field(
1806 alias="volume_id",
1807 description="volumeID used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md",
1808 )
1809
1810
[docs]
1811class Items(BaseModel):
1812 """Maps a string key to a path within a volume."""
1813
1814 model_config = ConfigDict(extra="forbid")
1815
1816 key: str = Field(description="key is the key to project.")
1817 mode: Optional[int] = Field(
1818 default=None,
1819 description="mode is Optional: mode bits used to set permissions on this file. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. If not specified, the volume defaultMode will be used. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.",
1820 )
1821 path: str = Field(
1822 description="path is the relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'."
1823 )
1824
1825
[docs]
1826class ConfigMap(BaseModel):
1827 """configMap represents a configMap that should populate this volume"""
1828
1829 model_config = ConfigDict(extra="forbid")
1830
1831 defaultMode: Optional[int] = Field(
1832 default=None,
1833 alias="default_mode",
1834 description="defaultMode is optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.",
1835 )
1836 items: Optional[List[Items]] = Field(
1837 default=None,
1838 description="items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.",
1839 )
1840 name: Optional[str] = Field(
1841 default="",
1842 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
1843 )
1844 optional: Optional[bool] = Field(
1845 default=None,
1846 description="optional specify whether the ConfigMap or its keys must be defined",
1847 )
1848
1849
[docs]
1850class NodePublishSecretRef(BaseModel):
1851 """nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed."""
1852
1853 model_config = ConfigDict(extra="forbid")
1854
1855 name: Optional[str] = Field(
1856 default="",
1857 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
1858 )
1859
1860
[docs]
1861class Csi(BaseModel):
1862 """csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature)."""
1863
1864 model_config = ConfigDict(extra="forbid")
1865
1866 driver: str = Field(
1867 description="driver is the name of the CSI driver that handles this volume. Consult with your admin for the correct name as registered in the cluster."
1868 )
1869 fsType: Optional[str] = Field(
1870 default=None,
1871 alias="fs_type",
1872 description='fsType to mount. Ex. "ext4", "xfs", "ntfs". If not provided, the empty value is passed to the associated CSI driver which will determine the default filesystem to apply.',
1873 )
1874 nodePublishSecretRef: Optional[NodePublishSecretRef] = Field(
1875 default=None,
1876 alias="node_publish_secret_ref",
1877 description="nodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed.",
1878 )
1879 readOnly: Optional[bool] = Field(
1880 default=None,
1881 alias="read_only",
1882 description="readOnly specifies a read-only configuration for the volume. Defaults to false (read/write).",
1883 )
1884 volumeAttributes: Optional[Dict[str, str]] = Field(
1885 default=None,
1886 alias="volume_attributes",
1887 description="volumeAttributes stores driver-specific properties that are passed to the CSI driver. Consult your driver's documentation for supported values.",
1888 )
1889
1890
[docs]
1891class DownwardApi(BaseModel):
1892 """downwardAPI represents downward API about the pod that should populate this volume"""
1893
1894 model_config = ConfigDict(extra="forbid")
1895
1896 defaultMode: Optional[int] = Field(
1897 default=None,
1898 alias="default_mode",
1899 description="Optional: mode bits to use on created files by default. Must be a Optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.",
1900 )
1901 items: Optional[List[Items]] = Field(
1902 default=None, description="Items is a list of downward API volume file"
1903 )
1904
1905
[docs]
1906class EmptyDir(BaseModel):
1907 """emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir"""
1908
1909 model_config = ConfigDict(extra="forbid")
1910
1911 medium: Optional[str] = Field(
1912 default=None,
1913 description='medium represents what type of storage medium should back this directory. The default is "" which means to use the node\'s default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir',
1914 )
1915 sizeLimit: Optional[Union[int, str]] = Field(
1916 default=None,
1917 alias="size_limit",
1918 description="sizeLimit is the total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir",
1919 )
1920
1921
[docs]
1922class DataSource(BaseModel):
1923 """dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource."""
1924
1925 model_config = ConfigDict(extra="forbid")
1926
1927 apiGroup: Optional[str] = Field(
1928 default=None,
1929 alias="api_group",
1930 description="APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.",
1931 )
1932 kind: str = Field(description="Kind is the type of resource being referenced")
1933 name: str = Field(description="Name is the name of resource being referenced")
1934
1935
[docs]
1936class DataSourceRef(BaseModel):
1937 """dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, when namespace isn't specified in dataSourceRef, both fields (dataSource and dataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. When namespace is specified in dataSourceRef, dataSource isn't set to the same value and must be empty. There are three important differences between dataSource and dataSourceRef: * While dataSource only allows two specific types of objects, dataSourceRef allows any non-core object, as well as PersistentVolumeClaim objects. * While dataSource ignores disallowed values (dropping them), dataSourceRef preserves all values, and generates an error if a disallowed value is specified. * While dataSource only allows local objects, dataSourceRef allows objects in any namespaces. (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled."""
1938
1939 model_config = ConfigDict(extra="forbid")
1940
1941 apiGroup: Optional[str] = Field(
1942 default=None,
1943 alias="api_group",
1944 description="APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.",
1945 )
1946 kind: str = Field(description="Kind is the type of resource being referenced")
1947 name: str = Field(description="Name is the name of resource being referenced")
1948 namespace: Optional[str] = Field(
1949 default=None,
1950 description="Namespace is the namespace of resource being referenced Note that when a namespace is specified, a gateway.networking.k8s.io/ReferenceGrant object is required in the referent namespace to allow that namespace's owner to accept the reference. See the ReferenceGrant documentation for details. (Alpha) This field requires the CrossNamespaceVolumeDataSource feature gate to be enabled.",
1951 )
1952
1953
[docs]
1954class Selector(BaseModel):
1955 """selector is a label query over volumes to consider for binding."""
1956
1957 model_config = ConfigDict(extra="forbid")
1958
1959 matchExpressions: Optional[List[MatchExpressions]] = Field(
1960 default=None,
1961 alias="match_expressions",
1962 description="matchExpressions is a list of label selector requirements. The requirements are ANDed.",
1963 )
1964 matchLabels: Optional[Dict[str, str]] = Field(
1965 default=None,
1966 alias="match_labels",
1967 description='matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.',
1968 )
1969
1970
[docs]
1971class VolumeClaimTemplateSpec(BaseModel):
1972 """The specification for the PersistentVolumeClaim. The entire content is copied unchanged into the PVC that gets created from this template. The same fields as in a PersistentVolumeClaim are also valid here."""
1973
1974 model_config = ConfigDict(extra="forbid")
1975
1976 accessModes: Optional[List[str]] = Field(
1977 default=None,
1978 alias="access_modes",
1979 description="accessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1",
1980 )
1981 dataSource: Optional[DataSource] = Field(
1982 default=None,
1983 alias="data_source",
1984 description="dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource.",
1985 )
1986 dataSourceRef: Optional[DataSourceRef] = Field(
1987 default=None,
1988 alias="data_source_ref",
1989 description="dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, when namespace isn't specified in dataSourceRef, both fields (dataSource and dataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. When namespace is specified in dataSourceRef, dataSource isn't set to the same value and must be empty. There are three important differences between dataSource and dataSourceRef: * While dataSource only allows two specific types of objects, dataSourceRef allows any non-core object, as well as PersistentVolumeClaim objects. * While dataSource ignores disallowed values (dropping them), dataSourceRef preserves all values, and generates an error if a disallowed value is specified. * While dataSource only allows local objects, dataSourceRef allows objects in any namespaces. (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.",
1990 )
1991 resources: Optional[Resources] = Field(
1992 default=None,
1993 description="resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources",
1994 )
1995 selector: Optional[Selector] = Field(
1996 default=None,
1997 description="selector is a label query over volumes to consider for binding.",
1998 )
1999 storageClassName: Optional[str] = Field(
2000 default=None,
2001 alias="storage_class_name",
2002 description="storageClassName is the name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1",
2003 )
2004 volumeAttributesClassName: Optional[str] = Field(
2005 default=None,
2006 alias="volume_attributes_class_name",
2007 description="volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass will be applied to the claim but it's not allowed to reset this field to empty string once it is set. If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass will be set by the persistentvolume controller if it exists. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/ (Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).",
2008 )
2009 volumeMode: Optional[str] = Field(
2010 default=None,
2011 alias="volume_mode",
2012 description="volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec.",
2013 )
2014 volumeName: Optional[str] = Field(
2015 default=None,
2016 alias="volume_name",
2017 description="volumeName is the binding reference to the PersistentVolume backing this claim.",
2018 )
2019
2020
[docs]
2021class VolumeClaimTemplate(BaseModel):
2022 """Will be used to create a stand-alone PVC to provision the volume. The pod in which this EphemeralVolumeSource is embedded will be the owner of the PVC, i.e. the PVC will be deleted together with the pod. The name of the PVC will be `<pod name>-<volume name>` where `<volume name>` is the name from the `PodSpec.Volumes` array entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until the unrelated PVC is removed. If such a pre-created PVC is meant to be used by the pod, the PVC has to updated with an owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. Required, must not be nil."""
2023
2024 model_config = ConfigDict(extra="forbid")
2025
2026 metadata: Optional[Metadata] = Field(
2027 default=None,
2028 description="May contain labels and annotations that will be copied into the PVC when creating it. No other fields are allowed and will be rejected during validation.",
2029 )
2030 volumeClaimTemplateSpec: VolumeClaimTemplateSpec = Field(
2031 alias="volume_claim_template_spec",
2032 description="The specification for the PersistentVolumeClaim. The entire content is copied unchanged into the PVC that gets created from this template. The same fields as in a PersistentVolumeClaim are also valid here.",
2033 )
2034
2035
[docs]
2036class Ephemeral(BaseModel):
2037 """ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity tracking are needed, c) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through a PersistentVolumeClaim (see EphemeralVolumeSource for more information on the connection between this volume type and PersistentVolumeClaim). Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. A pod can use both types of ephemeral volumes and persistent volumes at the same time."""
2038
2039 model_config = ConfigDict(extra="forbid")
2040
2041 volumeClaimTemplate: Optional[VolumeClaimTemplate] = Field(
2042 default=None,
2043 alias="volume_claim_template",
2044 description="Will be used to create a stand-alone PVC to provision the volume. The pod in which this EphemeralVolumeSource is embedded will be the owner of the PVC, i.e. the PVC will be deleted together with the pod. The name of the PVC will be `<pod name>-<volume name>` where `<volume name>` is the name from the `PodSpec.Volumes` array entry. Pod validation will reject the pod if the concatenated name is not valid for a PVC (for example, too long). An existing PVC with that name that is not owned by the pod will *not* be used for the pod to avoid using an unrelated volume by mistake. Starting the pod is then blocked until the unrelated PVC is removed. If such a pre-created PVC is meant to be used by the pod, the PVC has to updated with an owner reference to the pod once the pod exists. Normally this should not be necessary, but it may be useful when manually reconstructing a broken cluster. This field is read-only and no changes will be made by Kubernetes to the PVC after it has been created. Required, must not be nil.",
2045 )
2046
2047
[docs]
2048class Fc(BaseModel):
2049 """fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod."""
2050
2051 model_config = ConfigDict(extra="forbid")
2052
2053 fsType: Optional[str] = Field(
2054 default=None,
2055 alias="fs_type",
2056 description='fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.',
2057 )
2058 lun: Optional[int] = Field(
2059 default=None, description="lun is Optional: FC target lun number"
2060 )
2061 readOnly: Optional[bool] = Field(
2062 default=None,
2063 alias="read_only",
2064 description="readOnly is Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
2065 )
2066 targetWWNs: Optional[List[str]] = Field(
2067 default=None,
2068 alias="target_wwns",
2069 description="targetWWNs is Optional: FC target worldwide names (WWNs)",
2070 )
2071 wwids: Optional[List[str]] = Field(
2072 default=None,
2073 description="wwids Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously.",
2074 )
2075
2076
[docs]
2077class FlexVolume(BaseModel):
2078 """flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin."""
2079
2080 model_config = ConfigDict(extra="forbid")
2081
2082 driver: str = Field(
2083 description="driver is the name of the driver to use for this volume."
2084 )
2085 fsType: Optional[str] = Field(
2086 default=None,
2087 alias="fs_type",
2088 description='fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script.',
2089 )
2090 options: Optional[Dict[str, str]] = Field(
2091 default=None,
2092 description="options is Optional: this field holds extra command options if any.",
2093 )
2094 readOnly: Optional[bool] = Field(
2095 default=None,
2096 alias="read_only",
2097 description="readOnly is Optional: defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
2098 )
2099 secretRef: Optional[SecretRef] = Field(
2100 default=None,
2101 alias="secret_ref",
2102 description="secretRef is Optional: secretRef is reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.",
2103 )
2104
2105
[docs]
2106class Flocker(BaseModel):
2107 """flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running"""
2108
2109 model_config = ConfigDict(extra="forbid")
2110
2111 datasetName: Optional[str] = Field(
2112 default=None,
2113 alias="dataset_name",
2114 description="datasetName is Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated",
2115 )
2116 datasetUUID: Optional[str] = Field(
2117 default=None,
2118 alias="dataset_uuid",
2119 description="datasetUUID is the UUID of the dataset. This is unique identifier of a Flocker dataset",
2120 )
2121
2122
[docs]
2123class GcePersistentDisk(BaseModel):
2124 """gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk"""
2125
2126 model_config = ConfigDict(extra="forbid")
2127
2128 fsType: Optional[str] = Field(
2129 default=None,
2130 alias="fs_type",
2131 description='fsType is filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk',
2132 )
2133 partition: Optional[int] = Field(
2134 default=None,
2135 description='partition is the partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk',
2136 )
2137 pdName: str = Field(
2138 alias="pd_name",
2139 description="pdName is unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk",
2140 )
2141 readOnly: Optional[bool] = Field(
2142 default=None,
2143 alias="read_only",
2144 description="readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk",
2145 )
2146
2147
[docs]
2148class GitRepo(BaseModel):
2149 """gitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container."""
2150
2151 model_config = ConfigDict(extra="forbid")
2152
2153 directory: Optional[str] = Field(
2154 default=None,
2155 description="directory is the target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.",
2156 )
2157 repository: str = Field(description="repository is the URL")
2158 revision: Optional[str] = Field(
2159 default=None,
2160 description="revision is the commit hash for the specified revision.",
2161 )
2162
2163
[docs]
2164class Glusterfs(BaseModel):
2165 """glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md"""
2166
2167 model_config = ConfigDict(extra="forbid")
2168
2169 endpoints: str = Field(
2170 description="endpoints is the endpoint name that details Glusterfs topology. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod"
2171 )
2172 path: str = Field(
2173 description="path is the Glusterfs volume path. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod"
2174 )
2175 readOnly: Optional[bool] = Field(
2176 default=None,
2177 alias="read_only",
2178 description="readOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod",
2179 )
2180
2181
[docs]
2182class HostPath(BaseModel):
2183 """hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath"""
2184
2185 model_config = ConfigDict(extra="forbid")
2186
2187 path: str = Field(
2188 description="path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath"
2189 )
2190 type: Optional[str] = Field(
2191 default=None,
2192 description='type for HostPath Volume Defaults to "" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath',
2193 )
2194
2195
[docs]
2196class Image(BaseModel):
2197 """image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath). The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type."""
2198
2199 model_config = ConfigDict(extra="forbid")
2200
2201 pullPolicy: Optional[str] = Field(
2202 default=None,
2203 alias="pull_policy",
2204 description="Policy for pulling OCI objects. Possible values are: Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.",
2205 )
2206 reference: Optional[str] = Field(
2207 default=None,
2208 description="Required: Image or artifact reference to be used. Behaves in the same way as pod.spec.containers[*].image. Pull secrets will be assembled in the same way as for the container image by looking up node credentials, SA image pull secrets, and pod spec image pull secrets. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.",
2209 )
2210
2211
[docs]
2212class Iscsi(BaseModel):
2213 """iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md"""
2214
2215 model_config = ConfigDict(extra="forbid")
2216
2217 chapAuthDiscovery: Optional[bool] = Field(
2218 default=None,
2219 alias="chap_auth_discovery",
2220 description="chapAuthDiscovery defines whether support iSCSI Discovery CHAP authentication",
2221 )
2222 chapAuthSession: Optional[bool] = Field(
2223 default=None,
2224 alias="chap_auth_session",
2225 description="chapAuthSession defines whether support iSCSI Session CHAP authentication",
2226 )
2227 fsType: Optional[str] = Field(
2228 default=None,
2229 alias="fs_type",
2230 description='fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#iscsi',
2231 )
2232 initiatorName: Optional[str] = Field(
2233 default=None,
2234 alias="initiator_name",
2235 description="initiatorName is the custom iSCSI Initiator Name. If initiatorName is specified with iscsiInterface simultaneously, new iSCSI interface <target portal>:<volume name> will be created for the connection.",
2236 )
2237 iqn: str = Field(description="iqn is the target iSCSI Qualified Name.")
2238 iscsiInterface: Optional[str] = Field(
2239 default="default",
2240 alias="iscsi_interface",
2241 description="iscsiInterface is the interface Name that uses an iSCSI transport. Defaults to 'default' (tcp).",
2242 )
2243 lun: int = Field(description="lun represents iSCSI Target Lun number.")
2244 portals: Optional[List[str]] = Field(
2245 default=None,
2246 description="portals is the iSCSI Target Portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).",
2247 )
2248 readOnly: Optional[bool] = Field(
2249 default=None,
2250 alias="read_only",
2251 description="readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.",
2252 )
2253 secretRef: Optional[SecretRef] = Field(
2254 default=None,
2255 alias="secret_ref",
2256 description="secretRef is the CHAP Secret for iSCSI target and initiator authentication",
2257 )
2258 targetPortal: str = Field(
2259 alias="target_portal",
2260 description="targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).",
2261 )
2262
2263
[docs]
2264class Nfs(BaseModel):
2265 """nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs"""
2266
2267 model_config = ConfigDict(extra="forbid")
2268
2269 path: str = Field(
2270 description="path that is exported by the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs"
2271 )
2272 readOnly: Optional[bool] = Field(
2273 default=None,
2274 alias="read_only",
2275 description="readOnly here will force the NFS export to be mounted with read-only permissions. Defaults to false. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs",
2276 )
2277 server: str = Field(
2278 description="server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs"
2279 )
2280
2281
[docs]
2282class PersistentVolumeClaim(BaseModel):
2283 """persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims"""
2284
2285 model_config = ConfigDict(extra="forbid")
2286
2287 claimName: str = Field(
2288 alias="claim_name",
2289 description="claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims",
2290 )
2291 readOnly: Optional[bool] = Field(
2292 default=None,
2293 alias="read_only",
2294 description="readOnly Will force the ReadOnly setting in VolumeMounts. Default false.",
2295 )
2296
2297
[docs]
2298class PhotonPersistentDisk(BaseModel):
2299 """photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine"""
2300
2301 model_config = ConfigDict(extra="forbid")
2302
2303 fsType: Optional[str] = Field(
2304 default=None,
2305 alias="fs_type",
2306 description='fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.',
2307 )
2308 pdID: str = Field(
2309 alias="pd_id",
2310 description="pdID is the ID that identifies Photon Controller persistent disk",
2311 )
2312
2313
[docs]
2314class PortworxVolume(BaseModel):
2315 """portworxVolume represents a portworx volume attached and mounted on kubelets host machine"""
2316
2317 model_config = ConfigDict(extra="forbid")
2318
2319 fsType: Optional[str] = Field(
2320 default=None,
2321 alias="fs_type",
2322 description='fSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified.',
2323 )
2324 readOnly: Optional[bool] = Field(
2325 default=None,
2326 alias="read_only",
2327 description="readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
2328 )
2329 volumeID: str = Field(
2330 alias="volume_id", description="volumeID uniquely identifies a Portworx volume"
2331 )
2332
2333
[docs]
2334class ClusterTrustBundle(BaseModel):
2335 """ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. Alpha, gated by the ClusterTrustBundleProjection feature gate. ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. The ordering of certificates within the file is arbitrary, and Kubelet may change the order over time."""
2336
2337 model_config = ConfigDict(extra="forbid")
2338
2339 labelSelector: Optional[LabelSelector] = Field(
2340 default=None,
2341 alias="label_selector",
2342 description='Select all ClusterTrustBundles that match this label selector. Only has effect if signerName is set. Mutually-exclusive with name. If unset, interpreted as "match nothing". If set but empty, interpreted as "match everything".',
2343 )
2344 name: Optional[str] = Field(
2345 default=None,
2346 description="Select a single ClusterTrustBundle by object name. Mutually-exclusive with signerName and labelSelector.",
2347 )
2348 optional: Optional[bool] = Field(
2349 default=None,
2350 description="If true, don't block pod startup if the referenced ClusterTrustBundle(s) aren't available. If using name, then the named ClusterTrustBundle is allowed not to exist. If using signerName, then the combination of signerName and labelSelector is allowed to match zero ClusterTrustBundles.",
2351 )
2352 path: str = Field(
2353 description="Relative path from the volume root to write the bundle."
2354 )
2355 signerName: Optional[str] = Field(
2356 default=None,
2357 alias="signer_name",
2358 description="Select all ClusterTrustBundles that match this signer name. Mutually-exclusive with name. The contents of all selected ClusterTrustBundles will be unified and deduplicated.",
2359 )
2360
2361
[docs]
2362class Secret(BaseModel):
2363 """secret information about the secret data to project"""
2364
2365 model_config = ConfigDict(extra="forbid")
2366
2367 items: Optional[List[Items]] = Field(
2368 default=None,
2369 description="items if unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the Secret, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.",
2370 )
2371 name: Optional[str] = Field(
2372 default="",
2373 description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
2374 )
2375 optional: Optional[bool] = Field(
2376 default=None,
2377 description="optional field specify whether the Secret or its key must be defined",
2378 )
2379
2380
[docs]
2381class ServiceAccountToken(BaseModel):
2382 """serviceAccountToken is information about the serviceAccountToken data to project"""
2383
2384 model_config = ConfigDict(extra="forbid")
2385
2386 audience: Optional[str] = Field(
2387 default=None,
2388 description="audience is the intended audience of the token. A recipient of a token must identify itself with an identifier specified in the audience of the token, and otherwise should reject the token. The audience defaults to the identifier of the apiserver.",
2389 )
2390 expirationSeconds: Optional[int] = Field(
2391 default=None,
2392 alias="expiration_seconds",
2393 description="expirationSeconds is the requested duration of validity of the service account token. As the token approaches expiration, the kubelet volume plugin will proactively rotate the service account token. The kubelet will start trying to rotate the token if the token is older than 80 percent of its time to live or if the token is older than 24 hours.Defaults to 1 hour and must be at least 10 minutes.",
2394 )
2395 path: str = Field(
2396 description="path is the path relative to the mount point of the file to project the token into."
2397 )
2398
2399
[docs]
2400class Sources(BaseModel):
2401 """Projection that may be projected along with other supported volume types. Exactly one of these fields must be set."""
2402
2403 model_config = ConfigDict(extra="forbid")
2404
2405 clusterTrustBundle: Optional[ClusterTrustBundle] = Field(
2406 default=None,
2407 alias="cluster_trust_bundle",
2408 description="ClusterTrustBundle allows a pod to access the `.spec.trustBundle` field of ClusterTrustBundle objects in an auto-updating file. Alpha, gated by the ClusterTrustBundleProjection feature gate. ClusterTrustBundle objects can either be selected by name, or by the combination of signer name and a label selector. Kubelet performs aggressive normalization of the PEM contents written into the pod filesystem. Esoteric PEM features such as inter-block comments and block headers are stripped. Certificates are deduplicated. The ordering of certificates within the file is arbitrary, and Kubelet may change the order over time.",
2409 )
2410 configMap: Optional[ConfigMap] = Field(
2411 default=None,
2412 alias="config_map",
2413 description="configMap information about the configMap data to project",
2414 )
2415 downwardAPI: Optional[DownwardApi] = Field(
2416 default=None,
2417 alias="downward_api",
2418 description="downwardAPI information about the downwardAPI data to project",
2419 )
2420 secret: Optional[Secret] = Field(
2421 default=None, description="secret information about the secret data to project"
2422 )
2423 serviceAccountToken: Optional[ServiceAccountToken] = Field(
2424 default=None,
2425 alias="service_account_token",
2426 description="serviceAccountToken is information about the serviceAccountToken data to project",
2427 )
2428
2429
[docs]
2430class Projected(BaseModel):
2431 """projected items for all in one resources secrets, configmaps, and downward API"""
2432
2433 model_config = ConfigDict(extra="forbid")
2434
2435 defaultMode: Optional[int] = Field(
2436 default=None,
2437 alias="default_mode",
2438 description="defaultMode are the mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.",
2439 )
2440 sources: Optional[List[Sources]] = Field(
2441 default=None,
2442 description="sources is the list of volume projections. Each entry in this list handles one source.",
2443 )
2444
2445
[docs]
2446class Quobyte(BaseModel):
2447 """quobyte represents a Quobyte mount on the host that shares a pod's lifetime"""
2448
2449 model_config = ConfigDict(extra="forbid")
2450
2451 group: Optional[str] = Field(
2452 default=None, description="group to map volume access to Default is no group"
2453 )
2454 readOnly: Optional[bool] = Field(
2455 default=None,
2456 alias="read_only",
2457 description="readOnly here will force the Quobyte volume to be mounted with read-only permissions. Defaults to false.",
2458 )
2459 registry: str = Field(
2460 description="registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes"
2461 )
2462 tenant: Optional[str] = Field(
2463 default=None,
2464 description="tenant owning the given Quobyte volume in the Backend Used with dynamically provisioned Quobyte volumes, value is set by the plugin",
2465 )
2466 user: Optional[str] = Field(
2467 default=None,
2468 description="user to map volume access to Defaults to serivceaccount user",
2469 )
2470 volume: str = Field(
2471 description="volume is a string that references an already created Quobyte volume by name."
2472 )
2473
2474
[docs]
2475class Rbd(BaseModel):
2476 """rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md"""
2477
2478 model_config = ConfigDict(extra="forbid")
2479
2480 fsType: Optional[str] = Field(
2481 default=None,
2482 alias="fs_type",
2483 description='fsType is the filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd',
2484 )
2485 image: str = Field(
2486 description="image is the rados image name. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it"
2487 )
2488 keyring: Optional[str] = Field(
2489 default="/etc/ceph/keyring",
2490 description="keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it",
2491 )
2492 monitors: List[str] = Field(
2493 description="monitors is a collection of Ceph monitors. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it"
2494 )
2495 pool: Optional[str] = Field(
2496 default="rbd",
2497 description="pool is the rados pool name. Default is rbd. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it",
2498 )
2499 readOnly: Optional[bool] = Field(
2500 default=None,
2501 alias="read_only",
2502 description="readOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it",
2503 )
2504 secretRef: Optional[SecretRef] = Field(
2505 default=None,
2506 alias="secret_ref",
2507 description="secretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it",
2508 )
2509 user: Optional[str] = Field(
2510 default="admin",
2511 description="user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it",
2512 )
2513
2514
[docs]
2515class ScaleIo(BaseModel):
2516 """scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."""
2517
2518 model_config = ConfigDict(extra="forbid")
2519
2520 fsType: Optional[str] = Field(
2521 default="xfs",
2522 alias="fs_type",
2523 description='fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Default is "xfs".',
2524 )
2525 gateway: str = Field(
2526 description="gateway is the host address of the ScaleIO API Gateway."
2527 )
2528 protectionDomain: Optional[str] = Field(
2529 default=None,
2530 alias="protection_domain",
2531 description="protectionDomain is the name of the ScaleIO Protection Domain for the configured storage.",
2532 )
2533 readOnly: Optional[bool] = Field(
2534 default=None,
2535 alias="read_only",
2536 description="readOnly Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
2537 )
2538 secretRef: SecretRef = Field(
2539 alias="secret_ref",
2540 description="secretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.",
2541 )
2542 sslEnabled: Optional[bool] = Field(
2543 default=None,
2544 alias="ssl_enabled",
2545 description="sslEnabled Flag enable/disable SSL communication with Gateway, default false",
2546 )
2547 storageMode: Optional[str] = Field(
2548 default="ThinProvisioned",
2549 alias="storage_mode",
2550 description="storageMode indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned. Default is ThinProvisioned.",
2551 )
2552 storagePool: Optional[str] = Field(
2553 default=None,
2554 alias="storage_pool",
2555 description="storagePool is the ScaleIO Storage Pool associated with the protection domain.",
2556 )
2557 system: str = Field(
2558 description="system is the name of the storage system as configured in ScaleIO."
2559 )
2560 volumeName: Optional[str] = Field(
2561 default=None,
2562 alias="volume_name",
2563 description="volumeName is the name of a volume already created in the ScaleIO system that is associated with this volume source.",
2564 )
2565
2566
[docs]
2567class Storageos(BaseModel):
2568 """storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes."""
2569
2570 model_config = ConfigDict(extra="forbid")
2571
2572 fsType: Optional[str] = Field(
2573 default=None,
2574 alias="fs_type",
2575 description='fsType is the filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.',
2576 )
2577 readOnly: Optional[bool] = Field(
2578 default=None,
2579 alias="read_only",
2580 description="readOnly defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
2581 )
2582 secretRef: Optional[SecretRef] = Field(
2583 default=None,
2584 alias="secret_ref",
2585 description="secretRef specifies the secret to use for obtaining the StorageOS API credentials. If not specified, default values will be attempted.",
2586 )
2587 volumeName: Optional[str] = Field(
2588 default=None,
2589 alias="volume_name",
2590 description="volumeName is the human-readable name of the StorageOS volume. Volume names are only unique within a namespace.",
2591 )
2592 volumeNamespace: Optional[str] = Field(
2593 default=None,
2594 alias="volume_namespace",
2595 description='volumeNamespace specifies the scope of the volume within StorageOS. If no namespace is specified then the Pod\'s namespace will be used. This allows the Kubernetes name scoping to be mirrored within StorageOS for tighter integration. Set VolumeName to any name to override the default behaviour. Set to "default" if you are not using namespaces within StorageOS. Namespaces that do not pre-exist within StorageOS will be created.',
2596 )
2597
2598
[docs]
2599class VsphereVolume(BaseModel):
2600 """vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine"""
2601
2602 model_config = ConfigDict(extra="forbid")
2603
2604 fsType: Optional[str] = Field(
2605 default=None,
2606 alias="fs_type",
2607 description='fsType is filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.',
2608 )
2609 storagePolicyID: Optional[str] = Field(
2610 default=None,
2611 alias="storage_policy_id",
2612 description="storagePolicyID is the storage Policy Based Management (SPBM) profile ID associated with the StoragePolicyName.",
2613 )
2614 storagePolicyName: Optional[str] = Field(
2615 default=None,
2616 alias="storage_policy_name",
2617 description="storagePolicyName is the storage Policy Based Management (SPBM) profile name.",
2618 )
2619 volumePath: str = Field(
2620 alias="volume_path",
2621 description="volumePath is the path that identifies vSphere volume vmdk",
2622 )
2623
2624
[docs]
2625class Volumes(BaseModel):
2626 """Volume represents a named volume in a pod that may be accessed by any container in the pod."""
2627
2628 model_config = ConfigDict(extra="forbid")
2629
2630 awsElasticBlockStore: Optional[AwsElasticBlockStore] = Field(
2631 default=None,
2632 alias="aws_elastic_block_store",
2633 description="awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore",
2634 )
2635 azureDisk: Optional[AzureDisk] = Field(
2636 default=None,
2637 alias="azure_disk",
2638 description="azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.",
2639 )
2640 azureFile: Optional[AzureFile] = Field(
2641 default=None,
2642 alias="azure_file",
2643 description="azureFile represents an Azure File Service mount on the host and bind mount to the pod.",
2644 )
2645 cephfs: Optional[Cephfs] = Field(
2646 default=None,
2647 description="cephFS represents a Ceph FS mount on the host that shares a pod's lifetime",
2648 )
2649 cinder: Optional[Cinder] = Field(
2650 default=None,
2651 description="cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md",
2652 )
2653 configMap: Optional[ConfigMap] = Field(
2654 default=None,
2655 alias="config_map",
2656 description="configMap represents a configMap that should populate this volume",
2657 )
2658 csi: Optional[Csi] = Field(
2659 default=None,
2660 description="csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature).",
2661 )
2662 downwardAPI: Optional[DownwardApi] = Field(
2663 default=None,
2664 alias="downward_api",
2665 description="downwardAPI represents downward API about the pod that should populate this volume",
2666 )
2667 emptyDir: Optional[EmptyDir] = Field(
2668 default=None,
2669 alias="empty_dir",
2670 description="emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir",
2671 )
2672 ephemeral: Optional[Ephemeral] = Field(
2673 default=None,
2674 description="ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed. Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity tracking are needed, c) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through a PersistentVolumeClaim (see EphemeralVolumeSource for more information on the connection between this volume type and PersistentVolumeClaim). Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod. Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information. A pod can use both types of ephemeral volumes and persistent volumes at the same time.",
2675 )
2676 fc: Optional[Fc] = Field(
2677 default=None,
2678 description="fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.",
2679 )
2680 flexVolume: Optional[FlexVolume] = Field(
2681 default=None,
2682 alias="flex_volume",
2683 description="flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.",
2684 )
2685 flocker: Optional[Flocker] = Field(
2686 default=None,
2687 description="flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running",
2688 )
2689 gcePersistentDisk: Optional[GcePersistentDisk] = Field(
2690 default=None,
2691 alias="gce_persistent_disk",
2692 description="gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk",
2693 )
2694 gitRepo: Optional[GitRepo] = Field(
2695 default=None,
2696 alias="git_repo",
2697 description="gitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.",
2698 )
2699 glusterfs: Optional[Glusterfs] = Field(
2700 default=None,
2701 description="glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md",
2702 )
2703 hostPath: Optional[HostPath] = Field(
2704 default=None,
2705 alias="host_path",
2706 description="hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath",
2707 )
2708 image: Optional[Image] = Field(
2709 default=None,
2710 description="image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided: - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails. The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath). The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.",
2711 )
2712 iscsi: Optional[Iscsi] = Field(
2713 default=None,
2714 description="iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md",
2715 )
2716 name: str = Field(
2717 description="name of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names"
2718 )
2719 nfs: Optional[Nfs] = Field(
2720 default=None,
2721 description="nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs",
2722 )
2723 persistentVolumeClaim: Optional[PersistentVolumeClaim] = Field(
2724 default=None,
2725 alias="persistent_volume_claim",
2726 description="persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims",
2727 )
2728 photonPersistentDisk: Optional[PhotonPersistentDisk] = Field(
2729 default=None,
2730 alias="photon_persistent_disk",
2731 description="photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
2732 )
2733 portworxVolume: Optional[PortworxVolume] = Field(
2734 default=None,
2735 alias="portworx_volume",
2736 description="portworxVolume represents a portworx volume attached and mounted on kubelets host machine",
2737 )
2738 projected: Optional[Projected] = Field(
2739 default=None,
2740 description="projected items for all in one resources secrets, configmaps, and downward API",
2741 )
2742 quobyte: Optional[Quobyte] = Field(
2743 default=None,
2744 description="quobyte represents a Quobyte mount on the host that shares a pod's lifetime",
2745 )
2746 rbd: Optional[Rbd] = Field(
2747 default=None,
2748 description="rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md",
2749 )
2750 scaleIO: Optional[ScaleIo] = Field(
2751 default=None,
2752 alias="scale_io",
2753 description="scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
2754 )
2755 secret: Optional[Secret] = Field(
2756 default=None,
2757 description="secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret",
2758 )
2759 storageos: Optional[Storageos] = Field(
2760 default=None,
2761 description="storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes.",
2762 )
2763 vsphereVolume: Optional[VsphereVolume] = Field(
2764 default=None,
2765 alias="vsphere_volume",
2766 description="vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine",
2767 )
2768
2769
[docs]
2770class Spec(BaseModel):
2771 """Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status"""
2772
2773 model_config = ConfigDict(extra="forbid")
2774
2775 activeDeadlineSeconds: Optional[int] = Field(
2776 default=None,
2777 alias="active_deadline_seconds",
2778 description="Optional duration in seconds the pod may be active on the node relative to StartTime before the system will actively try to mark it failed and kill associated containers. Value must be a positive integer.",
2779 )
2780 affinity: Optional[Affinity] = Field(
2781 default=None, description="If specified, the pod's scheduling constraints"
2782 )
2783 automountServiceAccountToken: Optional[bool] = Field(
2784 default=None,
2785 alias="automount_service_account_token",
2786 description="AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.",
2787 )
2788 containers: List[Containers] = Field(
2789 description="List of containers belonging to the pod. Containers cannot currently be added or removed. There must be at least one container in a Pod. Cannot be updated."
2790 )
2791 dnsConfig: Optional[DnsConfig] = Field(
2792 default=None,
2793 alias="dns_config",
2794 description="Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy.",
2795 )
2796 dnsPolicy: Optional[str] = Field(
2797 default=None,
2798 alias="dns_policy",
2799 description="Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.",
2800 )
2801 enableServiceLinks: Optional[bool] = Field(
2802 default=None,
2803 alias="enable_service_links",
2804 description="EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.",
2805 )
2806 ephemeralContainers: Optional[List[EphemeralContainers]] = Field(
2807 default=None,
2808 alias="ephemeral_containers",
2809 description="List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource.",
2810 )
2811 hostAliases: Optional[List[HostAliases]] = Field(
2812 default=None,
2813 alias="host_aliases",
2814 description="HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified.",
2815 )
2816 hostIPC: Optional[bool] = Field(
2817 default=None,
2818 alias="host_ipc",
2819 description="Use the host's ipc namespace. Optional: Default to false.",
2820 )
2821 hostNetwork: Optional[bool] = Field(
2822 default=None,
2823 alias="host_network",
2824 description="Host networking requested for this pod. Use the host's network namespace. If this option is set, the ports that will be used must be specified. Default to false.",
2825 )
2826 hostPID: Optional[bool] = Field(
2827 default=None,
2828 alias="host_pid",
2829 description="Use the host's pid namespace. Optional: Default to false.",
2830 )
2831 hostUsers: Optional[bool] = Field(
2832 default=None,
2833 alias="host_users",
2834 description="Use the host's user namespace. Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature.",
2835 )
2836 hostname: Optional[str] = Field(
2837 default=None,
2838 description="Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.",
2839 )
2840 imagePullSecrets: Optional[List[ImagePullSecrets]] = Field(
2841 default=None,
2842 alias="image_pull_secrets",
2843 description="ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod",
2844 )
2845 initContainers: Optional[List[InitContainers]] = Field(
2846 default=None,
2847 alias="init_containers",
2848 description="List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/",
2849 )
2850 nodeName: Optional[str] = Field(
2851 default=None,
2852 alias="node_name",
2853 description="NodeName indicates in which node this pod is scheduled. If empty, this pod is a candidate for scheduling by the scheduler defined in schedulerName. Once this field is set, the kubelet for this node becomes responsible for the lifecycle of this pod. This field should not be used to express a desire for the pod to be scheduled on a specific node. https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename",
2854 )
2855 nodeSelector: Optional[Dict[str, str]] = Field(
2856 default=None,
2857 alias="node_selector",
2858 description="NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/",
2859 )
2860 os: Optional[Os] = Field(
2861 default=None,
2862 description="Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set. If the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions If the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.securityContext.appArmorProfile - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.securityContext.supplementalGroupsPolicy - spec.containers[*].securityContext.appArmorProfile - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup",
2863 )
2864 overhead: Optional[Dict[str, Union[int, str]]] = Field(
2865 default=None,
2866 description="Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
2867 )
2868 preemptionPolicy: Optional[str] = Field(
2869 default=None,
2870 alias="preemption_policy",
2871 description="PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.",
2872 )
2873 priority: Optional[int] = Field(
2874 default=None,
2875 description="The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.",
2876 )
2877 priorityClassName: Optional[str] = Field(
2878 default=None,
2879 alias="priority_class_name",
2880 description='If specified, indicates the pod\'s priority. "system-node-critical" and "system-cluster-critical" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.',
2881 )
2882 readinessGates: Optional[List[ReadinessGates]] = Field(
2883 default=None,
2884 alias="readiness_gates",
2885 description='If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to "True" More info: https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates',
2886 )
2887 resourceClaims: Optional[List[ResourceClaims]] = Field(
2888 default=None,
2889 alias="resource_claims",
2890 description="ResourceClaims defines which ResourceClaims must be allocated and reserved before the Pod is allowed to start. The resources will be made available to those containers which consume them by name. This is an alpha field and requires enabling the DynamicResourceAllocation feature gate. This field is immutable.",
2891 )
2892 restartPolicy: Optional[str] = Field(
2893 default=None,
2894 alias="restart_policy",
2895 description="Restart policy for all containers within the pod. One of Always, OnFailure, Never. In some contexts, only a subset of those values may be permitted. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy",
2896 )
2897 runtimeClassName: Optional[str] = Field(
2898 default=None,
2899 alias="runtime_class_name",
2900 description='RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class',
2901 )
2902 schedulerName: Optional[str] = Field(
2903 default=None,
2904 alias="scheduler_name",
2905 description="If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.",
2906 )
2907 schedulingGates: Optional[List[SchedulingGates]] = Field(
2908 default=None,
2909 alias="scheduling_gates",
2910 description="SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod. SchedulingGates can only be set at pod creation time, and be removed only afterwards.",
2911 )
2912 securityContext: Optional[SecurityContext] = Field(
2913 default=None,
2914 alias="security_context",
2915 description="SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field.",
2916 )
2917 serviceAccount: Optional[str] = Field(
2918 default=None,
2919 alias="service_account",
2920 description="DeprecatedServiceAccount is a deprecated alias for ServiceAccountName. Deprecated: Use serviceAccountName instead.",
2921 )
2922 serviceAccountName: Optional[str] = Field(
2923 default=None,
2924 alias="service_account_name",
2925 description="ServiceAccountName is the name of the ServiceAccount to use to run this pod. More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/",
2926 )
2927 setHostnameAsFQDN: Optional[bool] = Field(
2928 default=None,
2929 alias="set_hostname_as_fqdn",
2930 description="If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false.",
2931 )
2932 shareProcessNamespace: Optional[bool] = Field(
2933 default=None,
2934 alias="share_process_namespace",
2935 description="Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false.",
2936 )
2937 subdomain: Optional[str] = Field(
2938 default=None,
2939 description='If specified, the fully qualified Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>". If not specified, the pod will not have a domainname at all.',
2940 )
2941 terminationGracePeriodSeconds: Optional[int] = Field(
2942 default=None,
2943 alias="termination_grace_period_seconds",
2944 description="Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.",
2945 )
2946 tolerations: Optional[List[Tolerations]] = Field(
2947 default=None, description="If specified, the pod's tolerations."
2948 )
2949 topologySpreadConstraints: Optional[List[TopologySpreadConstraints]] = Field(
2950 default=None,
2951 alias="topology_spread_constraints",
2952 description="TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed.",
2953 )
2954 volumes: Optional[List[Volumes]] = Field(
2955 default=None,
2956 description="List of volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes",
2957 )
2958
2959
[docs]
2960class Template(BaseModel):
2961 """template is the Pod template. The only allowed fields in template.metadata are labels and annotations. If requests are omitted for a container or initContainer, they default to the limits if they are explicitly specified for the container or initContainer. During admission, the rules in nodeSelector and nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution that match the keys in the nodeLabels from the ResourceFlavors considered for this Workload are used to filter the ResourceFlavors that can be assigned to this podSet."""
2962
2963 model_config = ConfigDict(extra="forbid")
2964
2965 metadata: Optional[Metadata] = Field(
2966 default=None,
2967 description="Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
2968 )
2969 spec: Optional[Spec] = Field(
2970 default=None,
2971 description="Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
2972 )
2973
2974
[docs]
2975class ReplicaSpec(BaseModel):
2976 """ReplicaSpec is a description of the replica"""
2977
2978 model_config = ConfigDict(extra="forbid")
2979
2980 name: str = Field(description="The name for the replica set")
2981 replicas: Optional[int] = Field(
2982 default=0,
2983 description="Replicas is the desired number of replicas of the given template.",
2984 )
2985 maxReplicas: Optional[int] = Field(
2986 default=None,
2987 alias="max_replicas",
2988 description="Maximum replicas for elastic training"
2989 )
2990 spares: Optional[int] = Field(
2991 default=0,
2992 description="Spares requests spare resources from Kueue. E.g. If a job is configured with 4 replicas and 2 spares, job requests resources required to run 6 pods such as cpu, gpu",
2993 )
2994 template: Optional[Template] = Field(
2995 default=None,
2996 description="Template is the object that describes the pod that will be created for this replica.",
2997 )
2998
[docs]
2999class ElasticPolicy(BaseModel):
3000 """ElasticPolicy defines the elastic training policy"""
3001
3002 model_config = ConfigDict(extra="forbid")
3003
3004 minReplicas: Optional[int] = Field(
3005 default=None,
3006 alias="min_replicas",
3007 description="Minimum number of replicas"
3008 )
3009 maxReplicas: Optional[int] = Field(
3010 default=None,
3011 alias="max_replicas",
3012 description="Maximum number of replicas"
3013 )
3014 replicaIncrementStep: Optional[int] = Field(
3015 default=None,
3016 alias="replica_increment_step",
3017 description="Step size for elastic replica scaling"
3018 )
3019 replicaDiscreteValues: Optional[List[int]] = Field(
3020 default=None,
3021 alias="replica_discrete_values",
3022 description="Alternative to ReplicaIncrementStep. Provides exact values for total replicas count"
3023 )
3024 scalingTimeoutInSeconds: Optional[int] = Field(
3025 default=None,
3026 alias="scaling_timeout_in_seconds",
3027 description="Timeout for scaling operations"
3028 )
3029 gracefulShutdownTimeoutInSeconds: Optional[int] = Field(
3030 default=None,
3031 alias="graceful_shutdown_timeout_in_seconds",
3032 description="Graceful shutdown timeout in seconds for elastic scaling operations"
3033 )
3034 faultyScaleDownTimeoutInSeconds: Optional[int] = Field(
3035 default=None,
3036 alias="faulty_scale_down_timeout_in_seconds",
3037 description="Timeout in seconds after entering Faulted state before triggering faulty pod scale-down"
3038 )
3039
3040
[docs]
3041class LogMonitoringConfiguration(BaseModel):
3042 """LogMonitoringRule defines the criteria used to detect a SLOW or HANGING job"""
3043
3044 model_config = ConfigDict(extra="forbid")
3045
3046 expectedRecurringFrequencyInSeconds: Optional[int] = Field(
3047 default=None,
3048 alias="expected_recurring_frequency_in_seconds",
3049 description="Time interval between two subsequent matches for LogPattern beyond which, the rule evaluates to HANGING. When not specified, there is no constraint on duration between two subsequent matches for LogPattern.",
3050 )
3051 expectedStartCutOffInSeconds: Optional[int] = Field(
3052 default=None,
3053 alias="expected_start_cut_off_in_seconds",
3054 description="Time to first match for LogPattern beyond which, the rule evaluates to HANGING. When not specified, there is no constraint on time to first match for LogPattern.",
3055 )
3056 logPattern: str = Field(
3057 alias="log_pattern",
3058 description="Regex to identify log lines to apply the rule to when the rule is active. This regex can optionally include one capturing group to extract a numeric metric value.",
3059 )
3060 metricEvaluationDataPoints: Optional[int] = Field(
3061 default=None,
3062 alias="metric_evaluation_data_points",
3063 description="The number of consecutive times that a rule must evaluate to SLOW in order to mark a job as SLOW. When not specified, the default value is 1.",
3064 )
3065 metricThreshold: Optional[int] = Field(
3066 default=None,
3067 alias="metric_threshold",
3068 description="Threshold for value extracted by LogPattern if it has a capturing group. When not specified, Metric evaluation will not be performed.",
3069 )
3070 name: str = Field(description="Name of the rule")
3071 operator: Optional[str] = Field(
3072 default=None,
3073 description="Operator to compare the value extracted by LogPattern to MetricThreshold. Rule evaluates to SLOW if value extracted by LogPattern compared to MetricThreshold using Operator evaluates to true. When not specified, Metric evaluation will not be performed. Following operator values are supported: gt (greater than) lt (lesser than) eq (equal to) gteq (greater than or equal to) lteq (less than or equal to)",
3074 )
3075 stopPattern: Optional[str] = Field(
3076 default=None,
3077 alias="stop_pattern",
3078 description="Regex to identify the log line at which to deactivate the rule. When not specified, the rule will always be active.",
3079 )
3080
3081
[docs]
3082class RestartPolicy(BaseModel):
3083 """Additional restart limiting configurations"""
3084
3085 model_config = ConfigDict(extra="forbid")
3086
3087 evalPeriodSeconds: int = Field(
3088 alias="eval_period_seconds",
3089 description="The period of evaluating the restart limit in seconds",
3090 )
3091 maxFullJobRestarts: Optional[int] = Field(
3092 default=None,
3093 alias="max_full_job_restarts",
3094 description="The max allowed number of full job restarts before failing the job",
3095 )
3096 numRestartBeforeFullJobRestart: Optional[int] = Field(
3097 default=None,
3098 alias="num_restart_before_full_job_restart",
3099 description="The number of standard restarts before a full job restart",
3100 )
3101 maxNumRepeatOffendersToAvoid: Optional[int] = Field(
3102 default=None,
3103 alias="max_num_repeat_offenders_to_avoid",
3104 description="The max repeat offenders to exclude in next job level restart",
3105 )
3106 scaleUpSnoozeTimeInSeconds: Optional[int] = Field(
3107 default=0,
3108 alias="scale_up_snooze_time_in_seconds",
3109 description="Timeout period after job restart during which no scale up/workload admission is allowed",
3110 )
3111
3112
[docs]
3113class RunPolicy(BaseModel):
3114 """RunPolicy"""
3115
3116 model_config = ConfigDict(extra="forbid")
3117
3118 activeDeadlineSeconds: Optional[int] = Field(
3119 default=None,
3120 alias="active_deadline_seconds",
3121 description="Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer.",
3122 )
3123 cleanPodPolicy: Optional[str] = Field(
3124 default="All",
3125 alias="clean_pod_policy",
3126 description="CleanPodPolicy defines the policy to kill pods after the job completes.",
3127 )
3128 faultDeadlineSeconds: Optional[int] = Field(
3129 default=None,
3130 alias="fault_deadline_seconds",
3131 description="The limit on the fault time for the job (Status of Fault) before failing",
3132 )
3133 jobMaxRetryCount: Optional[int] = Field(default=None, alias="job_max_retry_count")
3134 logMonitoringConfiguration: Optional[List[LogMonitoringConfiguration]] = Field(
3135 default=None,
3136 alias="log_monitoring_configuration",
3137 description="LogMonitoringConfiguration defines the log monitoring rules for SLOW and HANGING job detection",
3138 )
3139 restartPolicy: Optional[RestartPolicy] = Field(
3140 default=None,
3141 alias="restart_policy",
3142 description="Additional restart limiting configurations",
3143 )
3144 startupDeadlineSeconds: Optional[int] = Field(
3145 default=None,
3146 alias="startup_deadline_seconds",
3147 description="The limit on the startup time for the job (Status of Staring) before failing",
3148 )
3149 suspend: Optional[bool] = Field(
3150 default=None, description="Suspend suspends HyperPodPytorchJob when set to true"
3151 )
3152 ttlSecondsAfterFinished: Optional[int] = Field(
3153 default=0,
3154 alias="ttl_seconds_after_finished",
3155 description="TTLSecondsAfterFinished is the TTL to clean up jobs. Set to -1 for infinite",
3156 )
3157 workloadMode: Optional[str] = Field(
3158 default=None,
3159 alias="workload_mode",
3160 description="Workload deployment mode for elastic training (e.g., 'Deployment')",
3161 )
3162
3163
[docs]
3164class PodSets(BaseModel):
3165 model_config = ConfigDict(extra="forbid")
3166
3167 count: int = Field(
3168 default=1, description="count is the number of pods for the spec."
3169 )
3170 minCount: Optional[int] = Field(
3171 default=None,
3172 alias="min_count",
3173 description="minCount is the minimum number of pods for the spec acceptable if the workload supports partial admission. If not provided, partial admission for the current PodSet is not enabled. Only one podSet within the workload can use this. This is an alpha field and requires enabling PartialAdmission feature gate.",
3174 )
3175 name: Optional[str] = Field(default="main", description="name is the PodSet name.")
3176 template: Template = Field(
3177 description="template is the Pod template. The only allowed fields in template.metadata are labels and annotations. If requests are omitted for a container or initContainer, they default to the limits if they are explicitly specified for the container or initContainer. During admission, the rules in nodeSelector and nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution that match the keys in the nodeLabels from the ResourceFlavors considered for this Workload are used to filter the ResourceFlavors that can be assigned to this podSet."
3178 )
3179
3180
[docs]
3181class Pods(BaseModel):
3182 """DEPRECATED pods to include job pods status in jobPods associated with replicaSpecs pods is retained here to support operator upgrade"""
3183
3184 model_config = ConfigDict(extra="forbid")
3185
3186 apiVersion: Optional[str] = Field(
3187 default=None, alias="api_version", description="API version of the referent."
3188 )
3189 fieldPath: Optional[str] = Field(
3190 default=None,
3191 alias="field_path",
3192 description='If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.',
3193 )
3194 kind: Optional[str] = Field(
3195 default=None,
3196 description="Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
3197 )
3198 name: Optional[str] = Field(
3199 default=None,
3200 description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
3201 )
3202 namespace: Optional[str] = Field(
3203 default=None,
3204 description="Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/",
3205 )
3206 resourceVersion: Optional[str] = Field(
3207 default=None,
3208 alias="resource_version",
3209 description="Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
3210 )
3211 uid: Optional[str] = Field(
3212 default=None,
3213 description="UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids",
3214 )
3215
3216
[docs]
3217class ElasticScalingStatus(BaseModel):
3218 """ElasticScalingStatus represents the current state of elastic scaling operations"""
3219
3220 model_config = ConfigDict(extra="forbid")
3221
3222 targetReplicas: Optional[Dict[str, int]] = Field(
3223 default=None,
3224 alias="target_replicas",
3225 description="TargetReplicas contains the desired replica counts per ReplicaSpec name",
3226 )
3227 lastUpdated: Optional[str] = Field(
3228 default=None,
3229 alias="last_updated",
3230 description="LastUpdated is the timestamp when this status was last modified",
3231 )
3232 lastScalingTime: Optional[str] = Field(
3233 default=None,
3234 alias="last_scaling_time",
3235 description="LastScalingTime tracks when the last scaling operation completed",
3236 )
3237 lastRestartTime: Optional[str] = Field(
3238 default=None,
3239 alias="last_restart_time",
3240 description="LastRestartTime tracks when the job was last restarted for scaleUpRestartTimeout",
3241 )
3242 podsScaled: Optional[bool] = Field(
3243 default=None,
3244 alias="pods_scaled",
3245 description="PodsScaled indicates whether pods have already been scaled in this scaling round",
3246 )
3247 isFaultyPodScaleDown: Optional[bool] = Field(
3248 default=None,
3249 alias="is_faulty_pod_scale_down",
3250 description="IsFaultyPodScaleDown indicates this scaling operation is removing faulty pods",
3251 )
3252 consecutiveScalingFailures: Optional[int] = Field(
3253 default=None,
3254 alias="consecutive_scaling_failures",
3255 description="ConsecutiveScalingFailures tracks the number of consecutive elastic scaling failures",
3256 )
3257
3258
[docs]
3259class RestartStatus(BaseModel):
3260 """Additional restart limiting status"""
3261
3262 model_config = ConfigDict(extra="forbid")
3263
3264 currentEvalPeriod: int = Field(
3265 alias="current_eval_period", description="The current window"
3266 )
3267 fullJobRestartCount: int = Field(
3268 alias="full_job_restart_count",
3269 description="The number of full job restarts that have ocurred in the window",
3270 )
3271 restartCount: int = Field(
3272 alias="restart_count",
3273 description="The number of standard restarts that have occurred in the window since the last full job restart",
3274 )
3275
3276
[docs]
3277class FaultyPodInstanceList(BaseModel):
3278 """FaultyPodInstanceRecord tracks faulty pod/instances for each restart"""
3279
3280 model_config = ConfigDict(extra="forbid")
3281
3282 restartType: Optional[str] = Field(
3283 default=None,
3284 alias="restart_type",
3285 description="RestartType indicates whether this was a PLR or JLR"
3286 )
3287 faultyInstanceIdList: Optional[List[str]] = Field(
3288 default_factory=list,
3289 alias="faulty_instance_id_list",
3290 description="FaultyInstanceIdList tracks faulty instance ids"
3291 )
3292 faultyPodList: Optional[List[str]] = Field(
3293 default_factory=list,
3294 alias="faulty_pod_list",
3295 description="FaultyPodList tracks faulty pod names"
3296 )
3297 faultyRankList: Optional[List[str]] = Field(
3298 default_factory=list,
3299 alias="faulty_rank_list",
3300 description="FaultyRankList tracks faulty pod ranks"
3301 )
3302
3303
[docs]
3304class HyperPodPytorchJobStatus(BaseModel):
3305 """HyperPodPytorchJobStatus defines the observed state of HyperPodPytorchJob"""
3306
3307 model_config = ConfigDict(extra="forbid")
3308
3309 completionTime: Optional[str] = Field(
3310 default=None,
3311 alias="completion_time",
3312 description="Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.",
3313 )
3314 conditions: Optional[List[Conditions]] = None
3315 jobPods: Optional[List[JobPods]] = Field(
3316 default=None,
3317 alias="job_pods",
3318 description="The StatefulSet containing the training pods",
3319 )
3320 latestFaultyPodInstanceList: Optional[FaultyPodInstanceList] = Field(
3321 default=None,
3322 alias="latest_faulty_pod_instance_list",
3323 description="LatestFaultyPodInstanceList tracks faulty pods/nodes of latest restart"
3324 )
3325 managerPods: Optional[ManagerPods] = Field(
3326 default=None, alias="manager_pods", description="Pod Manager pods"
3327 )
3328 masterAddr: Optional[str] = Field(
3329 default=None,
3330 alias="master_addr",
3331 description="The address of the master (RANK 0) pod",
3332 )
3333 masterPort: Optional[str] = Field(
3334 default=None,
3335 alias="master_port",
3336 description="The port of the master (RANK 0) pod",
3337 )
3338 podManagerStatuses: Optional[List[PodManagerStatuses]] = Field(
3339 default=None,
3340 alias="pod_manager_statuses",
3341 description="The status of each pod manager as a PodManagerStatus",
3342 )
3343 podSetInfos: Optional[List[PodSetInfos]] = Field(
3344 default=None,
3345 alias="pod_set_infos",
3346 description="PodSetInformation assigned to the HyperPodPytorchJob's PodSet by Kueue",
3347 )
3348 podSets: Optional[List[PodSets]] = Field(
3349 default=None,
3350 alias="pod_sets",
3351 description="PodSets used by Kueue to manage workload objects",
3352 )
3353 restartCount: Optional[int] = Field(default=0, alias="restart_count")
3354 restartStatus: Optional[RestartStatus] = Field(
3355 default=None,
3356 alias="restart_status",
3357 description="Additional restart limiting status",
3358 )
3359 elasticScalingStatus: Optional[ElasticScalingStatus] = Field(
3360 default=None,
3361 alias="elastic_scaling_status",
3362 description="ElasticScalingStatus contains the current state of elastic scaling operations",
3363 )
3364 elasticWorkloadRef: Optional[Dict[str, str]] = Field(
3365 default=None,
3366 alias="elastic_workload_ref",
3367 description="Reference to associated ElasticWorkload (optional, only set when ElasticPolicy is present)",
3368 )
3369 startTime: Optional[str] = Field(
3370 default=None,
3371 alias="start_time",
3372 description="The time when job is first acknowledged by the controller. When using kueue, the job is also admitted It is represented in RFC3339 form and is in UTC.",
3373 )
3374
3375
3376class _HyperPodPytorchJob(BaseModel):
3377 """Config defines the desired state of HyperPodPytorchJob"""
3378
3379 model_config = ConfigDict(extra="ignore")
3380
3381 nprocPerNode: str = Field(
3382 default="auto",
3383 alias="nproc_per_node",
3384 description="Number of workers per node; supported values: [auto, cpu, gpu, int].",
3385 )
3386 replicaSpecs: Optional[List[ReplicaSpec]] = Field(
3387 default=None,
3388 alias="replica_specs",
3389 description="The replicas to include as part of the job",
3390 )
3391 runPolicy: Optional[RunPolicy] = Field(
3392 default=None, alias="run_policy", description="RunPolicy"
3393 )
3394 elasticPolicy: Optional[ElasticPolicy] = Field(
3395 default=None,
3396 alias="elastic_policy",
3397 description="ElasticPolicy for elastic training"
3398 )