UNPKG

@soft-stech/karpenter

Version:
342 lines (341 loc) 20.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.INodePoolSchema = void 0; // Generated by ts-to-zod const zod_1 = require("zod"); const ObjectMeta_schema_1 = require("@soft-stech/apimachinery/apis/meta/v1/ObjectMeta.schema"); /** * NodePool is the Schema for the NodePools API */ exports.INodePoolSchema = zod_1.z.object({ /** * 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 */ "apiVersion": zod_1.z.literal("karpenter.sh/v1beta1"), /** * 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 */ "kind": zod_1.z.literal("NodePool"), "metadata": ObjectMeta_schema_1.iObjectMetaSchema.optional(), /** * 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. */ "spec": zod_1.z.object({ /** * Disruption contains the parameters that relate to Karpenter's disruption logic */ "disruption": zod_1.z.object({ /** * 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%. */ "budgets": zod_1.z.array(zod_1.z.object({ /** * 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. * @pattern ^((([0-9]+(h|m))|([0-9]+h[0-9]+m))(0s)?)$ */ "duration": zod_1.z.string().regex(/^((([0-9]+(h|m))|([0-9]+h[0-9]+m))(0s)?)$/).optional(), /** * 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 * @default "10%" * @pattern ^((100|[0-9]{1,2})%|[0-9]+)$ */ "nodes": zod_1.z.string().regex(/^((100|[0-9]{1,2})%|[0-9]+)$/).default("10%"), /** * 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. * @pattern ^(@(annually|yearly|monthly|weekly|daily|midnight|hourly))|((.+)\s(.+)\s(.+)\s(.+)\s(.+))$ */ "schedule": zod_1.z.string().regex(/^(@(annually|yearly|monthly|weekly|daily|midnight|hourly))|((.+)\s(.+)\s(.+)\s(.+)\s(.+))$/).optional() })).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. * @pattern ^(([0-9]+(s|m|h))+)|(Never)$ */ "consolidateAfter": zod_1.z.string().regex(/^(([0-9]+(s|m|h))+)|(Never)$/).optional(), /** * ConsolidationPolicy describes which nodes Karpenter can disrupt through its consolidation * algorithm. This policy defaults to "WhenUnderutilized" if not specified * @default "WhenUnderutilized" */ "consolidationPolicy": zod_1.z.union([zod_1.z.literal("WhenEmpty"), zod_1.z.literal("WhenUnderutilized")]).optional().default("WhenUnderutilized"), /** * 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. * @default "720h" * @pattern ^(([0-9]+(s|m|h))+)|(Never)$ */ "expireAfter": zod_1.z.string().regex(/^(([0-9]+(s|m|h))+)|(Never)$/).optional().default("720h") }).optional(), /** * Limits define a set of bounds for provisioning capacity. */ "limits": zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()])).optional(), /** * 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. */ "template": zod_1.z.object({ "metadata": zod_1.z.object({ /** * 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": zod_1.z.record(zod_1.z.string(), zod_1.z.string()).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 */ "labels": zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional() }).optional(), /** * NodeClaimSpec describes the desired state of the NodeClaim */ "spec": zod_1.z.object({ /** * 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. */ "kubelet": zod_1.z.object({ /** * clusterDNS is a list of IP addresses for the cluster DNS server. * Note that not all providers may use all addresses. */ "clusterDNS": zod_1.z.array(zod_1.z.string()).optional(), /** * CPUCFSQuota enables CPU CFS quota enforcement for containers that specify CPU limits. */ "cpuCFSQuota": zod_1.z.boolean().optional(), /** * EvictionHard is the map of signal names to quantities that define hard eviction thresholds */ "evictionHard": zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(), /** * EvictionMaxPodGracePeriod is the maximum allowed grace period (in seconds) to use when terminating pods in * response to soft eviction thresholds being met. * @format int32 */ "evictionMaxPodGracePeriod": zod_1.z.int32().optional(), /** * EvictionSoft is the map of signal names to quantities that define soft eviction thresholds */ "evictionSoft": zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(), /** * EvictionSoftGracePeriod is the map of signal names to quantities that define grace periods for each eviction signal */ "evictionSoftGracePeriod": zod_1.z.record(zod_1.z.string(), zod_1.z.string()).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. * @maximum 100 * @format int32 */ "imageGCHighThresholdPercent": zod_1.z.int32().max(100).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 * @maximum 100 * @format int32 */ "imageGCLowThresholdPercent": zod_1.z.int32().max(100).optional(), /** * KubeReserved contains resources reserved for Kubernetes system components. */ "kubeReserved": zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()])).optional(), /** * MaxPods is an override for the maximum number of pods that can run on * a worker node instance. * @format int32 */ "maxPods": zod_1.z.int32().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. * @format int32 */ "podsPerCore": zod_1.z.int32().optional(), /** * SystemReserved contains resources reserved for OS system daemons and kernel memory. */ "systemReserved": zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()])).optional() }).optional(), /** * NodeClassRef is a reference to an object that defines provider specific configuration */ "nodeClassRef": zod_1.z.object({ /** * API version of the referent */ "apiVersion": zod_1.z.string().optional(), /** * Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" */ "kind": zod_1.z.string().optional(), /** * Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names */ "name": zod_1.z.string() }), /** * Requirements are layered with GetLabels and applied to every node. */ "requirements": zod_1.z.array(zod_1.z.object({ /** * The label key that the selector applies to. * @maxLength 316 * @pattern ^([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]$ */ "key": zod_1.z.string().max(316).regex(/^([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]$/), /** * 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. * @minimum 1 * @maximum 50 */ "minValues": zod_1.z.number().min(1).max(50).optional(), /** * Represents a key's relationship to a set of values. * Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. */ "operator": zod_1.z.union([zod_1.z.literal("In"), zod_1.z.literal("NotIn"), zod_1.z.literal("Exists"), zod_1.z.literal("DoesNotExist"), zod_1.z.literal("Gt"), zod_1.z.literal("Lt")]), /** * 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. * @maxLength 63 */ "values": zod_1.z.array(zod_1.z.string()).max(63).optional() })), /** * Resources models the resource requirements for the NodeClaim to launch */ "resources": zod_1.z.object({ /** * Requests describes the minimum required resources for the NodeClaim to launch */ "requests": zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()])).optional() }).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. */ "startupTaints": zod_1.z.array(zod_1.z.object({ /** * Required. The effect of the taint on pods * that do not tolerate the taint. * Valid effects are NoSchedule, PreferNoSchedule and NoExecute. */ "effect": zod_1.z.union([zod_1.z.literal("NoSchedule"), zod_1.z.literal("PreferNoSchedule"), zod_1.z.literal("NoExecute")]), /** * Required. The taint key to be applied to a node. * @minLength 1 * @pattern ^([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]$ */ "key": zod_1.z.string().min(1).regex(/^([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]$/), /** * TimeAdded represents the time at which the taint was added. * It is only written for NoExecute taints. * @format date-time */ "timeAdded": zod_1.z.iso.datetime().optional().nullable(), /** * The taint value corresponding to the taint key. * @pattern ^([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]$ */ "value": zod_1.z.string().regex(/^([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]$/).optional() })).optional(), /** * Taints will be applied to the NodeClaim's node. */ "taints": zod_1.z.array(zod_1.z.object({ /** * Required. The effect of the taint on pods * that do not tolerate the taint. * Valid effects are NoSchedule, PreferNoSchedule and NoExecute. */ "effect": zod_1.z.union([zod_1.z.literal("NoSchedule"), zod_1.z.literal("PreferNoSchedule"), zod_1.z.literal("NoExecute")]), /** * Required. The taint key to be applied to a node. * @minLength 1 * @pattern ^([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]$ */ "key": zod_1.z.string().min(1).regex(/^([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]$/), /** * TimeAdded represents the time at which the taint was added. * It is only written for NoExecute taints. * @format date-time */ "timeAdded": zod_1.z.iso.datetime().optional().nullable(), /** * The taint value corresponding to the taint key. * @pattern ^([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]$ */ "value": zod_1.z.string().regex(/^([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]$/).optional() })).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. * @minimum 1 * @maximum 100 * @format int32 */ "weight": zod_1.z.int32().min(1).max(100).optional() }), /** * NodePoolStatus defines the observed state of NodePool */ "status": zod_1.z.object({ /** * Resources is the list of resources that have been provisioned. */ "resources": zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.number(), zod_1.z.string()])).optional() }).optional() });