Skip to content

Commit 2b777c9

Browse files
committed
feat: Updates k8s models with alpha/beta versions
1 parent 8e2e0ca commit 2b777c9

File tree

32 files changed

+2168
-1007
lines changed

32 files changed

+2168
-1007
lines changed

src/kubedantic/models/io/k8s/api/admissionregistration/v1.py

+22-101
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# generated by datamodel-codegen:
2-
# timestamp: 2024-04-28T13:01:54+00:00
2+
# timestamp: 2024-04-28T19:06:26+00:00
33
# k8s version: v1.30.0
44

55
from __future__ import annotations
66

7-
from enum import Enum
87
from typing import List, Optional
98

109
from pydantic import BaseModel, Field
@@ -99,36 +98,6 @@ class MatchCondition(BaseModel):
9998
)
10099

101100

102-
class MatchPolicy(Enum):
103-
Equivalent = "Equivalent"
104-
Exact = "Exact"
105-
106-
107-
class FailurePolicy(Enum):
108-
Fail = "Fail"
109-
Ignore = "Ignore"
110-
111-
112-
class ReinvocationPolicy(Enum):
113-
IfNeeded = "IfNeeded"
114-
Never = "Never"
115-
116-
117-
class SideEffects(Enum):
118-
None_ = "None"
119-
NoneOnDryRun = "NoneOnDryRun"
120-
Some = "Some"
121-
Unknown = "Unknown"
122-
123-
124-
class Operation(Enum):
125-
field_ = "*"
126-
CONNECT = "CONNECT"
127-
CREATE = "CREATE"
128-
DELETE = "DELETE"
129-
UPDATE = "UPDATE"
130-
131-
132101
class NamedRuleWithOperations(BaseModel):
133102
apiGroups: Optional[List[str]] = Field(
134103
default=None,
@@ -145,7 +114,7 @@ class NamedRuleWithOperations(BaseModel):
145114
" Required."
146115
),
147116
)
148-
operations: Optional[List[Operation]] = Field(
117+
operations: Optional[List[str]] = Field(
149118
default=None,
150119
description=(
151120
"Operations is the operations the admission hook cares about - CREATE,"
@@ -217,7 +186,7 @@ class RuleWithOperations(BaseModel):
217186
" Required."
218187
),
219188
)
220-
operations: Optional[List[Operation]] = Field(
189+
operations: Optional[List[str]] = Field(
221190
default=None,
222191
description=(
223192
"Operations is the operations the admission hook cares about - CREATE,"
@@ -280,12 +249,6 @@ class TypeChecking(BaseModel):
280249
)
281250

282251

283-
class ValidationAction(Enum):
284-
Audit = "Audit"
285-
Deny = "Deny"
286-
Warn = "Warn"
287-
288-
289252
class Validation(BaseModel):
290253
expression: str = Field(
291254
...,
@@ -454,7 +417,7 @@ class MatchResources(BaseModel):
454417
" resource matches both, it is excluded)"
455418
),
456419
)
457-
matchPolicy: Optional[MatchPolicy] = Field(
420+
matchPolicy: Optional[str] = Field(
458421
default=None,
459422
description=(
460423
'matchPolicy defines how the "MatchResources" list is used to match'
@@ -470,11 +433,7 @@ class MatchResources(BaseModel):
470433
' extensions/v1beta1, and "rules" only included `apiGroups:["apps"],'
471434
' apiVersions:["v1"], resources: ["deployments"]`, a request to'
472435
" apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent"
473-
' to the ValidatingAdmissionPolicy.\n\nDefaults to "Equivalent"\n\nPossible'
474-
' enum values:\n - `"Equivalent"` means requests should be sent to the'
475-
" webhook if they modify a resource listed in rules via another API group"
476-
' or version.\n - `"Exact"` means requests should only be sent to the'
477-
" webhook if they exactly match a given rule."
436+
' to the ValidatingAdmissionPolicy.\n\nDefaults to "Equivalent"'
478437
),
479438
)
480439
namespaceSelector: Optional[v1.LabelSelector] = Field(
@@ -542,14 +501,11 @@ class MutatingWebhook(BaseModel):
542501
...,
543502
description="ClientConfig defines how to communicate with the hook. Required",
544503
)
545-
failurePolicy: Optional[FailurePolicy] = Field(
504+
failurePolicy: Optional[str] = Field(
546505
default=None,
547506
description=(
548507
"FailurePolicy defines how unrecognized errors from the admission endpoint"
549-
" are handled - allowed values are Ignore or Fail. Defaults to"
550-
' Fail.\n\nPossible enum values:\n - `"Fail"` means that an error calling'
551-
' the webhook causes the admission to fail.\n - `"Ignore"` means that an'
552-
" error calling the webhook is ignored."
508+
" are handled - allowed values are Ignore or Fail. Defaults to Fail."
553509
),
554510
)
555511
matchConditions: Optional[List[MatchCondition]] = Field(
@@ -567,7 +523,7 @@ class MutatingWebhook(BaseModel):
567523
" failurePolicy=Ignore, the error is ignored and the webhook is skipped"
568524
),
569525
)
570-
matchPolicy: Optional[MatchPolicy] = Field(
526+
matchPolicy: Optional[str] = Field(
571527
default=None,
572528
description=(
573529
'matchPolicy defines how the "rules" list is used to match incoming'
@@ -583,10 +539,7 @@ class MutatingWebhook(BaseModel):
583539
' only included `apiGroups:["apps"], apiVersions:["v1"], resources:'
584540
' ["deployments"]`, a request to apps/v1beta1 or extensions/v1beta1 would'
585541
" be converted to apps/v1 and sent to the webhook.\n\nDefaults to"
586-
' "Equivalent"\n\nPossible enum values:\n - `"Equivalent"` means requests'
587-
" should be sent to the webhook if they modify a resource listed in rules"
588-
' via another API group or version.\n - `"Exact"` means requests should'
589-
" only be sent to the webhook if they exactly match a given rule."
542+
' "Equivalent"'
590543
),
591544
)
592545
name: str = Field(
@@ -635,7 +588,7 @@ class MutatingWebhook(BaseModel):
635588
" LabelSelector, which matches everything."
636589
),
637590
)
638-
reinvocationPolicy: Optional[ReinvocationPolicy] = Field(
591+
reinvocationPolicy: Optional[str] = Field(
639592
default=None,
640593
description=(
641594
"reinvocationPolicy indicates whether this webhook should be called"
@@ -652,12 +605,7 @@ class MutatingWebhook(BaseModel):
652605
" webhooks that use this option may be reordered to minimize the number of"
653606
" additional invocations. * to validate an object after all mutations are"
654607
" guaranteed complete, use a validating admission webhook"
655-
' instead.\n\nDefaults to "Never".\n\nPossible enum values:\n -'
656-
' `"IfNeeded"` indicates that the webhook may be called at least one'
657-
" additional time as part of the admission evaluation if the object being"
658-
" admitted is modified by other admission plugins after the initial webhook"
659-
' call.\n - `"Never"` indicates that the webhook must not be called more'
660-
" than once in a single admission evaluation."
608+
' instead.\n\nDefaults to "Never".'
661609
),
662610
)
663611
rules: Optional[List[RuleWithOperations]] = Field(
@@ -673,7 +621,7 @@ class MutatingWebhook(BaseModel):
673621
" MutatingWebhookConfiguration objects."
674622
),
675623
)
676-
sideEffects: SideEffects = Field(
624+
sideEffects: str = Field(
677625
...,
678626
description=(
679627
"SideEffects states whether this webhook has side effects. Acceptable"
@@ -682,16 +630,7 @@ class MutatingWebhook(BaseModel):
682630
" reconciliation system, since a request may be rejected by a future step"
683631
" in the admission chain and the side effects therefore need to be undone."
684632
" Requests with the dryRun attribute will be auto-rejected if they match a"
685-
" webhook with sideEffects == Unknown or Some.\n\nPossible enum values:\n -"
686-
' `"None"` means that calling the webhook will have no side effects.\n -'
687-
' `"NoneOnDryRun"` means that calling the webhook will possibly have side'
688-
" effects, but if the request being reviewed has the dry-run attribute, the"
689-
' side effects will be suppressed.\n - `"Some"` means that calling the'
690-
" webhook will possibly have side effects. If a request with the dry-run"
691-
" attribute would trigger a call to this webhook, the request will instead"
692-
' fail.\n - `"Unknown"` means that no information is known about the side'
693-
" effects of calling the webhook. If a request with the dry-run attribute"
694-
" would trigger a call to this webhook, the request will instead fail."
633+
" webhook with sideEffects == Unknown or Some."
695634
),
696635
)
697636
timeoutSeconds: Optional[int] = Field(
@@ -859,7 +798,7 @@ class ValidatingAdmissionPolicyBindingSpec(BaseModel):
859798
" Required."
860799
),
861800
)
862-
validationActions: Optional[List[ValidationAction]] = Field(
801+
validationActions: Optional[List[str]] = Field(
863802
default=None,
864803
description=(
865804
"validationActions declares how Validations of the referenced"
@@ -908,7 +847,7 @@ class ValidatingAdmissionPolicySpec(BaseModel):
908847
" auditAnnotations is required."
909848
),
910849
)
911-
failurePolicy: Optional[FailurePolicy] = Field(
850+
failurePolicy: Optional[str] = Field(
912851
default=None,
913852
description=(
914853
"failurePolicy defines how to handle failures for the admission policy."
@@ -919,10 +858,7 @@ class ValidatingAdmissionPolicySpec(BaseModel):
919858
" non-existent resource.\n\nfailurePolicy does not define how validations"
920859
" that evaluate to false are handled.\n\nWhen failurePolicy is set to Fail,"
921860
" ValidatingAdmissionPolicyBinding validationActions define how failures"
922-
" are enforced.\n\nAllowed values are Ignore or Fail. Defaults to"
923-
' Fail.\n\nPossible enum values:\n - `"Fail"` means that an error calling'
924-
' the webhook causes the admission to fail.\n - `"Ignore"` means that an'
925-
" error calling the webhook is ignored."
861+
" are enforced.\n\nAllowed values are Ignore or Fail. Defaults to Fail."
926862
),
927863
)
928864
matchConditions: Optional[List[MatchCondition]] = Field(
@@ -1025,14 +961,11 @@ class ValidatingWebhook(BaseModel):
1025961
...,
1026962
description="ClientConfig defines how to communicate with the hook. Required",
1027963
)
1028-
failurePolicy: Optional[FailurePolicy] = Field(
964+
failurePolicy: Optional[str] = Field(
1029965
default=None,
1030966
description=(
1031967
"FailurePolicy defines how unrecognized errors from the admission endpoint"
1032-
" are handled - allowed values are Ignore or Fail. Defaults to"
1033-
' Fail.\n\nPossible enum values:\n - `"Fail"` means that an error calling'
1034-
' the webhook causes the admission to fail.\n - `"Ignore"` means that an'
1035-
" error calling the webhook is ignored."
968+
" are handled - allowed values are Ignore or Fail. Defaults to Fail."
1036969
),
1037970
)
1038971
matchConditions: Optional[List[MatchCondition]] = Field(
@@ -1050,7 +983,7 @@ class ValidatingWebhook(BaseModel):
1050983
" failurePolicy=Ignore, the error is ignored and the webhook is skipped"
1051984
),
1052985
)
1053-
matchPolicy: Optional[MatchPolicy] = Field(
986+
matchPolicy: Optional[str] = Field(
1054987
default=None,
1055988
description=(
1056989
'matchPolicy defines how the "rules" list is used to match incoming'
@@ -1066,10 +999,7 @@ class ValidatingWebhook(BaseModel):
1066999
' only included `apiGroups:["apps"], apiVersions:["v1"], resources:'
10671000
' ["deployments"]`, a request to apps/v1beta1 or extensions/v1beta1 would'
10681001
" be converted to apps/v1 and sent to the webhook.\n\nDefaults to"
1069-
' "Equivalent"\n\nPossible enum values:\n - `"Equivalent"` means requests'
1070-
" should be sent to the webhook if they modify a resource listed in rules"
1071-
' via another API group or version.\n - `"Exact"` means requests should'
1072-
" only be sent to the webhook if they exactly match a given rule."
1002+
' "Equivalent"'
10731003
),
10741004
)
10751005
name: str = Field(
@@ -1131,7 +1061,7 @@ class ValidatingWebhook(BaseModel):
11311061
" MutatingWebhookConfiguration objects."
11321062
),
11331063
)
1134-
sideEffects: SideEffects = Field(
1064+
sideEffects: str = Field(
11351065
...,
11361066
description=(
11371067
"SideEffects states whether this webhook has side effects. Acceptable"
@@ -1140,16 +1070,7 @@ class ValidatingWebhook(BaseModel):
11401070
" reconciliation system, since a request may be rejected by a future step"
11411071
" in the admission chain and the side effects therefore need to be undone."
11421072
" Requests with the dryRun attribute will be auto-rejected if they match a"
1143-
" webhook with sideEffects == Unknown or Some.\n\nPossible enum values:\n -"
1144-
' `"None"` means that calling the webhook will have no side effects.\n -'
1145-
' `"NoneOnDryRun"` means that calling the webhook will possibly have side'
1146-
" effects, but if the request being reviewed has the dry-run attribute, the"
1147-
' side effects will be suppressed.\n - `"Some"` means that calling the'
1148-
" webhook will possibly have side effects. If a request with the dry-run"
1149-
" attribute would trigger a call to this webhook, the request will instead"
1150-
' fail.\n - `"Unknown"` means that no information is known about the side'
1151-
" effects of calling the webhook. If a request with the dry-run attribute"
1152-
" would trigger a call to this webhook, the request will instead fail."
1073+
" webhook with sideEffects == Unknown or Some."
11531074
),
11541075
)
11551076
timeoutSeconds: Optional[int] = Field(

0 commit comments

Comments
 (0)