From 72ba8f8793754857465df48f8d3ca54cec83bb9e Mon Sep 17 00:00:00 2001 From: Lan Liang Date: Sat, 17 Aug 2024 03:44:35 +0000 Subject: [PATCH] karpenter: add v1 crds and bump k8s deps to 1.30 Signed-off-by: Lan Liang --- karpenter/kcl.mod | 5 +- karpenter/v1/karpenter_sh_v1_node_claim.k | 363 +++++++++++++ karpenter/v1/karpenter_sh_v1_node_pool.k | 489 ++++++++++++++++++ .../v1beta1/karpenter_sh_v1beta1_node_claim.k | 216 +++++--- .../v1beta1/karpenter_sh_v1beta1_node_pool.k | 352 +++++++++---- 5 files changed, 1254 insertions(+), 171 deletions(-) create mode 100644 karpenter/v1/karpenter_sh_v1_node_claim.k create mode 100644 karpenter/v1/karpenter_sh_v1_node_pool.k diff --git a/karpenter/kcl.mod b/karpenter/kcl.mod index 51570ccf..b31c16b5 100644 --- a/karpenter/kcl.mod +++ b/karpenter/kcl.mod @@ -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" diff --git a/karpenter/v1/karpenter_sh_v1_node_claim.k b/karpenter/v1/karpenter_sh_v1_node_claim.k new file mode 100644 index 00000000..ada3e927 --- /dev/null +++ b/karpenter/v1/karpenter_sh_v1_node_claim.k @@ -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""" + 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])$") + + diff --git a/karpenter/v1/karpenter_sh_v1_node_pool.k b/karpenter/v1/karpenter_sh_v1_node_pool.k new file mode 100644 index 00000000..f37c28bf --- /dev/null +++ b/karpenter/v1/karpenter_sh_v1_node_pool.k @@ -0,0 +1,489 @@ +""" +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 NodePool: + r""" + NodePool is the Schema for the NodePools 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 "NodePool", 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 : KarpenterShV1NodePoolSpec, default is Undefined, required + spec + status : KarpenterShV1NodePoolStatus, default is Undefined, optional + status + """ + + + apiVersion: "karpenter.sh/v1" = "karpenter.sh/v1" + + kind: "NodePool" = "NodePool" + + metadata?: v1.ObjectMeta + + spec: KarpenterShV1NodePoolSpec + + status?: KarpenterShV1NodePoolStatus + + +schema KarpenterShV1NodePoolSpec: + r""" + NodePoolSpec is the top level nodepool specification. Nodepools + launch nodes in response to pods that are unschedulable. A single nodepool + is capable of managing a diverse set of nodes. Node properties are determined + from a combination of nodepool and pod scheduling constraints. + + Attributes + ---------- + limits : {str:int | str}, default is Undefined, optional + Limits define a set of bounds for provisioning capacity. + weight : int, default is Undefined, optional + Weight is the priority given to the nodepool during scheduling. A higher + numerical weight indicates that this nodepool will be ordered + ahead of other nodepools with lower weights. A nodepool with no weight + will be treated as if it is a nodepool with a weight of 0. + disruption : KarpenterShV1NodePoolSpecDisruption, default is Undefined, optional + disruption + template : KarpenterShV1NodePoolSpecTemplate, default is Undefined, required + template + """ + + + limits?: {str:int | str} + + weight?: int + + disruption?: KarpenterShV1NodePoolSpecDisruption + + template: KarpenterShV1NodePoolSpecTemplate + + + check: + all _, limits in limits { _regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits + weight <= 100 if weight not in [None, Undefined] + weight >= 1 if weight not in [None, Undefined] + + +schema KarpenterShV1NodePoolSpecDisruption: + r""" + Disruption contains the parameters that relate to Karpenter's disruption logic + + Attributes + ---------- + budgets : [KarpenterShV1NodePoolSpecDisruptionBudgetsItems0], default is [{"nodes": {"value": "10%", "x-order": 0}}], optional + Budgets is a list of Budgets. + If there are multiple active budgets, Karpenter uses + the most restrictive value. If left undefined, + this will default to one budget with a value to 10%. + consolidateAfter : str, default is Undefined, required + ConsolidateAfter is the duration the controller will wait + before attempting to terminate nodes that are underutilized. + Refer to ConsolidationPolicy for how underutilization is considered. + consolidationPolicy : str, default is "WhenEmptyOrUnderutilized", optional + ConsolidationPolicy describes which nodes Karpenter can disrupt through its consolidation + algorithm. This policy defaults to "WhenEmptyOrUnderutilized" if not specified + """ + + + budgets?: [KarpenterShV1NodePoolSpecDisruptionBudgetsItems0] = [{"nodes": {"value": "10%", "x-order": 0}}] + + consolidateAfter: str + + consolidationPolicy?: "WhenEmpty" | "WhenEmptyOrUnderutilized" = "WhenEmptyOrUnderutilized" + + + check: + len(budgets) <= 50 if budgets + _regex_match(str(consolidateAfter), r"^(([0-9]+(s|m|h))+)|(Never)$") + + +schema KarpenterShV1NodePoolSpecDisruptionBudgetsItems0: + r""" + Budget defines when Karpenter will restrict the + number of Node Claims that can be terminating simultaneously. + + Attributes + ---------- + duration : str, default is Undefined, optional + Duration determines how long a Budget is active since each Schedule hit. + Only minutes and hours are accepted, as cron does not work in seconds. + If omitted, the budget is always active. + This is required if Schedule is set. + This regex has an optional 0s at the end since the duration.String() always adds + a 0s at the end. + nodes : str, default is "10%", required + Nodes dictates the maximum number of NodeClaims owned by this NodePool + that can be terminating at once. This is calculated by counting nodes that + have a deletion timestamp set, or are actively being deleted by Karpenter. + This field is required when specifying a budget. + This cannot be of type intstr.IntOrString since kubebuilder doesn't support pattern + checking for int nodes for IntOrString nodes. + Ref: https://github.com/kubernetes-sigs/controller-tools/blob/55efe4be40394a288216dab63156b0a64fb82929/pkg/crd/markers/validation.go#L379-L388 + reasons : [str], default is Undefined, optional + Reasons is a list of disruption methods that this budget applies to. If Reasons is not set, this budget applies to all methods. + Otherwise, this will apply to each reason defined. + allowed reasons are Underutilized, Empty, and Drifted. + schedule : str, default is Undefined, optional + Schedule specifies when a budget begins being active, following + the upstream cronjob syntax. If omitted, the budget is always active. + Timezones are not supported. + This field is required if Duration is set. + """ + + + duration?: str + + nodes: str = "10%" + + reasons?: [str] + + schedule?: str + + + check: + _regex_match(str(duration), r"^((([0-9]+(h|m))|([0-9]+h[0-9]+m))(0s)?)$") if duration + _regex_match(str(nodes), r"^((100|[0-9]{1,2})%|[0-9]+)$") + _regex_match(str(schedule), r"^(@(annually|yearly|monthly|weekly|daily|midnight|hourly))|((.+)\s(.+)\s(.+)\s(.+)\s(.+))$") if schedule + + +schema KarpenterShV1NodePoolSpecTemplate: + r""" + Template contains the template of possibilities for the provisioning logic to launch a NodeClaim with. + NodeClaims launched from this NodePool will often be further constrained than the template specifies. + + Attributes + ---------- + metadata : KarpenterShV1NodePoolSpecTemplateMetadata, default is Undefined, optional + metadata + spec : KarpenterShV1NodePoolSpecTemplateSpec, default is Undefined, required + spec + """ + + + metadata?: KarpenterShV1NodePoolSpecTemplateMetadata + + spec: KarpenterShV1NodePoolSpecTemplateSpec + + +schema KarpenterShV1NodePoolSpecTemplateMetadata: + r""" + karpenter sh v1 node pool spec template metadata + + Attributes + ---------- + annotations : {str:str}, default is Undefined, optional + Annotations is an unstructured key value map stored with a resource that may be + set by external tools to store and retrieve arbitrary metadata. They are not + queryable and should be preserved when modifying objects. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + labels : {str:str}, default is Undefined, optional + Map of string keys and values that can be used to organize and categorize + (scope and select) objects. May match selectors of replication controllers + and services. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + """ + + + annotations?: {str:str} + + labels?: {str:str} + + + check: + all _, labels in labels { len(labels) <= 63 if labels not in [None, Undefined] } if labels + all _, labels in labels { _regex_match(str(labels), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") if labels } if labels + + +schema KarpenterShV1NodePoolSpecTemplateSpec: + r""" + NodeClaimTemplateSpec describes the desired state of the NodeClaim in the Nodepool + NodeClaimTemplateSpec is used in the NodePool's NodeClaimTemplate, with the resource requests omitted since + users are not able to set resource requests in the NodePool. + + 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 : [KarpenterShV1NodePoolSpecTemplateSpecRequirementsItems0], default is Undefined, required + Requirements are layered with GetLabels and applied to every node. + startupTaints : [KarpenterShV1NodePoolSpecTemplateSpecStartupTaintsItems0], 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 : [KarpenterShV1NodePoolSpecTemplateSpecTaintsItems0], 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 : KarpenterShV1NodePoolSpecTemplateSpecNodeClassRef, default is Undefined, required + node class ref + """ + + + expireAfter?: str = "720h" + + requirements: [KarpenterShV1NodePoolSpecTemplateSpecRequirementsItems0] + + startupTaints?: [KarpenterShV1NodePoolSpecTemplateSpecStartupTaintsItems0] + + taints?: [KarpenterShV1NodePoolSpecTemplateSpecTaintsItems0] + + terminationGracePeriod?: str + + nodeClassRef: KarpenterShV1NodePoolSpecTemplateSpecNodeClassRef + + + 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 KarpenterShV1NodePoolSpecTemplateSpecNodeClassRef: + 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 KarpenterShV1NodePoolSpecTemplateSpecRequirementsItems0: + 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 KarpenterShV1NodePoolSpecTemplateSpecStartupTaintsItems0: + 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 KarpenterShV1NodePoolSpecTemplateSpecTaintsItems0: + 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 KarpenterShV1NodePoolStatus: + r""" + NodePoolStatus defines the observed state of NodePool + + Attributes + ---------- + conditions : [KarpenterShV1NodePoolStatusConditionsItems0], default is Undefined, optional + Conditions contains signals for health and readiness + resources : {str:int | str}, default is Undefined, optional + Resources is the list of resources that have been provisioned. + """ + + + conditions?: [KarpenterShV1NodePoolStatusConditionsItems0] + + resources?: {str:int | str} + + + check: + all _, resources in resources { _regex_match(str(resources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if resources } if resources + + +schema KarpenterShV1NodePoolStatusConditionsItems0: + 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, required + 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, required + 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 + observedGeneration >= 0 if observedGeneration not in [None, Undefined] + len(reason) <= 1024 + len(reason) >= 1 + _regex_match(str(reason), r"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$") + 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])$") + + diff --git a/karpenter/v1beta1/karpenter_sh_v1beta1_node_claim.k b/karpenter/v1beta1/karpenter_sh_v1beta1_node_claim.k index 6c0b6902..22b256f7 100644 --- a/karpenter/v1beta1/karpenter_sh_v1beta1_node_claim.k +++ b/karpenter/v1beta1/karpenter_sh_v1beta1_node_claim.k @@ -4,10 +4,11 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c """ import regex import k8s.apimachinery.pkg.apis.meta.v1 +_regex_match = regex.match schema NodeClaim: - """ + r""" NodeClaim is the Schema for the NodeClaims API Attributes @@ -18,7 +19,7 @@ schema NodeClaim: 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 : KarpenterShV1beta1NodeClaimSpec, default is Undefined, optional + spec : KarpenterShV1beta1NodeClaimSpec, default is Undefined, required spec status : KarpenterShV1beta1NodeClaimStatus, default is Undefined, optional status @@ -31,78 +32,95 @@ schema NodeClaim: metadata?: v1.ObjectMeta - spec?: KarpenterShV1beta1NodeClaimSpec + spec: KarpenterShV1beta1NodeClaimSpec status?: KarpenterShV1beta1NodeClaimStatus schema KarpenterShV1beta1NodeClaimSpec: - """ + r""" NodeClaimSpec describes the desired state of the NodeClaim Attributes ---------- + requirements : [KarpenterShV1beta1NodeClaimSpecRequirementsItems0], default is Undefined, required + Requirements are layered with GetLabels and applied to every node. + startupTaints : [KarpenterShV1beta1NodeClaimSpecStartupTaintsItems0], 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 : [KarpenterShV1beta1NodeClaimSpecTaintsItems0], default is Undefined, optional + Taints will be applied to the NodeClaim's node. kubelet : KarpenterShV1beta1NodeClaimSpecKubelet, default is Undefined, optional kubelet nodeClassRef : KarpenterShV1beta1NodeClaimSpecNodeClassRef, default is Undefined, required node class ref - requirements : [KarpenterShV1beta1NodeClaimSpecRequirementsItems0], default is Undefined, required - Requirements are layered with GetLabels and applied to every node. resources : KarpenterShV1beta1NodeClaimSpecResources, default is Undefined, optional resources - startupTaints : [KarpenterShV1beta1NodeClaimSpecStartupTaintsItems0], 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 : [KarpenterShV1beta1NodeClaimSpecTaintsItems0], default is Undefined, optional - Taints will be applied to the NodeClaim's node. """ - kubelet?: KarpenterShV1beta1NodeClaimSpecKubelet - - nodeClassRef: KarpenterShV1beta1NodeClaimSpecNodeClassRef - requirements: [KarpenterShV1beta1NodeClaimSpecRequirementsItems0] - resources?: KarpenterShV1beta1NodeClaimSpecResources - startupTaints?: [KarpenterShV1beta1NodeClaimSpecStartupTaintsItems0] taints?: [KarpenterShV1beta1NodeClaimSpecTaintsItems0] + kubelet?: KarpenterShV1beta1NodeClaimSpecKubelet + + nodeClassRef: KarpenterShV1beta1NodeClaimSpecNodeClassRef + + resources?: KarpenterShV1beta1NodeClaimSpecResources + check: - len(requirements) <= 30 + len(requirements) <= 100 schema KarpenterShV1beta1NodeClaimSpecKubelet: - """ - Kubelet defines args to be used when configuring kubelet on provisioned nodes. They are a subset of the upstream types, recognizing not all options may be supported. Wherever possible, the types and names should reflect the upstream kubelet types. + r""" + Kubelet defines args to be used when configuring kubelet on provisioned nodes. + They are a subset of the upstream types, recognizing not all options may be supported. + Wherever possible, the types and names should reflect the upstream kubelet types. Attributes ---------- clusterDNS : [str], default is Undefined, optional - clusterDNS is a list of IP addresses for the cluster DNS server. Note that not all providers may use all addresses. + clusterDNS is a list of IP addresses for the cluster DNS server. + Note that not all providers may use all addresses. cpuCFSQuota : bool, default is Undefined, optional CPUCFSQuota enables CPU CFS quota enforcement for containers that specify CPU limits. evictionHard : {str:str}, default is Undefined, optional EvictionHard is the map of signal names to quantities that define hard eviction thresholds evictionMaxPodGracePeriod : int, default is Undefined, optional - EvictionMaxPodGracePeriod is the maximum allowed grace period (in seconds) to use when terminating pods in response to soft eviction thresholds being met. + EvictionMaxPodGracePeriod is the maximum allowed grace period (in seconds) to use when terminating pods in + response to soft eviction thresholds being met. evictionSoft : {str:str}, default is Undefined, optional EvictionSoft is the map of signal names to quantities that define soft eviction thresholds evictionSoftGracePeriod : {str:str}, default is Undefined, optional EvictionSoftGracePeriod is the map of signal names to quantities that define grace periods for each eviction signal imageGCHighThresholdPercent : int, default is Undefined, optional - ImageGCHighThresholdPercent is the percent of disk usage after which image garbage collection is always run. The percent is calculated by dividing this field value by 100, so this field must be between 0 and 100, inclusive. When specified, the value must be greater than ImageGCLowThresholdPercent. + ImageGCHighThresholdPercent is the percent of disk usage after which image + garbage collection is always run. The percent is calculated by dividing this + field value by 100, so this field must be between 0 and 100, inclusive. + When specified, the value must be greater than ImageGCLowThresholdPercent. imageGCLowThresholdPercent : int, default is Undefined, optional - ImageGCLowThresholdPercent is the percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to. The percent is calculated by dividing this field value by 100, so the field value must be between 0 and 100, inclusive. When specified, the value must be less than imageGCHighThresholdPercent - kubeReserved : {str:int | str}, default is Undefined, optional + ImageGCLowThresholdPercent is the percent of disk usage before which image + garbage collection is never run. Lowest disk usage to garbage collect to. + The percent is calculated by dividing this field value by 100, + so the field value must be between 0 and 100, inclusive. + When specified, the value must be less than imageGCHighThresholdPercent + kubeReserved : {str:str}, default is Undefined, optional KubeReserved contains resources reserved for Kubernetes system components. maxPods : int, default is Undefined, optional - MaxPods is an override for the maximum number of pods that can run on a worker node instance. + MaxPods is an override for the maximum number of pods that can run on + a worker node instance. podsPerCore : int, default is Undefined, optional - PodsPerCore is an override for the number of pods that can run on a worker node instance based on the number of cpu cores. This value cannot exceed MaxPods, so, if MaxPods is a lower value, that value will be used. - systemReserved : {str:int | str}, default is Undefined, optional + PodsPerCore is an override for the number of pods that can run on a worker node + instance based on the number of cpu cores. This value cannot exceed MaxPods, so, if + MaxPods is a lower value, that value will be used. + systemReserved : {str:str}, default is Undefined, optional SystemReserved contains resources reserved for OS system daemons and kernel memory. """ @@ -123,30 +141,30 @@ schema KarpenterShV1beta1NodeClaimSpecKubelet: imageGCLowThresholdPercent?: int - kubeReserved?: {str:int | str} + kubeReserved?: {str:str} maxPods?: int podsPerCore?: int - systemReserved?: {str:int | str} + systemReserved?: {str:str} check: - all _, n in evictionHard { regex.match(str(n), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") } if evictionHard - all _, n in evictionSoft { regex.match(str(n), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") } if evictionSoft - imageGCHighThresholdPercent <= 100 - imageGCHighThresholdPercent >= 0 - imageGCLowThresholdPercent <= 100 - imageGCLowThresholdPercent >= 0 - all _, n in kubeReserved { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if kubeReserved - maxPods >= 0 - podsPerCore >= 0 - all _, n in systemReserved { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if systemReserved + all _, evictionHard in evictionHard { _regex_match(str(evictionHard), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") if evictionHard } if evictionHard + all _, evictionSoft in evictionSoft { _regex_match(str(evictionSoft), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") if evictionSoft } if evictionSoft + imageGCHighThresholdPercent <= 100 if imageGCHighThresholdPercent not in [None, Undefined] + imageGCHighThresholdPercent >= 0 if imageGCHighThresholdPercent not in [None, Undefined] + imageGCLowThresholdPercent <= 100 if imageGCLowThresholdPercent not in [None, Undefined] + imageGCLowThresholdPercent >= 0 if imageGCLowThresholdPercent not in [None, Undefined] + all _, kubeReserved in kubeReserved { _regex_match(str(kubeReserved), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if kubeReserved } if kubeReserved + maxPods >= 0 if maxPods not in [None, Undefined] + podsPerCore >= 0 if podsPerCore not in [None, Undefined] + all _, systemReserved in systemReserved { _regex_match(str(systemReserved), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if systemReserved } if systemReserved schema KarpenterShV1beta1NodeClaimSpecNodeClassRef: - """ + r""" NodeClassRef is a reference to an object that defines provider specific configuration Attributes @@ -168,22 +186,33 @@ schema KarpenterShV1beta1NodeClaimSpecNodeClassRef: schema KarpenterShV1beta1NodeClaimSpecRequirementsItems0: - """ - A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + 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. + 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. + 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] @@ -191,13 +220,15 @@ schema KarpenterShV1beta1NodeClaimSpecRequirementsItems0: 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]$") - len(values) <= 63 - regex.match(str(values), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") if values + _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 KarpenterShV1beta1NodeClaimSpecResources: - """ + r""" Resources models the resource requirements for the NodeClaim to launch Attributes @@ -211,21 +242,25 @@ schema KarpenterShV1beta1NodeClaimSpecResources: check: - all _, n in requests { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if requests + 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 KarpenterShV1beta1NodeClaimSpecStartupTaintsItems0: - """ - The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. + 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. + 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. + 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. """ @@ -242,22 +277,26 @@ schema KarpenterShV1beta1NodeClaimSpecStartupTaintsItems0: 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 + _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 KarpenterShV1beta1NodeClaimSpecTaintsItems0: - """ - The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. + 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. + 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. + 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. """ @@ -274,12 +313,12 @@ schema KarpenterShV1beta1NodeClaimSpecTaintsItems0: 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 + _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 KarpenterShV1beta1NodeClaimStatus: - """ + r""" NodeClaimStatus defines the observed state of NodeClaim Attributes @@ -313,41 +352,62 @@ schema KarpenterShV1beta1NodeClaimStatus: check: - all _, n in allocatable { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if allocatable - all _, n in capacity { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if capacity + 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 KarpenterShV1beta1NodeClaimStatusConditionsItems0: - """ - Condition defines a readiness condition for a Knative resource. See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties + r""" + Condition aliases the upstream type and adds additional helper methods Attributes ---------- - lastTransitionTime : str, default is Undefined, optional - LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant). + 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 - A human readable message indicating details about the transition. + 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 - The reason for the condition's last transition. - severity : str, default is Undefined, optional - Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error. + 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. + status of the condition, one of True, False, Unknown. $type : str, default is Undefined, required - Type of condition. + 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 + lastTransitionTime: str message?: str - reason?: str + observedGeneration?: int - severity?: str + reason?: str - status: 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])$") + + diff --git a/karpenter/v1beta1/karpenter_sh_v1beta1_node_pool.k b/karpenter/v1beta1/karpenter_sh_v1beta1_node_pool.k index 1db2edac..5c8c6699 100644 --- a/karpenter/v1beta1/karpenter_sh_v1beta1_node_pool.k +++ b/karpenter/v1beta1/karpenter_sh_v1beta1_node_pool.k @@ -4,10 +4,11 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c """ import regex import k8s.apimachinery.pkg.apis.meta.v1 +_regex_match = regex.match schema NodePool: - """ + r""" NodePool is the Schema for the NodePools API Attributes @@ -18,7 +19,7 @@ schema NodePool: 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 : KarpenterShV1beta1NodePoolSpec, default is Undefined, optional + spec : KarpenterShV1beta1NodePoolSpec, default is Undefined, required spec status : KarpenterShV1beta1NodePoolStatus, default is Undefined, optional status @@ -31,58 +32,77 @@ schema NodePool: metadata?: v1.ObjectMeta - spec?: KarpenterShV1beta1NodePoolSpec + spec: KarpenterShV1beta1NodePoolSpec status?: KarpenterShV1beta1NodePoolStatus schema KarpenterShV1beta1NodePoolSpec: - """ - NodePoolSpec is the top level provisioner specification. Provisioners launch nodes in response to pods that are unschedulable. A single provisioner is capable of managing a diverse set of nodes. Node properties are determined from a combination of provisioner and pod scheduling constraints. + r""" + NodePoolSpec is the top level nodepool specification. Nodepools + launch nodes in response to pods that are unschedulable. A single nodepool + is capable of managing a diverse set of nodes. Node properties are determined + from a combination of nodepool and pod scheduling constraints. Attributes ---------- - disruption : KarpenterShV1beta1NodePoolSpecDisruption, default is Undefined, optional - disruption limits : {str:int | str}, default is Undefined, optional Limits define a set of bounds for provisioning capacity. - template : KarpenterShV1beta1NodePoolSpecTemplate, default is Undefined, optional - template weight : int, default is Undefined, optional - Weight is the priority given to the provisioner during scheduling. A higher numerical weight indicates that this provisioner will be ordered ahead of other provisioners with lower weights. A provisioner with no weight will be treated as if it is a provisioner with a weight of 0. + Weight is the priority given to the nodepool during scheduling. A higher + numerical weight indicates that this nodepool will be ordered + ahead of other nodepools with lower weights. A nodepool with no weight + will be treated as if it is a nodepool with a weight of 0. + disruption : KarpenterShV1beta1NodePoolSpecDisruption, default is Undefined, optional + disruption + template : KarpenterShV1beta1NodePoolSpecTemplate, default is Undefined, required + template """ - disruption?: KarpenterShV1beta1NodePoolSpecDisruption - limits?: {str:int | str} - template?: KarpenterShV1beta1NodePoolSpecTemplate - weight?: int + disruption?: KarpenterShV1beta1NodePoolSpecDisruption + + template: KarpenterShV1beta1NodePoolSpecTemplate + check: - all _, n in limits { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if limits - weight <= 100 - weight >= 1 + all _, limits in limits { _regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits + weight <= 100 if weight not in [None, Undefined] + weight >= 1 if weight not in [None, Undefined] schema KarpenterShV1beta1NodePoolSpecDisruption: - """ + r""" Disruption contains the parameters that relate to Karpenter's disruption logic Attributes ---------- + budgets : [KarpenterShV1beta1NodePoolSpecDisruptionBudgetsItems0], default is [{"nodes": {"value": "10%", "x-order": 0}}], optional + Budgets is a list of Budgets. + If there are multiple active budgets, Karpenter uses + the most restrictive value. If left undefined, + this will default to one budget with a value to 10%. consolidateAfter : str, default is Undefined, optional - ConsolidateAfter is the duration the controller will wait before attempting to terminate nodes that are underutilized. Refer to ConsolidationPolicy for how underutilization is considered. + ConsolidateAfter is the duration the controller will wait + before attempting to terminate nodes that are underutilized. + Refer to ConsolidationPolicy for how underutilization is considered. consolidationPolicy : str, default is "WhenUnderutilized", optional - ConsolidationPolicy describes which nodes Karpenter can disrupt through its consolidation algorithm. This policy defaults to "WhenUnderutilized" if not specified + ConsolidationPolicy describes which nodes Karpenter can disrupt through its consolidation + algorithm. This policy defaults to "WhenUnderutilized" if not specified 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. + 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. """ + budgets?: [KarpenterShV1beta1NodePoolSpecDisruptionBudgetsItems0] = [{"nodes": {"x-order": 0, "value": "10%"}}] + consolidateAfter?: str consolidationPolicy?: "WhenEmpty" | "WhenUnderutilized" = "WhenUnderutilized" @@ -91,38 +111,89 @@ schema KarpenterShV1beta1NodePoolSpecDisruption: check: - regex.match(str(consolidateAfter), r"^(([0-9]+(s|m|h))+)|(Never)$") if consolidateAfter - regex.match(str(expireAfter), r"^(([0-9]+(s|m|h))+)|(Never)$") if expireAfter + len(budgets) <= 50 if budgets + _regex_match(str(consolidateAfter), r"^(([0-9]+(s|m|h))+)|(Never)$") if consolidateAfter + _regex_match(str(expireAfter), r"^(([0-9]+(s|m|h))+)|(Never)$") if expireAfter -schema KarpenterShV1beta1NodePoolSpecTemplate: +schema KarpenterShV1beta1NodePoolSpecDisruptionBudgetsItems0: + r""" + Budget defines when Karpenter will restrict the + number of Node Claims that can be terminating simultaneously. + + Attributes + ---------- + duration : str, default is Undefined, optional + Duration determines how long a Budget is active since each Schedule hit. + Only minutes and hours are accepted, as cron does not work in seconds. + If omitted, the budget is always active. + This is required if Schedule is set. + This regex has an optional 0s at the end since the duration.String() always adds + a 0s at the end. + nodes : str, default is "10%", required + Nodes dictates the maximum number of NodeClaims owned by this NodePool + that can be terminating at once. This is calculated by counting nodes that + have a deletion timestamp set, or are actively being deleted by Karpenter. + This field is required when specifying a budget. + This cannot be of type intstr.IntOrString since kubebuilder doesn't support pattern + checking for int nodes for IntOrString nodes. + Ref: https://github.com/kubernetes-sigs/controller-tools/blob/55efe4be40394a288216dab63156b0a64fb82929/pkg/crd/markers/validation.go#L379-L388 + schedule : str, default is Undefined, optional + Schedule specifies when a budget begins being active, following + the upstream cronjob syntax. If omitted, the budget is always active. + Timezones are not supported. + This field is required if Duration is set. """ - Template contains the template of possibilities for the provisioning logic to launch a NodeClaim with. NodeClaims launched from this NodePool will often be further constrained than the template specifies. + + + duration?: str + + nodes: str = "10%" + + schedule?: str + + + check: + _regex_match(str(duration), r"^((([0-9]+(h|m))|([0-9]+h[0-9]+m))(0s)?)$") if duration + _regex_match(str(nodes), r"^((100|[0-9]{1,2})%|[0-9]+)$") + _regex_match(str(schedule), r"^(@(annually|yearly|monthly|weekly|daily|midnight|hourly))|((.+)\s(.+)\s(.+)\s(.+)\s(.+))$") if schedule + + +schema KarpenterShV1beta1NodePoolSpecTemplate: + r""" + Template contains the template of possibilities for the provisioning logic to launch a NodeClaim with. + NodeClaims launched from this NodePool will often be further constrained than the template specifies. Attributes ---------- metadata : KarpenterShV1beta1NodePoolSpecTemplateMetadata, default is Undefined, optional metadata - spec : KarpenterShV1beta1NodePoolSpecTemplateSpec, default is Undefined, optional + spec : KarpenterShV1beta1NodePoolSpecTemplateSpec, default is Undefined, required spec """ metadata?: KarpenterShV1beta1NodePoolSpecTemplateMetadata - spec?: KarpenterShV1beta1NodePoolSpecTemplateSpec + spec: KarpenterShV1beta1NodePoolSpecTemplateSpec schema KarpenterShV1beta1NodePoolSpecTemplateMetadata: - """ + r""" karpenter sh v1beta1 node pool spec template metadata Attributes ---------- annotations : {str:str}, default is Undefined, optional - Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + Annotations is an unstructured key value map stored with a resource that may be + set by external tools to store and retrieve arbitrary metadata. They are not + queryable and should be preserved when modifying objects. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations labels : {str:str}, default is Undefined, optional - Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + Map of string keys and values that can be used to organize and categorize + (scope and select) objects. May match selectors of replication controllers + and services. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels """ @@ -132,76 +203,94 @@ schema KarpenterShV1beta1NodePoolSpecTemplateMetadata: check: - all _, n in labels { regex.match(str(n), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") } if labels + all _, labels in labels { len(labels) <= 63 if labels not in [None, Undefined] } if labels + all _, labels in labels { _regex_match(str(labels), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") if labels } if labels schema KarpenterShV1beta1NodePoolSpecTemplateSpec: - """ + r""" NodeClaimSpec describes the desired state of the NodeClaim Attributes ---------- + requirements : [KarpenterShV1beta1NodePoolSpecTemplateSpecRequirementsItems0], default is Undefined, required + Requirements are layered with GetLabels and applied to every node. + startupTaints : [KarpenterShV1beta1NodePoolSpecTemplateSpecStartupTaintsItems0], 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 : [KarpenterShV1beta1NodePoolSpecTemplateSpecTaintsItems0], default is Undefined, optional + Taints will be applied to the NodeClaim's node. kubelet : KarpenterShV1beta1NodePoolSpecTemplateSpecKubelet, default is Undefined, optional kubelet nodeClassRef : KarpenterShV1beta1NodePoolSpecTemplateSpecNodeClassRef, default is Undefined, required node class ref - requirements : [KarpenterShV1beta1NodePoolSpecTemplateSpecRequirementsItems0], default is Undefined, required - Requirements are layered with GetLabels and applied to every node. resources : KarpenterShV1beta1NodePoolSpecTemplateSpecResources, default is Undefined, optional resources - startupTaints : [KarpenterShV1beta1NodePoolSpecTemplateSpecStartupTaintsItems0], 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 : [KarpenterShV1beta1NodePoolSpecTemplateSpecTaintsItems0], default is Undefined, optional - Taints will be applied to the NodeClaim's node. """ - kubelet?: KarpenterShV1beta1NodePoolSpecTemplateSpecKubelet - - nodeClassRef: KarpenterShV1beta1NodePoolSpecTemplateSpecNodeClassRef - requirements: [KarpenterShV1beta1NodePoolSpecTemplateSpecRequirementsItems0] - resources?: KarpenterShV1beta1NodePoolSpecTemplateSpecResources - startupTaints?: [KarpenterShV1beta1NodePoolSpecTemplateSpecStartupTaintsItems0] taints?: [KarpenterShV1beta1NodePoolSpecTemplateSpecTaintsItems0] + kubelet?: KarpenterShV1beta1NodePoolSpecTemplateSpecKubelet + + nodeClassRef: KarpenterShV1beta1NodePoolSpecTemplateSpecNodeClassRef + + resources?: KarpenterShV1beta1NodePoolSpecTemplateSpecResources + check: - len(requirements) <= 30 + len(requirements) <= 100 schema KarpenterShV1beta1NodePoolSpecTemplateSpecKubelet: - """ - Kubelet defines args to be used when configuring kubelet on provisioned nodes. They are a subset of the upstream types, recognizing not all options may be supported. Wherever possible, the types and names should reflect the upstream kubelet types. + r""" + Kubelet defines args to be used when configuring kubelet on provisioned nodes. + They are a subset of the upstream types, recognizing not all options may be supported. + Wherever possible, the types and names should reflect the upstream kubelet types. Attributes ---------- clusterDNS : [str], default is Undefined, optional - clusterDNS is a list of IP addresses for the cluster DNS server. Note that not all providers may use all addresses. + clusterDNS is a list of IP addresses for the cluster DNS server. + Note that not all providers may use all addresses. cpuCFSQuota : bool, default is Undefined, optional CPUCFSQuota enables CPU CFS quota enforcement for containers that specify CPU limits. evictionHard : {str:str}, default is Undefined, optional EvictionHard is the map of signal names to quantities that define hard eviction thresholds evictionMaxPodGracePeriod : int, default is Undefined, optional - EvictionMaxPodGracePeriod is the maximum allowed grace period (in seconds) to use when terminating pods in response to soft eviction thresholds being met. + EvictionMaxPodGracePeriod is the maximum allowed grace period (in seconds) to use when terminating pods in + response to soft eviction thresholds being met. evictionSoft : {str:str}, default is Undefined, optional EvictionSoft is the map of signal names to quantities that define soft eviction thresholds evictionSoftGracePeriod : {str:str}, default is Undefined, optional EvictionSoftGracePeriod is the map of signal names to quantities that define grace periods for each eviction signal imageGCHighThresholdPercent : int, default is Undefined, optional - ImageGCHighThresholdPercent is the percent of disk usage after which image garbage collection is always run. The percent is calculated by dividing this field value by 100, so this field must be between 0 and 100, inclusive. When specified, the value must be greater than ImageGCLowThresholdPercent. + ImageGCHighThresholdPercent is the percent of disk usage after which image + garbage collection is always run. The percent is calculated by dividing this + field value by 100, so this field must be between 0 and 100, inclusive. + When specified, the value must be greater than ImageGCLowThresholdPercent. imageGCLowThresholdPercent : int, default is Undefined, optional - ImageGCLowThresholdPercent is the percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to. The percent is calculated by dividing this field value by 100, so the field value must be between 0 and 100, inclusive. When specified, the value must be less than imageGCHighThresholdPercent - kubeReserved : {str:int | str}, default is Undefined, optional + ImageGCLowThresholdPercent is the percent of disk usage before which image + garbage collection is never run. Lowest disk usage to garbage collect to. + The percent is calculated by dividing this field value by 100, + so the field value must be between 0 and 100, inclusive. + When specified, the value must be less than imageGCHighThresholdPercent + kubeReserved : {str:str}, default is Undefined, optional KubeReserved contains resources reserved for Kubernetes system components. maxPods : int, default is Undefined, optional - MaxPods is an override for the maximum number of pods that can run on a worker node instance. + MaxPods is an override for the maximum number of pods that can run on + a worker node instance. podsPerCore : int, default is Undefined, optional - PodsPerCore is an override for the number of pods that can run on a worker node instance based on the number of cpu cores. This value cannot exceed MaxPods, so, if MaxPods is a lower value, that value will be used. - systemReserved : {str:int | str}, default is Undefined, optional + PodsPerCore is an override for the number of pods that can run on a worker node + instance based on the number of cpu cores. This value cannot exceed MaxPods, so, if + MaxPods is a lower value, that value will be used. + systemReserved : {str:str}, default is Undefined, optional SystemReserved contains resources reserved for OS system daemons and kernel memory. """ @@ -222,30 +311,30 @@ schema KarpenterShV1beta1NodePoolSpecTemplateSpecKubelet: imageGCLowThresholdPercent?: int - kubeReserved?: {str:int | str} + kubeReserved?: {str:str} maxPods?: int podsPerCore?: int - systemReserved?: {str:int | str} + systemReserved?: {str:str} check: - all _, n in evictionHard { regex.match(str(n), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") } if evictionHard - all _, n in evictionSoft { regex.match(str(n), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") } if evictionSoft - imageGCHighThresholdPercent <= 100 - imageGCHighThresholdPercent >= 0 - imageGCLowThresholdPercent <= 100 - imageGCLowThresholdPercent >= 0 - all _, n in kubeReserved { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if kubeReserved - maxPods >= 0 - podsPerCore >= 0 - all _, n in systemReserved { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if systemReserved + all _, evictionHard in evictionHard { _regex_match(str(evictionHard), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") if evictionHard } if evictionHard + all _, evictionSoft in evictionSoft { _regex_match(str(evictionSoft), r"^((\d{1,2}(\.\d{1,2})?|100(\.0{1,2})?)%||(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?)$") if evictionSoft } if evictionSoft + imageGCHighThresholdPercent <= 100 if imageGCHighThresholdPercent not in [None, Undefined] + imageGCHighThresholdPercent >= 0 if imageGCHighThresholdPercent not in [None, Undefined] + imageGCLowThresholdPercent <= 100 if imageGCLowThresholdPercent not in [None, Undefined] + imageGCLowThresholdPercent >= 0 if imageGCLowThresholdPercent not in [None, Undefined] + all _, kubeReserved in kubeReserved { _regex_match(str(kubeReserved), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if kubeReserved } if kubeReserved + maxPods >= 0 if maxPods not in [None, Undefined] + podsPerCore >= 0 if podsPerCore not in [None, Undefined] + all _, systemReserved in systemReserved { _regex_match(str(systemReserved), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if systemReserved } if systemReserved schema KarpenterShV1beta1NodePoolSpecTemplateSpecNodeClassRef: - """ + r""" NodeClassRef is a reference to an object that defines provider specific configuration Attributes @@ -267,22 +356,33 @@ schema KarpenterShV1beta1NodePoolSpecTemplateSpecNodeClassRef: schema KarpenterShV1beta1NodePoolSpecTemplateSpecRequirementsItems0: - """ - A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + 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. + 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. + 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] @@ -290,13 +390,15 @@ schema KarpenterShV1beta1NodePoolSpecTemplateSpecRequirementsItems0: 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]$") - len(values) <= 63 - regex.match(str(values), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") if values + _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 KarpenterShV1beta1NodePoolSpecTemplateSpecResources: - """ + r""" Resources models the resource requirements for the NodeClaim to launch Attributes @@ -310,21 +412,25 @@ schema KarpenterShV1beta1NodePoolSpecTemplateSpecResources: check: - all _, n in requests { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if requests + 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 KarpenterShV1beta1NodePoolSpecTemplateSpecStartupTaintsItems0: - """ - The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. + 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. + 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. + 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. """ @@ -341,22 +447,26 @@ schema KarpenterShV1beta1NodePoolSpecTemplateSpecStartupTaintsItems0: 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 + _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 KarpenterShV1beta1NodePoolSpecTemplateSpecTaintsItems0: - """ - The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. + 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. + 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. + 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. """ @@ -373,25 +483,85 @@ schema KarpenterShV1beta1NodePoolSpecTemplateSpecTaintsItems0: 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 + _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 KarpenterShV1beta1NodePoolStatus: - """ + r""" NodePoolStatus defines the observed state of NodePool Attributes ---------- + conditions : [KarpenterShV1beta1NodePoolStatusConditionsItems0], default is Undefined, optional + Conditions contains signals for health and readiness resources : {str:int | str}, default is Undefined, optional Resources is the list of resources that have been provisioned. """ + conditions?: [KarpenterShV1beta1NodePoolStatusConditionsItems0] + resources?: {str:int | str} check: - all _, n in resources { regex.match(str(n), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") } if resources + all _, resources in resources { _regex_match(str(resources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if resources } if resources + + +schema KarpenterShV1beta1NodePoolStatusConditionsItems0: + 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, required + 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, required + 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 + observedGeneration >= 0 if observedGeneration not in [None, Undefined] + len(reason) <= 1024 + len(reason) >= 1 + _regex_match(str(reason), r"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$") + 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])$")