v1beta1

package
v0.34.11 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 17

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"
	ProviderCompatabilityAnnotationKey = CompatabilityGroup + "/provider"
	ManagedByAnnotationKey             = Group + "/managed-by"
	NodePoolHashAnnotationKey          = Group + "/nodepool-hash"
	NodePoolHashVersionAnnotationKey   = Group + "/nodepool-hash-version"
)

Karpenter specific annotations

View Source
const (
	Group              = "karpenter.sh"
	CompatabilityGroup = "compatibility." + Group
)
View Source
const (
	DisruptionTaintKey             = Group + "/disruption"
	DisruptingNoScheduleTaintValue = "disrupting"
)

Karpenter specific taints

View Source
const Never = "Never"
View Source
const NodePoolHashVersion = "v1"

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 (
	Launched    apis.ConditionType = "Launched"
	Registered  apis.ConditionType = "Registered"
	Initialized apis.ConditionType = "Initialized"
	Empty       apis.ConditionType = "Empty"
	Drifted     apis.ConditionType = "Drifted"
	Expired     apis.ConditionType = "Expired"
)
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: "v1beta1"}
	SchemeBuilder      = runtime.NewSchemeBuilder(func(scheme *runtime.Scheme) error {
		scheme.AddKnownTypes(SchemeGroupVersion,
			&NodePool{},
			&NodePoolList{},
			&NodeClaim{},
			&NodeClaimList{},
		)
		metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
		return nil
	})
)
View Source
var (
	// DisruptionNoScheduleTaint is used by the deprovisioning controller to ensure no pods
	// are scheduled to a node that Karpenter is actively disrupting.
	DisruptionNoScheduleTaint = v1.Taint{
		Key:    DisruptionTaintKey,
		Effect: v1.TaintEffectNoSchedule,
		Value:  DisruptingNoScheduleTaintValue,
	}
)
View Source
var LivingConditions = []apis.ConditionType{
	Launched,
	Registered,
	Initialized,
}

Functions

func GetIntStrFromValue added in v0.34.0

func GetIntStrFromValue(str string) intstr.IntOrString

func GetLabelDomain

func GetLabelDomain(key string) string

func IsDisruptingTaint

func IsDisruptingTaint(taint v1.Taint) bool

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 v1.NodeSelectorRequirement) error

Types

type Budget added in v0.34.0

type Budget struct {
	// 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 added in v0.34.0

func (in *Budget) DeepCopy() *Budget

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

func (*Budget) DeepCopyInto added in v0.34.0

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 added in v0.34.0

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 added in v0.34.0

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"
	ConsolidationPolicyWhenUnderutilized ConsolidationPolicy = "WhenUnderutilized"
)

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
	// +optional
	ConsolidateAfter *NillableDuration `json:"consolidateAfter,omitempty"`
	// ConsolidationPolicy describes which nodes Karpenter can disrupt through its consolidation
	// algorithm. This policy defaults to "WhenUnderutilized" if not specified
	// +kubebuilder:default:="WhenUnderutilized"
	// +kubebuilder:validation:Enum:={WhenEmpty,WhenUnderutilized}
	// +optional
	ConsolidationPolicy ConsolidationPolicy `json:"consolidationPolicy,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"`
	// 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 KubeletConfiguration

type KubeletConfiguration struct {
	// clusterDNS is a list of IP addresses for the cluster DNS server.
	// Note that not all providers may use all addresses.
	//+optional
	ClusterDNS []string `json:"clusterDNS,omitempty"`
	// MaxPods is an override for the maximum number of pods that can run on
	// a worker node instance.
	// +kubebuilder:validation:Minimum:=0
	// +optional
	MaxPods *int32 `json:"maxPods,omitempty"`
	// 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.
	// +kubebuilder:validation:Minimum:=0
	// +optional
	PodsPerCore *int32 `json:"podsPerCore,omitempty"`
	// SystemReserved contains resources reserved for OS system daemons and kernel memory.
	// +kubebuilder:validation:XValidation:message="valid keys for systemReserved are ['cpu','memory','ephemeral-storage','pid']",rule="self.all(x, x=='cpu' || x=='memory' || x=='ephemeral-storage' || x=='pid')"
	// +kubebuilder:validation:XValidation:message="systemReserved value cannot be a negative resource quantity",rule="self.all(x, !self[x].startsWith('-'))"
	// +optional
	SystemReserved v1.ResourceList `json:"systemReserved,omitempty"`
	// KubeReserved contains resources reserved for Kubernetes system components.
	// +kubebuilder:validation:XValidation:message="valid keys for kubeReserved are ['cpu','memory','ephemeral-storage','pid']",rule="self.all(x, x=='cpu' || x=='memory' || x=='ephemeral-storage' || x=='pid')"
	// +kubebuilder:validation:XValidation:message="kubeReserved value cannot be a negative resource quantity",rule="self.all(x, !self[x].startsWith('-'))"
	// +optional
	KubeReserved v1.ResourceList `json:"kubeReserved,omitempty"`
	// EvictionHard is the map of signal names to quantities that define hard eviction thresholds
	// +kubebuilder:validation:XValidation:message="valid keys for evictionHard are ['memory.available','nodefs.available','nodefs.inodesFree','imagefs.available','imagefs.inodesFree','pid.available']",rule="self.all(x, x in ['memory.available','nodefs.available','nodefs.inodesFree','imagefs.available','imagefs.inodesFree','pid.available'])"
	// +optional
	EvictionHard map[string]string `json:"evictionHard,omitempty"`
	// EvictionSoft is the map of signal names to quantities that define soft eviction thresholds
	// +kubebuilder:validation:XValidation:message="valid keys for evictionSoft are ['memory.available','nodefs.available','nodefs.inodesFree','imagefs.available','imagefs.inodesFree','pid.available']",rule="self.all(x, x in ['memory.available','nodefs.available','nodefs.inodesFree','imagefs.available','imagefs.inodesFree','pid.available'])"
	// +optional
	EvictionSoft map[string]string `json:"evictionSoft,omitempty"`
	// EvictionSoftGracePeriod is the map of signal names to quantities that define grace periods for each eviction signal
	// +kubebuilder:validation:XValidation:message="valid keys for evictionSoftGracePeriod are ['memory.available','nodefs.available','nodefs.inodesFree','imagefs.available','imagefs.inodesFree','pid.available']",rule="self.all(x, x in ['memory.available','nodefs.available','nodefs.inodesFree','imagefs.available','imagefs.inodesFree','pid.available'])"
	// +optional
	EvictionSoftGracePeriod map[string]metav1.Duration `json:"evictionSoftGracePeriod,omitempty"`
	// EvictionMaxPodGracePeriod is the maximum allowed grace period (in seconds) to use when terminating pods in
	// response to soft eviction thresholds being met.
	// +optional
	EvictionMaxPodGracePeriod *int32 `json:"evictionMaxPodGracePeriod,omitempty"`
	// 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.
	// +kubebuilder:validation:Minimum:=0
	// +kubebuilder:validation:Maximum:=100
	// +optional
	ImageGCHighThresholdPercent *int32 `json:"imageGCHighThresholdPercent,omitempty"`
	// 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
	// +kubebuilder:validation:Minimum:=0
	// +kubebuilder:validation:Maximum:=100
	// +optional
	ImageGCLowThresholdPercent *int32 `json:"imageGCLowThresholdPercent,omitempty"`
	// CPUCFSQuota enables CPU CFS quota enforcement for containers that specify CPU limits.
	// +optional
	CPUCFSQuota *bool `json:"cpuCFSQuota,omitempty"`
}

KubeletConfiguration 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. https://pkg.go.dev/k8s.io/kubelet/config/v1beta1#KubeletConfiguration https://github.com/kubernetes/kubernetes/blob/9f82d81e55cafdedab619ea25cabf5d42736dacf/cmd/kubelet/app/options/options.go#L53

func (*KubeletConfiguration) DeepCopy

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

func (*KubeletConfiguration) DeepCopyInto

func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration)

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

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 added in v0.33.6

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

	Spec   NodeClaimSpec   `json:"spec,omitempty"`
	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="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="Capacity",type="string",JSONPath=".metadata.labels.karpenter\\.sh/capacity-type",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 added in v0.33.6

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

func (*NodeClaim) ConvertTo added in v0.33.6

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

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() apis.Conditions

func (*NodeClaim) SetConditions

func (in *NodeClaim) SetConditions(conditions apis.Conditions)

func (*NodeClaim) SetDefaults

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

SetDefaults for the NodeClaim

func (*NodeClaim) StatusConditions

func (in *NodeClaim) StatusConditions() apis.ConditionManager

func (*NodeClaim) SupportedVerbs

func (in *NodeClaim) SupportedVerbs() []admissionregistrationv1.OperationType

func (*NodeClaim) Validate

func (in *NodeClaim) Validate(_ context.Context) (errs *apis.FieldError)

Validate the NodeClaim

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:MaxItems:=100
	// +required
	Requirements []v1.NodeSelectorRequirement `json:"requirements" hash:"ignore"`
	// Resources models the resource requirements for the NodeClaim to launch
	// +optional
	Resources ResourceRequirements `json:"resources,omitempty" hash:"ignore"`
	// 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.
	// +kubebuilder:validation:XValidation:message="imageGCHighThresholdPercent must be greater than imageGCLowThresholdPercent",rule="has(self.imageGCHighThresholdPercent) && has(self.imageGCLowThresholdPercent) ?  self.imageGCHighThresholdPercent > self.imageGCLowThresholdPercent  : true"
	// +kubebuilder:validation:XValidation:message="evictionSoft OwnerKey does not have a matching evictionSoftGracePeriod",rule="has(self.evictionSoft) ? self.evictionSoft.all(e, (e in self.evictionSoftGracePeriod)):true"
	// +kubebuilder:validation:XValidation:message="evictionSoftGracePeriod OwnerKey does not have a matching evictionSoft",rule="has(self.evictionSoftGracePeriod) ? self.evictionSoftGracePeriod.all(e, (e in self.evictionSoft)):true"
	Kubelet *KubeletConfiguration `json:"kubelet,omitempty"`
	// NodeClassRef is a reference to an object that defines provider specific configuration
	// +required
	NodeClassRef *NodeClassReference `json:"nodeClassRef"`
}

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 apis.Conditions `json:"conditions,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 NodeClaimSpec `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.

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

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

	Spec   NodePoolSpec   `json:"spec,omitempty"`
	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="Weight",type="string",JSONPath=".spec.weight",priority=1,description="" +kubebuilder:subresource:status

func (*NodePool) ConvertFrom added in v0.33.6

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

func (*NodePool) ConvertTo added in v0.33.6

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

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) GetAllowedDisruptions added in v0.34.0

func (in *NodePool) GetAllowedDisruptions(ctx context.Context, c clock.Clock, numNodes int) (int, error)

GetAllowedDisruptions returns the minimum allowed disruptions across all disruption budgets for a given node pool. This will return an error if there is a configuration error with any budget's node or schedule values.

func (*NodePool) Hash

func (in *NodePool) Hash() string

func (*NodePool) MustGetAllowedDisruptions added in v0.34.0

func (in *NodePool) MustGetAllowedDisruptions(ctx context.Context, c clock.Clock, numNodes int) int

MustGetAllowedDisruptions calls GetAllowedDisruptions and returns 0 if the error is not nil. This reduces the amount of state that the disruption controller must reconcile, while allowing the GetAllowedDisruptions() 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) SetDefaults

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

SetDefaults for the NodePool

func (*NodePool) SupportedVerbs

func (in *NodePool) SupportedVerbs() []admissionregistrationv1.OperationType

func (*NodePool) Validate

func (in *NodePool) Validate(_ context.Context) (errs *apis.FieldError)

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
	// +kubebuilder:default={"consolidationPolicy": "WhenUnderutilized", "expireAfter": "720h"}
	// +kubebuilder:validation:XValidation:message="consolidateAfter cannot be combined with consolidationPolicy=WhenUnderutilized",rule="has(self.consolidateAfter) ? self.consolidationPolicy != 'WhenUnderutilized' || self.consolidateAfter == 'Never' : true"
	// +kubebuilder:validation:XValidation:message="consolidateAfter must be specified with consolidationPolicy=WhenEmpty",rule="self.consolidationPolicy == 'WhenEmpty' ? has(self.consolidateAfter) : true"
	// +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"`
}

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