Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karpenter: add v1 crds and bump k8s deps to 1.30 #224

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions karpenter/kcl.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "karpenter"
edition = "0.0.1"
version = "0.1.0"
version = "0.2.0"
description = "`karpenter` is the kubernetes-sigs/karpenter spec definition."

[dependencies]
k8s = "1.28"
k8s = "1.30"
363 changes: 363 additions & 0 deletions karpenter/v1/karpenter_sh_v1_node_claim.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,363 @@
"""
This file was generated by the KCL auto-gen tool. DO NOT EDIT.
Editing this file might prove futile when you re-run the KCL auto-gen generate command.
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1
_regex_match = regex.match


schema NodeClaim:
r"""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be blocker?

Copy link
Contributor Author

@liangyuanpeng liangyuanpeng Aug 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using kcl cli 0.10.0-beta.1-linux-amd64

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

NodeClaim is the Schema for the NodeClaims API

Attributes
----------
apiVersion : str, default is "karpenter.sh/v1", required
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
kind : str, default is "NodeClaim", required
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
metadata : v1.ObjectMeta, default is Undefined, optional
metadata
spec : KarpenterShV1NodeClaimSpec, default is Undefined, required
spec
status : KarpenterShV1NodeClaimStatus, default is Undefined, optional
status
"""


apiVersion: "karpenter.sh/v1" = "karpenter.sh/v1"

kind: "NodeClaim" = "NodeClaim"

metadata?: v1.ObjectMeta

spec: KarpenterShV1NodeClaimSpec

status?: KarpenterShV1NodeClaimStatus


schema KarpenterShV1NodeClaimSpec:
r"""
NodeClaimSpec describes the desired state of the NodeClaim

Attributes
----------
expireAfter : str, default is "720h", optional
ExpireAfter is the duration the controller will wait
before terminating a node, measured from when the node is created. This
is useful to implement features like eventually consistent node upgrade,
memory leak protection, and disruption testing.
requirements : [KarpenterShV1NodeClaimSpecRequirementsItems0], default is Undefined, required
Requirements are layered with GetLabels and applied to every node.
startupTaints : [KarpenterShV1NodeClaimSpecStartupTaintsItems0], default is Undefined, optional
StartupTaints are taints that are applied to nodes upon startup which are expected to be removed automatically
within a short period of time, typically by a DaemonSet that tolerates the taint. These are commonly used by
daemonsets to allow initialization and enforce startup ordering. StartupTaints are ignored for provisioning
purposes in that pods are not required to tolerate a StartupTaint in order to have nodes provisioned for them.
taints : [KarpenterShV1NodeClaimSpecTaintsItems0], default is Undefined, optional
Taints will be applied to the NodeClaim's node.
terminationGracePeriod : str, default is Undefined, optional
TerminationGracePeriod is the maximum duration the controller will wait before forcefully deleting the pods on a node, measured from when deletion is first initiated.


Warning: this feature takes precedence over a Pod's terminationGracePeriodSeconds value, and bypasses any blocked PDBs or the karpenter.sh/do-not-disrupt annotation.


This field is intended to be used by cluster administrators to enforce that nodes can be cycled within a given time period.
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.


Karpenter will preemptively delete pods so their terminationGracePeriodSeconds align with the node's terminationGracePeriod.
If a pod would be terminated without being granted its full terminationGracePeriodSeconds prior to the node timeout,
that pod will be deleted at T = node timeout - pod terminationGracePeriodSeconds.


The feature can also be used to allow maximum time limits for long-running jobs which can delay node termination with preStop hooks.
If left undefined, the controller will wait indefinitely for pods to be drained.
nodeClassRef : KarpenterShV1NodeClaimSpecNodeClassRef, default is Undefined, required
node class ref
resources : KarpenterShV1NodeClaimSpecResources, default is Undefined, optional
resources
"""


expireAfter?: str = "720h"

requirements: [KarpenterShV1NodeClaimSpecRequirementsItems0]

startupTaints?: [KarpenterShV1NodeClaimSpecStartupTaintsItems0]

taints?: [KarpenterShV1NodeClaimSpecTaintsItems0]

terminationGracePeriod?: str

nodeClassRef: KarpenterShV1NodeClaimSpecNodeClassRef

resources?: KarpenterShV1NodeClaimSpecResources


check:
_regex_match(str(expireAfter), r"^(([0-9]+(s|m|h))+)|(Never)$") if expireAfter
len(requirements) <= 100
_regex_match(str(terminationGracePeriod), r"^([0-9]+(s|m|h))+$") if terminationGracePeriod


schema KarpenterShV1NodeClaimSpecNodeClassRef:
r"""
NodeClassRef is a reference to an object that defines provider specific configuration

Attributes
----------
group : str, default is Undefined, required
API version of the referent
kind : str, default is Undefined, required
Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
name : str, default is Undefined, required
Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
"""


group: str

kind: str

name: str


check:
_regex_match(str(group), r"^[^/]*$")


schema KarpenterShV1NodeClaimSpecRequirementsItems0:
r"""
A node selector requirement with min values is a selector that contains values, a key, an operator that relates the key and values
and minValues that represent the requirement to have at least that many values.

Attributes
----------
key : str, default is Undefined, required
The label key that the selector applies to.
minValues : int, default is Undefined, optional
This field is ALPHA and can be dropped or replaced at any time
MinValues is the minimum number of unique values required to define the flexibility of the specific requirement.
operator : str, default is Undefined, required
Represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
values : [str], default is Undefined, optional
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.
"""


key: str

minValues?: int

operator: "In" | "NotIn" | "Exists" | "DoesNotExist" | "Gt" | "Lt"

values?: [str]


check:
len(key) <= 316
_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]$")
minValues <= 50 if minValues not in [None, Undefined]
minValues >= 1 if minValues not in [None, Undefined]
len(values) <= 63 if values
_regex_match(str(values), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") if values


schema KarpenterShV1NodeClaimSpecResources:
r"""
Resources models the resource requirements for the NodeClaim to launch

Attributes
----------
requests : {str:int | str}, default is Undefined, optional
Requests describes the minimum required resources for the NodeClaim to launch
"""


requests?: {str:int | str}


check:
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


schema KarpenterShV1NodeClaimSpecStartupTaintsItems0:
r"""
The node this Taint is attached to has the "effect" on
any pod that does not tolerate the Taint.

Attributes
----------
effect : str, default is Undefined, required
Required. The effect of the taint on pods
that do not tolerate the taint.
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
key : str, default is Undefined, required
Required. The taint key to be applied to a node.
timeAdded : str, default is Undefined, optional
TimeAdded represents the time at which the taint was added.
It is only written for NoExecute taints.
value : str, default is Undefined, optional
The taint value corresponding to the taint key.
"""


effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute"

key: str

timeAdded?: str

value?: str


check:
len(key) >= 1
_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]$")
_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


schema KarpenterShV1NodeClaimSpecTaintsItems0:
r"""
The node this Taint is attached to has the "effect" on
any pod that does not tolerate the Taint.

Attributes
----------
effect : str, default is Undefined, required
Required. The effect of the taint on pods
that do not tolerate the taint.
Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
key : str, default is Undefined, required
Required. The taint key to be applied to a node.
timeAdded : str, default is Undefined, optional
TimeAdded represents the time at which the taint was added.
It is only written for NoExecute taints.
value : str, default is Undefined, optional
The taint value corresponding to the taint key.
"""


effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute"

key: str

timeAdded?: str

value?: str


check:
len(key) >= 1
_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]$")
_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


schema KarpenterShV1NodeClaimStatus:
r"""
NodeClaimStatus defines the observed state of NodeClaim

Attributes
----------
allocatable : {str:int | str}, default is Undefined, optional
Allocatable is the estimated allocatable capacity of the node
capacity : {str:int | str}, default is Undefined, optional
Capacity is the estimated full capacity of the node
conditions : [KarpenterShV1NodeClaimStatusConditionsItems0], default is Undefined, optional
Conditions contains signals for health and readiness
imageID : str, default is Undefined, optional
ImageID is an identifier for the image that runs on the node
lastPodEventTime : str, default is Undefined, optional
LastPodEventTime is updated with the last time a pod was scheduled
or removed from the node. A pod going terminal or terminating
is also considered as removed.
nodeName : str, default is Undefined, optional
NodeName is the name of the corresponding node object
providerID : str, default is Undefined, optional
ProviderID of the corresponding node object
"""


allocatable?: {str:int | str}

capacity?: {str:int | str}

conditions?: [KarpenterShV1NodeClaimStatusConditionsItems0]

imageID?: str

lastPodEventTime?: str

nodeName?: str

providerID?: str


check:
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
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


schema KarpenterShV1NodeClaimStatusConditionsItems0:
r"""
Condition aliases the upstream type and adds additional helper methods

Attributes
----------
lastTransitionTime : str, default is Undefined, required
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
message : str, default is Undefined, optional
message is a human readable message indicating details about the transition.
This may be an empty string.
observedGeneration : int, default is Undefined, optional
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
reason : str, default is Undefined, optional
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
status : str, default is Undefined, required
status of the condition, one of True, False, Unknown.
$type : str, default is Undefined, required
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
"""


lastTransitionTime: str

message?: str

observedGeneration?: int

reason?: str

status: "True" | "False" | "Unknown"

$type: str


check:
len(message) <= 32768 if message
observedGeneration >= 0 if observedGeneration not in [None, Undefined]
len(reason) <= 1024 if reason
_regex_match(str(reason), r"^([A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?|)$") if reason
len($type) <= 316
_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])$")


Loading
Loading