Documentation ¶
Overview ¶
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=karpenter.sh
Index ¶
- Constants
- Variables
- func GetIntStrFromValue(str string) intstr.IntOrString
- func GetLabelDomain(key string) string
- func IsRestrictedLabel(key string) error
- func IsRestrictedNodeLabel(key string) bool
- func NodeClassLabelKey(gk schema.GroupKind) string
- func ValidateRequirement(requirement NodeSelectorRequirementWithMinValues) error
- type Budget
- type ConsolidationPolicy
- type Disruption
- type DisruptionReason
- type Limits
- type NillableDuration
- type NodeClaim
- func (in *NodeClaim) DeepCopy() *NodeClaim
- func (in *NodeClaim) DeepCopyInto(out *NodeClaim)
- func (in *NodeClaim) DeepCopyObject() runtime.Object
- func (in *NodeClaim) GetConditions() []status.Condition
- func (in *NodeClaim) SetConditions(conditions []status.Condition)
- func (in *NodeClaim) SetDefaults(_ context.Context)
- func (in *NodeClaim) StatusConditions() status.ConditionSet
- type NodeClaimList
- type NodeClaimSpec
- type NodeClaimStatus
- type NodeClaimTemplate
- type NodeClaimTemplateSpec
- type NodeClassReference
- type NodePool
- func (in *NodePool) DeepCopy() *NodePool
- func (in *NodePool) DeepCopyInto(out *NodePool)
- func (in *NodePool) DeepCopyObject() runtime.Object
- func (in *NodePool) GetAllowedDisruptionsByReason(c clock.Clock, numNodes int, reason DisruptionReason) (int, error)
- func (in *NodePool) GetConditions() []status.Condition
- func (in *NodePool) Hash() string
- func (in *NodePool) MustGetAllowedDisruptions(c clock.Clock, numNodes int, reason DisruptionReason) int
- func (in *NodePool) RuntimeValidate() (errs error)
- func (in *NodePool) SetConditions(conditions []status.Condition)
- func (in *NodePool) SetDefaults(_ context.Context)
- func (in *NodePool) StatusConditions() status.ConditionSet
- type NodePoolList
- type NodePoolSpec
- type NodePoolStatus
- type NodeSelectorRequirementWithMinValues
- type ObjectMeta
- type Provider
- type ResourceRequirements
Constants ¶
const ( ArchitectureAmd64 = "amd64" ArchitectureArm64 = "arm64" CapacityTypeSpot = "spot" CapacityTypeOnDemand = "on-demand" )
Well known labels and resources
const ( NodePoolLabelKey = apis.Group + "/nodepool" NodeInitializedLabelKey = apis.Group + "/initialized" NodeRegisteredLabelKey = apis.Group + "/registered" CapacityTypeLabelKey = apis.Group + "/capacity-type" )
Karpenter specific domains and labels
const ( DoNotDisruptAnnotationKey = apis.Group + "/do-not-disrupt" ProviderCompatibilityAnnotationKey = apis.CompatibilityGroup + "/provider" NodePoolHashAnnotationKey = apis.Group + "/nodepool-hash" NodePoolHashVersionAnnotationKey = apis.Group + "/nodepool-hash-version" NodeClaimTerminationTimestampAnnotationKey = apis.Group + "/nodeclaim-termination-timestamp" )
Karpenter specific annotations
const ( ConditionTypeLaunched = "Launched" ConditionTypeRegistered = "Registered" ConditionTypeInitialized = "Initialized" ConditionTypeConsolidatable = "Consolidatable" ConditionTypeDrifted = "Drifted" ConditionTypeInstanceTerminating = "InstanceTerminating" ConditionTypeConsistentStateFound = "ConsistentStateFound" )
const ( // ConditionTypeValidationSucceeded = "ValidationSucceeded" condition indicates that the // runtime-based configuration is valid for this NodePool ConditionTypeValidationSucceeded = "ValidationSucceeded" // ConditionTypeNodeClassReady = "NodeClassReady" condition indicates that underlying nodeClass was resolved and is reporting as Ready ConditionTypeNodeClassReady = "NodeClassReady" )
const ( DisruptedTaintKey = apis.Group + "/disrupted" UnregisteredTaintKey = apis.Group + "/unregistered" )
Karpenter specific taints
const Never = "Never"
const NodePoolHashVersion = "v3"
We need to bump the NodePoolHashVersion when we make an update to the NodePool CRD under these conditions: 1. A field changes its default value for an existing field that is already hashed 2. A field is added to the hash calculation with an already-set value 3. A field is removed from the hash calculations
const (
TerminationFinalizer = apis.Group + "/termination"
)
Karpenter specific finalizers
Variables ¶
var ( // RestrictedLabelDomains are either prohibited by the kubelet or reserved by karpenter RestrictedLabelDomains = sets.New( "kubernetes.io", "k8s.io", apis.Group, ) // LabelDomainExceptions are sub-domains of the RestrictedLabelDomains but allowed because // they are not used in a context where they may be passed as argument to kubelet. LabelDomainExceptions = sets.New( "kops.k8s.io", v1.LabelNamespaceSuffixNode, v1.LabelNamespaceNodeRestriction, ) // WellKnownLabels are labels that belong to the RestrictedLabelDomains but allowed. // Karpenter is aware of these labels, and they can be used to further narrow down // the range of the corresponding values by either nodepool or pods. WellKnownLabels = sets.New( NodePoolLabelKey, v1.LabelTopologyZone, v1.LabelTopologyRegion, v1.LabelInstanceTypeStable, v1.LabelArchStable, v1.LabelOSStable, CapacityTypeLabelKey, v1.LabelWindowsBuild, ) // RestrictedLabels are labels that should not be used // because they may interfere with the internal provisioning logic. RestrictedLabels = sets.New( v1.LabelHostname, ) // NormalizedLabels translate aliased concepts into the controller's // WellKnownLabels. Pod requirements are translated for compatibility. NormalizedLabels = map[string]string{ v1.LabelFailureDomainBetaZone: v1.LabelTopologyZone, "beta.kubernetes.io/arch": v1.LabelArchStable, "beta.kubernetes.io/os": v1.LabelOSStable, v1.LabelInstanceType: v1.LabelInstanceTypeStable, v1.LabelFailureDomainBetaRegion: v1.LabelTopologyRegion, } )
var ( SupportedNodeSelectorOps = sets.NewString( string(v1.NodeSelectorOpIn), string(v1.NodeSelectorOpNotIn), string(v1.NodeSelectorOpGt), string(v1.NodeSelectorOpLt), string(v1.NodeSelectorOpExists), string(v1.NodeSelectorOpDoesNotExist), ) SupportedReservedResources = sets.NewString( v1.ResourceCPU.String(), v1.ResourceMemory.String(), v1.ResourceEphemeralStorage.String(), "pid", ) SupportedEvictionSignals = sets.NewString( "memory.available", "nodefs.available", "nodefs.inodesFree", "imagefs.available", "imagefs.inodesFree", "pid.available", ) )
var ( // DisruptedNoScheduleTaint is applied by the disruption and termination controllers to nodes disrupted by Karpenter. // This ensures no additional pods schedule to those nodes while they are terminating. DisruptedNoScheduleTaint = v1.Taint{ Key: DisruptedTaintKey, Effect: v1.TaintEffectNoSchedule, } UnregisteredNoExecuteTaint = v1.Taint{ Key: UnregisteredTaintKey, Effect: v1.TaintEffectNoExecute, } )
Functions ¶
func GetIntStrFromValue ¶
func GetIntStrFromValue(str string) intstr.IntOrString
func GetLabelDomain ¶
func IsRestrictedLabel ¶
IsRestrictedLabel returns an error if the label is restricted.
func IsRestrictedNodeLabel ¶
IsRestrictedNodeLabel returns true if a node label should not be injected by Karpenter. They are either known labels that will be injected by cloud providers, or label domain managed by other software (e.g., kops.k8s.io managed by kOps).
func NodeClassLabelKey ¶ added in v1.1.0
func ValidateRequirement ¶
func ValidateRequirement(requirement NodeSelectorRequirementWithMinValues) error
Types ¶
type Budget ¶
type Budget struct { // 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. // +optional Reasons []DisruptionReason `json:"reasons,omitempty"` // 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 // +kubebuilder:validation:Pattern:="^((100|[0-9]{1,2})%|[0-9]+)$" // +kubebuilder:default:="10%" Nodes string `json:"nodes" hash:"ignore"` // 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. // +kubebuilder:validation:Pattern:=`^(@(annually|yearly|monthly|weekly|daily|midnight|hourly))|((.+)\s(.+)\s(.+)\s(.+)\s(.+))$` // +optional Schedule *string `json:"schedule,omitempty" hash:"ignore"` // 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. // +kubebuilder:validation:Pattern=`^((([0-9]+(h|m))|([0-9]+h[0-9]+m))(0s)?)$` // +kubebuilder:validation:Type="string" // +optional Duration *metav1.Duration `json:"duration,omitempty" hash:"ignore"` }
Budget defines when Karpenter will restrict the number of Node Claims that can be terminating simultaneously.
func (*Budget) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Budget.
func (*Budget) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Budget) GetAllowedDisruptions ¶
GetAllowedDisruptions returns an intstr.IntOrString that can be used a comparison for calculating if a disruption action is allowed. It returns an error if the schedule is invalid. This returns MAXINT if the value is unbounded.
func (*Budget) IsActive ¶
IsActive takes a clock as input and returns if a budget is active. It walks back in time the time.Duration associated with the schedule, and checks if the next time the schedule will hit is before the current time. If the last schedule hit is exactly the duration in the past, this means the schedule is active, as any more schedule hits in between would only extend this window. This ensures that any previous schedule hits for a schedule are considered.
type ConsolidationPolicy ¶
type ConsolidationPolicy string
const ( ConsolidationPolicyWhenEmpty ConsolidationPolicy = "WhenEmpty" ConsolidationPolicyWhenEmptyOrUnderutilized ConsolidationPolicy = "WhenEmptyOrUnderutilized" )
type Disruption ¶
type Disruption struct { // ConsolidateAfter is the duration the controller will wait // before attempting to terminate nodes that are underutilized. // Refer to ConsolidationPolicy for how underutilization is considered. // +kubebuilder:validation:Pattern=`^(([0-9]+(s|m|h))+)|(Never)$` // +kubebuilder:validation:Type="string" // +kubebuilder:validation:Schemaless // +required ConsolidateAfter NillableDuration `json:"consolidateAfter"` // ConsolidationPolicy describes which nodes Karpenter can disrupt through its consolidation // algorithm. This policy defaults to "WhenEmptyOrUnderutilized" if not specified // +kubebuilder:default:="WhenEmptyOrUnderutilized" // +kubebuilder:validation:Enum:={WhenEmpty,WhenEmptyOrUnderutilized} // +optional ConsolidationPolicy ConsolidationPolicy `json:"consolidationPolicy,omitempty"` // 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%. // +kubebuilder:validation:XValidation:message="'schedule' must be set with 'duration'",rule="self.all(x, has(x.schedule) == has(x.duration))" // +kubebuilder:default:={{nodes: "10%"}} // +kubebuilder:validation:MaxItems=50 // +optional Budgets []Budget `json:"budgets,omitempty" hash:"ignore"` }
func (*Disruption) DeepCopy ¶
func (in *Disruption) DeepCopy() *Disruption
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Disruption.
func (*Disruption) DeepCopyInto ¶
func (in *Disruption) DeepCopyInto(out *Disruption)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DisruptionReason ¶
type DisruptionReason string
DisruptionReason defines valid reasons for disruption budgets. +kubebuilder:validation:Enum={Underutilized,Empty,Drifted}
const ( DisruptionReasonUnderutilized DisruptionReason = "Underutilized" DisruptionReasonEmpty DisruptionReason = "Empty" DisruptionReasonDrifted DisruptionReason = "Drifted" )
type Limits ¶
type Limits v1.ResourceList
func (Limits) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Limits.
func (Limits) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (Limits) ExceededBy ¶
func (l Limits) ExceededBy(resources v1.ResourceList) error
type NillableDuration ¶
type NillableDuration struct { *time.Duration // Raw is used to ensure we remarshal the NillableDuration in the same format it was specified. // This ensures tools like Flux and ArgoCD don't mistakenly detect drift due to our conversion webhooks. Raw []byte `hash:"ignore"` }
NillableDuration is a wrapper around time.Duration which supports correct marshaling to YAML and JSON. It uses the value "Never" to signify that the duration is disabled and sets the inner duration as nil
func MustParseNillableDuration ¶
func MustParseNillableDuration(val string) NillableDuration
func (*NillableDuration) DeepCopy ¶
func (in *NillableDuration) DeepCopy() *NillableDuration
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NillableDuration.
func (*NillableDuration) DeepCopyInto ¶
func (in *NillableDuration) DeepCopyInto(out *NillableDuration)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (NillableDuration) MarshalJSON ¶
func (d NillableDuration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (NillableDuration) ToUnstructured ¶
func (d NillableDuration) ToUnstructured() interface{}
ToUnstructured implements the value.UnstructuredConverter interface.
func (*NillableDuration) UnmarshalJSON ¶
func (d *NillableDuration) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaller interface.
type NodeClaim ¶
type NodeClaim struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="spec is immutable" // +required Spec NodeClaimSpec `json:"spec"` Status NodeClaimStatus `json:"status,omitempty"` }
NodeClaim is the Schema for the NodeClaims API +kubebuilder:object:root=true +kubebuilder:resource:path=nodeclaims,scope=Cluster,categories=karpenter +kubebuilder:subresource:status +kubebuilder:storageversion +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".metadata.labels.node\\.kubernetes\\.io/instance-type",description="" +kubebuilder:printcolumn:name="Capacity",type="string",JSONPath=".metadata.labels.karpenter\\.sh/capacity-type",description="" +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".metadata.labels.topology\\.kubernetes\\.io/zone",description="" +kubebuilder:printcolumn:name="Node",type="string",JSONPath=".status.nodeName",description="" +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="" +kubebuilder:printcolumn:name="ID",type="string",JSONPath=".status.providerID",priority=1,description="" +kubebuilder:printcolumn:name="NodePool",type="string",JSONPath=".metadata.labels.karpenter\\.sh/nodepool",priority=1,description="" +kubebuilder:printcolumn:name="NodeClass",type="string",JSONPath=".spec.nodeClassRef.name",priority=1,description=""
func (*NodeClaim) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaim.
func (*NodeClaim) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NodeClaim) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*NodeClaim) GetConditions ¶
func (*NodeClaim) SetConditions ¶
func (*NodeClaim) SetDefaults ¶
SetDefaults for the NodeClaim
func (*NodeClaim) StatusConditions ¶
func (in *NodeClaim) StatusConditions() status.ConditionSet
type NodeClaimList ¶
type NodeClaimList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []NodeClaim `json:"items"` }
NodeClaimList contains a list of NodeClaims +kubebuilder:object:root=true
func (*NodeClaimList) DeepCopy ¶
func (in *NodeClaimList) DeepCopy() *NodeClaimList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaimList.
func (*NodeClaimList) DeepCopyInto ¶
func (in *NodeClaimList) DeepCopyInto(out *NodeClaimList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NodeClaimList) DeepCopyObject ¶
func (in *NodeClaimList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type NodeClaimSpec ¶
type NodeClaimSpec struct { // Taints will be applied to the NodeClaim's node. // +optional Taints []v1.Taint `json:"taints,omitempty"` // 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. // +optional StartupTaints []v1.Taint `json:"startupTaints,omitempty"` // Requirements are layered with GetLabels and applied to every node. // +kubebuilder:validation:XValidation:message="requirements with operator 'In' must have a value defined",rule="self.all(x, x.operator == 'In' ? x.values.size() != 0 : true)" // +kubebuilder:validation:XValidation:message="requirements operator 'Gt' or 'Lt' must have a single positive integer value",rule="self.all(x, (x.operator == 'Gt' || x.operator == 'Lt') ? (x.values.size() == 1 && int(x.values[0]) >= 0) : true)" // +kubebuilder:validation:XValidation:message="requirements with 'minValues' must have at least that many values specified in the 'values' field",rule="self.all(x, (x.operator == 'In' && has(x.minValues)) ? x.values.size() >= x.minValues : true)" // +kubebuilder:validation:MaxItems:=100 // +required Requirements []NodeSelectorRequirementWithMinValues `json:"requirements" hash:"ignore"` // Resources models the resource requirements for the NodeClaim to launch // +optional Resources ResourceRequirements `json:"resources,omitempty" hash:"ignore"` // NodeClassRef is a reference to an object that defines provider specific configuration // +required NodeClassRef *NodeClassReference `json:"nodeClassRef"` // 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. // +kubebuilder:validation:Pattern=`^([0-9]+(s|m|h))+$` // +kubebuilder:validation:Type="string" // +optional TerminationGracePeriod *metav1.Duration `json:"terminationGracePeriod,omitempty"` // 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. // +kubebuilder:default:="720h" // +kubebuilder:validation:Pattern=`^(([0-9]+(s|m|h))+)|(Never)$` // +kubebuilder:validation:Type="string" // +kubebuilder:validation:Schemaless // +optional ExpireAfter NillableDuration `json:"expireAfter,omitempty"` }
NodeClaimSpec describes the desired state of the NodeClaim
func (*NodeClaimSpec) DeepCopy ¶
func (in *NodeClaimSpec) DeepCopy() *NodeClaimSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaimSpec.
func (*NodeClaimSpec) DeepCopyInto ¶
func (in *NodeClaimSpec) DeepCopyInto(out *NodeClaimSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NodeClaimStatus ¶
type NodeClaimStatus struct { // NodeName is the name of the corresponding node object // +optional NodeName string `json:"nodeName,omitempty"` // ProviderID of the corresponding node object // +optional ProviderID string `json:"providerID,omitempty"` // ImageID is an identifier for the image that runs on the node // +optional ImageID string `json:"imageID,omitempty"` // Capacity is the estimated full capacity of the node // +optional Capacity v1.ResourceList `json:"capacity,omitempty"` // Allocatable is the estimated allocatable capacity of the node // +optional Allocatable v1.ResourceList `json:"allocatable,omitempty"` // Conditions contains signals for health and readiness // +optional Conditions []status.Condition `json:"conditions,omitempty"` // 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. // +optional LastPodEventTime metav1.Time `json:"lastPodEventTime,omitempty"` }
NodeClaimStatus defines the observed state of NodeClaim
func (*NodeClaimStatus) DeepCopy ¶
func (in *NodeClaimStatus) DeepCopy() *NodeClaimStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaimStatus.
func (*NodeClaimStatus) DeepCopyInto ¶
func (in *NodeClaimStatus) DeepCopyInto(out *NodeClaimStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NodeClaimTemplate ¶
type NodeClaimTemplate struct { ObjectMeta `json:"metadata,omitempty"` // +required Spec NodeClaimTemplateSpec `json:"spec"` }
func (*NodeClaimTemplate) DeepCopy ¶
func (in *NodeClaimTemplate) DeepCopy() *NodeClaimTemplate
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaimTemplate.
func (*NodeClaimTemplate) DeepCopyInto ¶
func (in *NodeClaimTemplate) DeepCopyInto(out *NodeClaimTemplate)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NodeClaimTemplate) ToNodeClaim ¶
func (in *NodeClaimTemplate) ToNodeClaim() *NodeClaim
This is used to convert between the NodeClaim's NodeClaimSpec to the Nodepool NodeClaimTemplate's NodeClaimSpec.
type NodeClaimTemplateSpec ¶
type NodeClaimTemplateSpec struct { // Taints will be applied to the NodeClaim's node. // +optional Taints []v1.Taint `json:"taints,omitempty"` // 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. // +optional StartupTaints []v1.Taint `json:"startupTaints,omitempty"` // Requirements are layered with GetLabels and applied to every node. // +kubebuilder:validation:XValidation:message="requirements with operator 'In' must have a value defined",rule="self.all(x, x.operator == 'In' ? x.values.size() != 0 : true)" // +kubebuilder:validation:XValidation:message="requirements operator 'Gt' or 'Lt' must have a single positive integer value",rule="self.all(x, (x.operator == 'Gt' || x.operator == 'Lt') ? (x.values.size() == 1 && int(x.values[0]) >= 0) : true)" // +kubebuilder:validation:XValidation:message="requirements with 'minValues' must have at least that many values specified in the 'values' field",rule="self.all(x, (x.operator == 'In' && has(x.minValues)) ? x.values.size() >= x.minValues : true)" // +kubebuilder:validation:MaxItems:=100 // +required Requirements []NodeSelectorRequirementWithMinValues `json:"requirements" hash:"ignore"` // NodeClassRef is a reference to an object that defines provider specific configuration // +kubebuilder:validation:XValidation:rule="self.group == oldSelf.group",message="nodeClassRef.group is immutable" // +kubebuilder:validation:XValidation:rule="self.kind == oldSelf.kind",message="nodeClassRef.kind is immutable" // +required NodeClassRef *NodeClassReference `json:"nodeClassRef"` // 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. // +kubebuilder:validation:Pattern=`^([0-9]+(s|m|h))+$` // +kubebuilder:validation:Type="string" // +optional TerminationGracePeriod *metav1.Duration `json:"terminationGracePeriod,omitempty"` // 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. // +kubebuilder:default:="720h" // +kubebuilder:validation:Pattern=`^(([0-9]+(s|m|h))+)|(Never)$` // +kubebuilder:validation:Type="string" // +kubebuilder:validation:Schemaless // +optional ExpireAfter NillableDuration `json:"expireAfter,omitempty"` }
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.
func (*NodeClaimTemplateSpec) DeepCopy ¶
func (in *NodeClaimTemplateSpec) DeepCopy() *NodeClaimTemplateSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaimTemplateSpec.
func (*NodeClaimTemplateSpec) DeepCopyInto ¶
func (in *NodeClaimTemplateSpec) DeepCopyInto(out *NodeClaimTemplateSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NodeClassReference ¶
type NodeClassReference struct { // Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" // +kubebuilder:validation:XValidation:rule="self != ”",message="kind may not be empty" // +required Kind string `json:"kind"` // Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names // +kubebuilder:validation:XValidation:rule="self != ”",message="name may not be empty" // +required Name string `json:"name"` // API version of the referent // +kubebuilder:validation:XValidation:rule="self != ”",message="group may not be empty" // +kubebuilder:validation:Pattern=`^[^/]*$` // +required Group string `json:"group"` }
func (*NodeClassReference) DeepCopy ¶
func (in *NodeClassReference) DeepCopy() *NodeClassReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClassReference.
func (*NodeClassReference) DeepCopyInto ¶
func (in *NodeClassReference) DeepCopyInto(out *NodeClassReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NodeClassReference) GroupKind ¶ added in v1.1.0
func (ncr *NodeClassReference) GroupKind() schema.GroupKind
type NodePool ¶
type NodePool struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // +required Spec NodePoolSpec `json:"spec"` Status NodePoolStatus `json:"status,omitempty"` }
NodePool is the Schema for the NodePools API +kubebuilder:object:root=true +kubebuilder:storageversion +kubebuilder:resource:path=nodepools,scope=Cluster,categories=karpenter +kubebuilder:printcolumn:name="NodeClass",type="string",JSONPath=".spec.template.spec.nodeClassRef.name",description="" +kubebuilder:printcolumn:name="Nodes",type="string",JSONPath=".status.resources.nodes",description="" +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="" +kubebuilder:printcolumn:name="Weight",type="integer",JSONPath=".spec.weight",priority=1,description="" +kubebuilder:printcolumn:name="CPU",type="string",JSONPath=".status.resources.cpu",priority=1,description="" +kubebuilder:printcolumn:name="Memory",type="string",JSONPath=".status.resources.memory",priority=1,description="" +kubebuilder:subresource:status
func (*NodePool) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePool.
func (*NodePool) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NodePool) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*NodePool) GetAllowedDisruptionsByReason ¶
func (in *NodePool) GetAllowedDisruptionsByReason(c clock.Clock, numNodes int, reason DisruptionReason) (int, error)
GetAllowedDisruptionsByReason returns the minimum allowed disruptions across all disruption budgets, for all disruption methods for a given nodepool
func (*NodePool) GetConditions ¶
func (*NodePool) MustGetAllowedDisruptions ¶
func (in *NodePool) MustGetAllowedDisruptions(c clock.Clock, numNodes int, reason DisruptionReason) int
MustGetAllowedDisruptions calls GetAllowedDisruptionsByReason if the error is not nil. This reduces the amount of state that the disruption controller must reconcile, while allowing the GetAllowedDisruptionsByReason() to bubble up any errors in validation.
func (*NodePool) RuntimeValidate ¶
RuntimeValidate will be used to validate any part of the CRD that can not be validated at CRD creation
func (*NodePool) SetConditions ¶
func (*NodePool) SetDefaults ¶
SetDefaults for the NodePool
func (*NodePool) StatusConditions ¶
func (in *NodePool) StatusConditions() status.ConditionSet
type NodePoolList ¶
type NodePoolList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []NodePool `json:"items"` }
NodePoolList contains a list of NodePool +kubebuilder:object:root=true
func (*NodePoolList) DeepCopy ¶
func (in *NodePoolList) DeepCopy() *NodePoolList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolList.
func (*NodePoolList) DeepCopyInto ¶
func (in *NodePoolList) DeepCopyInto(out *NodePoolList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NodePoolList) DeepCopyObject ¶
func (in *NodePoolList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type NodePoolSpec ¶
type NodePoolSpec struct { // 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. // +required Template NodeClaimTemplate `json:"template"` // Disruption contains the parameters that relate to Karpenter's disruption logic // +kubebuilder:default:={consolidateAfter: "0s"} // +optional Disruption Disruption `json:"disruption"` // Limits define a set of bounds for provisioning capacity. // +optional Limits Limits `json:"limits,omitempty"` // 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. // +kubebuilder:validation:Minimum:=1 // +kubebuilder:validation:Maximum:=100 // +optional Weight *int32 `json:"weight,omitempty"` }
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.
func (*NodePoolSpec) DeepCopy ¶
func (in *NodePoolSpec) DeepCopy() *NodePoolSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolSpec.
func (*NodePoolSpec) DeepCopyInto ¶
func (in *NodePoolSpec) DeepCopyInto(out *NodePoolSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NodePoolStatus ¶
type NodePoolStatus struct { // Resources is the list of resources that have been provisioned. // +optional Resources v1.ResourceList `json:"resources,omitempty"` // Conditions contains signals for health and readiness // +optional Conditions []status.Condition `json:"conditions,omitempty"` }
NodePoolStatus defines the observed state of NodePool
func (*NodePoolStatus) DeepCopy ¶
func (in *NodePoolStatus) DeepCopy() *NodePoolStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolStatus.
func (*NodePoolStatus) DeepCopyInto ¶
func (in *NodePoolStatus) DeepCopyInto(out *NodePoolStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NodeSelectorRequirementWithMinValues ¶
type NodeSelectorRequirementWithMinValues struct { v1.NodeSelectorRequirement `json:",inline"` // 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. // +kubebuilder:validation:Minimum:=1 // +kubebuilder:validation:Maximum:=50 // +optional MinValues *int `json:"minValues,omitempty"` }
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.
func (*NodeSelectorRequirementWithMinValues) DeepCopy ¶
func (in *NodeSelectorRequirementWithMinValues) DeepCopy() *NodeSelectorRequirementWithMinValues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSelectorRequirementWithMinValues.
func (*NodeSelectorRequirementWithMinValues) DeepCopyInto ¶
func (in *NodeSelectorRequirementWithMinValues) DeepCopyInto(out *NodeSelectorRequirementWithMinValues)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ObjectMeta ¶
type ObjectMeta struct { // 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 // +optional Labels map[string]string `json:"labels,omitempty"` // 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 // +optional Annotations map[string]string `json:"annotations,omitempty"` }
func (*ObjectMeta) DeepCopy ¶
func (in *ObjectMeta) DeepCopy() *ObjectMeta
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMeta.
func (*ObjectMeta) DeepCopyInto ¶
func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceRequirements ¶
type ResourceRequirements struct { // Requests describes the minimum required resources for the NodeClaim to launch // +optional Requests v1.ResourceList `json:"requests,omitempty"` }
ResourceRequirements models the required resources for the NodeClaim to launch Ths will eventually be transformed into v1.ResourceRequirements when we support resources.limits
func (*ResourceRequirements) DeepCopy ¶
func (in *ResourceRequirements) DeepCopy() *ResourceRequirements
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRequirements.
func (*ResourceRequirements) DeepCopyInto ¶
func (in *ResourceRequirements) DeepCopyInto(out *ResourceRequirements)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.