v1

package
v0.33.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 27 Imported by: 28

Documentation

Overview

+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=karpenter.sh

Index

Constants

View Source
const (
	ArchitectureAmd64    = "amd64"
	ArchitectureArm64    = "arm64"
	CapacityTypeSpot     = "spot"
	CapacityTypeOnDemand = "on-demand"
)

Well known labels and resources

View Source
const (
	NodePoolLabelKey        = Group + "/nodepool"
	NodeInitializedLabelKey = Group + "/initialized"
	NodeRegisteredLabelKey  = Group + "/registered"
	CapacityTypeLabelKey    = Group + "/capacity-type"
)

Karpenter specific domains and labels

View Source
const (
	DoNotDisruptAnnotationKey                  = Group + "/do-not-disrupt"
	ProviderCompatibilityAnnotationKey         = CompatibilityGroup + "/provider"
	NodePoolHashAnnotationKey                  = Group + "/nodepool-hash"
	NodePoolHashVersionAnnotationKey           = Group + "/nodepool-hash-version"
	KubeletCompatibilityAnnotationKey          = CompatibilityGroup + "/v1beta1-kubelet-conversion"
	NodeClassReferenceAnnotationKey            = CompatibilityGroup + "/v1beta1-nodeclass-reference"
	NodeClaimTerminationTimestampAnnotationKey = Group + "/nodeclaim-termination-timestamp"
)

Karpenter specific annotations

View Source
const (
	ConditionTypeLaunched             = "Launched"
	ConditionTypeRegistered           = "Registered"
	ConditionTypeInitialized          = "Initialized"
	ConditionTypeConsolidatable       = "Consolidatable"
	ConditionTypeDrifted              = "Drifted"
	ConditionTypeTerminating          = "Terminating"
	ConditionTypeConsistentStateFound = "ConsistentStateFound"
)
View Source
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"
)
View Source
const (
	Group              = "karpenter.sh"
	CompatibilityGroup = "compatibility." + Group
)
View Source
const (
	DisruptedTaintKey    = Group + "/disrupted"
	UnregisteredTaintKey = Group + "/unregistered"
)

Karpenter specific taints

View Source
const Never = "Never"
View Source
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

View Source
const (
	TerminationFinalizer = Group + "/termination"
)

Karpenter specific finalizers

Variables

View Source
var (
	// RestrictedLabelDomains are either prohibited by the kubelet or reserved by karpenter
	RestrictedLabelDomains = sets.New(
		"kubernetes.io",
		"k8s.io",
		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,
	}
)
View Source
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",
	)
)
View Source
var (
	SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: "v1"}
	SchemeBuilder      = runtime.NewSchemeBuilder(func(scheme *runtime.Scheme) error {
		scheme.AddKnownTypes(SchemeGroupVersion,
			&NodePool{},
			&NodePoolList{},
			&NodeClaim{},
			&NodeClaimList{},
		)
		metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
		return nil
	})
)
View Source
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,
	}
)
View Source
var (
	// DisruptionReasons is a list of all valid reasons for disruption budgets.
	WellKnownDisruptionReasons = []DisruptionReason{DisruptionReasonUnderutilized, DisruptionReasonEmpty, DisruptionReasonDrifted}
)

Functions

func GetIntStrFromValue

func GetIntStrFromValue(str string) intstr.IntOrString

func GetLabelDomain

func GetLabelDomain(key string) string

func IsDisruptingTaint

func IsDisruptingTaint(taint v1.Taint) bool

IsDisruptingTaint checks if the taint is either the v1 or v1beta1 disruption taint.

func IsRestrictedLabel

func IsRestrictedLabel(key string) error

IsRestrictedLabel returns an error if the label is restricted.

func IsRestrictedNodeLabel

func IsRestrictedNodeLabel(key string) bool

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

func (in *Budget) DeepCopy() *Budget

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Budget.

func (*Budget) DeepCopyInto

func (in *Budget) DeepCopyInto(out *Budget)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Budget) GetAllowedDisruptions

func (in *Budget) GetAllowedDisruptions(c clock.Clock, numNodes int) (int, error)

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

func (in *Budget) IsActive(c clock.Clock) (bool, error)

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

func (in Limits) DeepCopy() Limits

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Limits.

func (Limits) DeepCopyInto

func (in Limits) DeepCopyInto(out *Limits)

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: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) ConvertFrom

func (in *NodeClaim) ConvertFrom(ctx context.Context, from apis.Convertible) error

convert v1beta1 to v1

func (*NodeClaim) ConvertTo

func (in *NodeClaim) ConvertTo(ctx context.Context, to apis.Convertible) error

convert v1 to v1beta1

func (*NodeClaim) DeepCopy

func (in *NodeClaim) DeepCopy() *NodeClaim

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeClaim.

func (*NodeClaim) DeepCopyInto

func (in *NodeClaim) DeepCopyInto(out *NodeClaim)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodeClaim) DeepCopyObject

func (in *NodeClaim) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*NodeClaim) GetConditions

func (in *NodeClaim) GetConditions() []status.Condition

func (*NodeClaim) SetConditions

func (in *NodeClaim) SetConditions(conditions []status.Condition)

func (*NodeClaim) SetDefaults

func (in *NodeClaim) SetDefaults(_ context.Context)

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
	// +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

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"
	// +required
	Kind string `json:"kind"`
	// Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
	// +required
	Name string `json:"name"`
	// API version of the referent
	// +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.

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: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) ConvertFrom

func (in *NodePool) ConvertFrom(ctx context.Context, v1beta1np apis.Convertible) error

Convert v1beta1 NodePool to V1 NodePool

func (*NodePool) ConvertTo

func (in *NodePool) ConvertTo(ctx context.Context, to apis.Convertible) error

Convert v1 NodePool to v1beta1 NodePool

func (*NodePool) DeepCopy

func (in *NodePool) DeepCopy() *NodePool

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePool.

func (*NodePool) DeepCopyInto

func (in *NodePool) DeepCopyInto(out *NodePool)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodePool) DeepCopyObject

func (in *NodePool) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*NodePool) GetAllowedDisruptionsByReason

func (in *NodePool) GetAllowedDisruptionsByReason(ctx context.Context, c clock.Clock, numNodes int) (map[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 (in *NodePool) GetConditions() []status.Condition

func (*NodePool) Hash

func (in *NodePool) Hash() string

func (*NodePool) MustGetAllowedDisruptions

func (in *NodePool) MustGetAllowedDisruptions(ctx context.Context, c clock.Clock, numNodes int) map[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

func (in *NodePool) RuntimeValidate() (errs *apis.FieldError)

RuntimeValidate will be used to validate any part of the CRD that can not be validated at CRD creation

func (*NodePool) SetConditions

func (in *NodePool) SetConditions(conditions []status.Condition)

func (*NodePool) SetDefaults

func (in *NodePool) SetDefaults(_ context.Context)

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.

func (*NodePoolList) OrderByWeight

func (nl *NodePoolList) OrderByWeight()

OrderByWeight orders the NodePools in the NodePoolList by their priority weight in-place. This priority evaluates the following things in precedence order:

  1. NodePools that have a larger weight are ordered first
  2. If two NodePools have the same weight, then the NodePool with the name later in the alphabet will come first

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
	// +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

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSelectorRequirementWithMinValues.

func (*NodeSelectorRequirementWithMinValues) DeepCopyInto

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 Provider

type Provider = runtime.RawExtension

+kubebuilder:object:generate=false

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL