Skip to content

Commit bdd4d00

Browse files
authored
Merge pull request #224 from liangyuanpeng/karpenter_v1
karpenter: add v1 crds and bump k8s deps to 1.30
2 parents b810a15 + 72ba8f8 commit bdd4d00

File tree

5 files changed

+1254
-171
lines changed

5 files changed

+1254
-171
lines changed

karpenter/kcl.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[package]
22
name = "karpenter"
33
edition = "0.0.1"
4-
version = "0.1.0"
4+
version = "0.2.0"
5+
description = "`karpenter` is the kubernetes-sigs/karpenter spec definition."
56

67
[dependencies]
7-
k8s = "1.28"
8+
k8s = "1.30"
Lines changed: 363 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,363 @@
1+
"""
2+
This file was generated by the KCL auto-gen tool. DO NOT EDIT.
3+
Editing this file might prove futile when you re-run the KCL auto-gen generate command.
4+
"""
5+
import regex
6+
import k8s.apimachinery.pkg.apis.meta.v1
7+
_regex_match = regex.match
8+
9+
10+
schema NodeClaim:
11+
r"""
12+
NodeClaim is the Schema for the NodeClaims API
13+
14+
Attributes
15+
----------
16+
apiVersion : str, default is "karpenter.sh/v1", required
17+
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
18+
kind : str, default is "NodeClaim", required
19+
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
20+
metadata : v1.ObjectMeta, default is Undefined, optional
21+
metadata
22+
spec : KarpenterShV1NodeClaimSpec, default is Undefined, required
23+
spec
24+
status : KarpenterShV1NodeClaimStatus, default is Undefined, optional
25+
status
26+
"""
27+
28+
29+
apiVersion: "karpenter.sh/v1" = "karpenter.sh/v1"
30+
31+
kind: "NodeClaim" = "NodeClaim"
32+
33+
metadata?: v1.ObjectMeta
34+
35+
spec: KarpenterShV1NodeClaimSpec
36+
37+
status?: KarpenterShV1NodeClaimStatus
38+
39+
40+
schema KarpenterShV1NodeClaimSpec:
41+
r"""
42+
NodeClaimSpec describes the desired state of the NodeClaim
43+
44+
Attributes
45+
----------
46+
expireAfter : str, default is "720h", optional
47+
ExpireAfter is the duration the controller will wait
48+
before terminating a node, measured from when the node is created. This
49+
is useful to implement features like eventually consistent node upgrade,
50+
memory leak protection, and disruption testing.
51+
requirements : [KarpenterShV1NodeClaimSpecRequirementsItems0], default is Undefined, required
52+
Requirements are layered with GetLabels and applied to every node.
53+
startupTaints : [KarpenterShV1NodeClaimSpecStartupTaintsItems0], default is Undefined, optional
54+
StartupTaints are taints that are applied to nodes upon startup which are expected to be removed automatically
55+
within a short period of time, typically by a DaemonSet that tolerates the taint. These are commonly used by
56+
daemonsets to allow initialization and enforce startup ordering. StartupTaints are ignored for provisioning
57+
purposes in that pods are not required to tolerate a StartupTaint in order to have nodes provisioned for them.
58+
taints : [KarpenterShV1NodeClaimSpecTaintsItems0], default is Undefined, optional
59+
Taints will be applied to the NodeClaim's node.
60+
terminationGracePeriod : str, default is Undefined, optional
61+
TerminationGracePeriod is the maximum duration the controller will wait before forcefully deleting the pods on a node, measured from when deletion is first initiated.
62+
63+
64+
Warning: this feature takes precedence over a Pod's terminationGracePeriodSeconds value, and bypasses any blocked PDBs or the karpenter.sh/do-not-disrupt annotation.
65+
66+
67+
This field is intended to be used by cluster administrators to enforce that nodes can be cycled within a given time period.
68+
When set, drifted nodes will begin draining even if there are pods blocking eviction. Draining will respect PDBs and the do-not-disrupt annotation until the TGP is reached.
69+
70+
71+
Karpenter will preemptively delete pods so their terminationGracePeriodSeconds align with the node's terminationGracePeriod.
72+
If a pod would be terminated without being granted its full terminationGracePeriodSeconds prior to the node timeout,
73+
that pod will be deleted at T = node timeout - pod terminationGracePeriodSeconds.
74+
75+
76+
The feature can also be used to allow maximum time limits for long-running jobs which can delay node termination with preStop hooks.
77+
If left undefined, the controller will wait indefinitely for pods to be drained.
78+
nodeClassRef : KarpenterShV1NodeClaimSpecNodeClassRef, default is Undefined, required
79+
node class ref
80+
resources : KarpenterShV1NodeClaimSpecResources, default is Undefined, optional
81+
resources
82+
"""
83+
84+
85+
expireAfter?: str = "720h"
86+
87+
requirements: [KarpenterShV1NodeClaimSpecRequirementsItems0]
88+
89+
startupTaints?: [KarpenterShV1NodeClaimSpecStartupTaintsItems0]
90+
91+
taints?: [KarpenterShV1NodeClaimSpecTaintsItems0]
92+
93+
terminationGracePeriod?: str
94+
95+
nodeClassRef: KarpenterShV1NodeClaimSpecNodeClassRef
96+
97+
resources?: KarpenterShV1NodeClaimSpecResources
98+
99+
100+
check:
101+
_regex_match(str(expireAfter), r"^(([0-9]+(s|m|h))+)|(Never)$") if expireAfter
102+
len(requirements) <= 100
103+
_regex_match(str(terminationGracePeriod), r"^([0-9]+(s|m|h))+$") if terminationGracePeriod
104+
105+
106+
schema KarpenterShV1NodeClaimSpecNodeClassRef:
107+
r"""
108+
NodeClassRef is a reference to an object that defines provider specific configuration
109+
110+
Attributes
111+
----------
112+
group : str, default is Undefined, required
113+
API version of the referent
114+
kind : str, default is Undefined, required
115+
Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
116+
name : str, default is Undefined, required
117+
Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
118+
"""
119+
120+
121+
group: str
122+
123+
kind: str
124+
125+
name: str
126+
127+
128+
check:
129+
_regex_match(str(group), r"^[^/]*$")
130+
131+
132+
schema KarpenterShV1NodeClaimSpecRequirementsItems0:
133+
r"""
134+
A node selector requirement with min values is a selector that contains values, a key, an operator that relates the key and values
135+
and minValues that represent the requirement to have at least that many values.
136+
137+
Attributes
138+
----------
139+
key : str, default is Undefined, required
140+
The label key that the selector applies to.
141+
minValues : int, default is Undefined, optional
142+
This field is ALPHA and can be dropped or replaced at any time
143+
MinValues is the minimum number of unique values required to define the flexibility of the specific requirement.
144+
operator : str, default is Undefined, required
145+
Represents a key's relationship to a set of values.
146+
Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
147+
values : [str], default is Undefined, optional
148+
An array of string values. If the operator is In or NotIn,
149+
the values array must be non-empty. If the operator is Exists or DoesNotExist,
150+
the values array must be empty. If the operator is Gt or Lt, the values
151+
array must have a single element, which will be interpreted as an integer.
152+
This array is replaced during a strategic merge patch.
153+
"""
154+
155+
156+
key: str
157+
158+
minValues?: int
159+
160+
operator: "In" | "NotIn" | "Exists" | "DoesNotExist" | "Gt" | "Lt"
161+
162+
values?: [str]
163+
164+
165+
check:
166+
len(key) <= 316
167+
_regex_match(str(key), r"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*(\/))?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$")
168+
minValues <= 50 if minValues not in [None, Undefined]
169+
minValues >= 1 if minValues not in [None, Undefined]
170+
len(values) <= 63 if values
171+
_regex_match(str(values), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") if values
172+
173+
174+
schema KarpenterShV1NodeClaimSpecResources:
175+
r"""
176+
Resources models the resource requirements for the NodeClaim to launch
177+
178+
Attributes
179+
----------
180+
requests : {str:int | str}, default is Undefined, optional
181+
Requests describes the minimum required resources for the NodeClaim to launch
182+
"""
183+
184+
185+
requests?: {str:int | str}
186+
187+
188+
check:
189+
all _, requests in requests { _regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
190+
191+
192+
schema KarpenterShV1NodeClaimSpecStartupTaintsItems0:
193+
r"""
194+
The node this Taint is attached to has the "effect" on
195+
any pod that does not tolerate the Taint.
196+
197+
Attributes
198+
----------
199+
effect : str, default is Undefined, required
200+
Required. The effect of the taint on pods
201+
that do not tolerate the taint.
202+
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
203+
key : str, default is Undefined, required
204+
Required. The taint key to be applied to a node.
205+
timeAdded : str, default is Undefined, optional
206+
TimeAdded represents the time at which the taint was added.
207+
It is only written for NoExecute taints.
208+
value : str, default is Undefined, optional
209+
The taint value corresponding to the taint key.
210+
"""
211+
212+
213+
effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute"
214+
215+
key: str
216+
217+
timeAdded?: str
218+
219+
value?: str
220+
221+
222+
check:
223+
len(key) >= 1
224+
_regex_match(str(key), r"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*(\/))?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$")
225+
_regex_match(str(value), r"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*(\/))?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$") if value
226+
227+
228+
schema KarpenterShV1NodeClaimSpecTaintsItems0:
229+
r"""
230+
The node this Taint is attached to has the "effect" on
231+
any pod that does not tolerate the Taint.
232+
233+
Attributes
234+
----------
235+
effect : str, default is Undefined, required
236+
Required. The effect of the taint on pods
237+
that do not tolerate the taint.
238+
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
239+
key : str, default is Undefined, required
240+
Required. The taint key to be applied to a node.
241+
timeAdded : str, default is Undefined, optional
242+
TimeAdded represents the time at which the taint was added.
243+
It is only written for NoExecute taints.
244+
value : str, default is Undefined, optional
245+
The taint value corresponding to the taint key.
246+
"""
247+
248+
249+
effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute"
250+
251+
key: str
252+
253+
timeAdded?: str
254+
255+
value?: str
256+
257+
258+
check:
259+
len(key) >= 1
260+
_regex_match(str(key), r"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*(\/))?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$")
261+
_regex_match(str(value), r"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*(\/))?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$") if value
262+
263+
264+
schema KarpenterShV1NodeClaimStatus:
265+
r"""
266+
NodeClaimStatus defines the observed state of NodeClaim
267+
268+
Attributes
269+
----------
270+
allocatable : {str:int | str}, default is Undefined, optional
271+
Allocatable is the estimated allocatable capacity of the node
272+
capacity : {str:int | str}, default is Undefined, optional
273+
Capacity is the estimated full capacity of the node
274+
conditions : [KarpenterShV1NodeClaimStatusConditionsItems0], default is Undefined, optional
275+
Conditions contains signals for health and readiness
276+
imageID : str, default is Undefined, optional
277+
ImageID is an identifier for the image that runs on the node
278+
lastPodEventTime : str, default is Undefined, optional
279+
LastPodEventTime is updated with the last time a pod was scheduled
280+
or removed from the node. A pod going terminal or terminating
281+
is also considered as removed.
282+
nodeName : str, default is Undefined, optional
283+
NodeName is the name of the corresponding node object
284+
providerID : str, default is Undefined, optional
285+
ProviderID of the corresponding node object
286+
"""
287+
288+
289+
allocatable?: {str:int | str}
290+
291+
capacity?: {str:int | str}
292+
293+
conditions?: [KarpenterShV1NodeClaimStatusConditionsItems0]
294+
295+
imageID?: str
296+
297+
lastPodEventTime?: str
298+
299+
nodeName?: str
300+
301+
providerID?: str
302+
303+
304+
check:
305+
all _, allocatable in allocatable { _regex_match(str(allocatable), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatable } if allocatable
306+
all _, capacity in capacity { _regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
307+
308+
309+
schema KarpenterShV1NodeClaimStatusConditionsItems0:
310+
r"""
311+
Condition aliases the upstream type and adds additional helper methods
312+
313+
Attributes
314+
----------
315+
lastTransitionTime : str, default is Undefined, required
316+
lastTransitionTime is the last time the condition transitioned from one status to another.
317+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
318+
message : str, default is Undefined, optional
319+
message is a human readable message indicating details about the transition.
320+
This may be an empty string.
321+
observedGeneration : int, default is Undefined, optional
322+
observedGeneration represents the .metadata.generation that the condition was set based upon.
323+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
324+
with respect to the current state of the instance.
325+
reason : str, default is Undefined, optional
326+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
327+
Producers of specific condition types may define expected values and meanings for this field,
328+
and whether the values are considered a guaranteed API.
329+
The value should be a CamelCase string.
330+
This field may not be empty.
331+
status : str, default is Undefined, required
332+
status of the condition, one of True, False, Unknown.
333+
$type : str, default is Undefined, required
334+
type of condition in CamelCase or in foo.example.com/CamelCase.
335+
---
336+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
337+
useful (see .node.status.conditions), the ability to deconflict is important.
338+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
339+
"""
340+
341+
342+
lastTransitionTime: str
343+
344+
message?: str
345+
346+
observedGeneration?: int
347+
348+
reason?: str
349+
350+
status: "True" | "False" | "Unknown"
351+
352+
$type: str
353+
354+
355+
check:
356+
len(message) <= 32768 if message
357+
observedGeneration >= 0 if observedGeneration not in [None, Undefined]
358+
len(reason) <= 1024 if reason
359+
_regex_match(str(reason), r"^([A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?|)$") if reason
360+
len($type) <= 316
361+
_regex_match(str($type), r"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$")
362+
363+

0 commit comments

Comments
 (0)