Documentation
¶
Overview ¶
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=karpenter.sh
Index ¶
- Constants
- Variables
- func IsRestrictedLabelDomain(key string) bool
- type Constraints
- func (in *Constraints) DeepCopy() *Constraints
- func (in *Constraints) DeepCopyInto(out *Constraints)
- func (c *Constraints) Default(ctx context.Context)
- func (c *Constraints) Tighten(pod *v1.Pod) *Constraints
- func (c *Constraints) Validate(ctx context.Context) (errs *apis.FieldError)
- func (c *Constraints) ValidatePod(pod *v1.Pod) error
- type Limits
- type Provisioner
- func (in *Provisioner) DeepCopy() *Provisioner
- func (in *Provisioner) DeepCopyInto(out *Provisioner)
- func (in *Provisioner) DeepCopyObject() runtime.Object
- func (p *Provisioner) GetConditions() apis.Conditions
- func (p *Provisioner) SetConditions(conditions apis.Conditions)
- func (p *Provisioner) SetDefaults(ctx context.Context)
- func (p *Provisioner) StatusConditions() apis.ConditionManager
- func (p *Provisioner) Validate(ctx context.Context) (errs *apis.FieldError)
- type ProvisionerList
- type ProvisionerSpec
- type ProvisionerStatus
- type Requirements
- func (r Requirements) Architectures() sets.String
- func (r Requirements) CapacityTypes() sets.String
- func (r Requirements) Consolidate() (requirements Requirements)
- func (in Requirements) DeepCopy() Requirements
- func (in Requirements) DeepCopyInto(out *Requirements)
- func (r Requirements) InstanceTypes() sets.String
- func (r Requirements) Keys() []string
- func (r Requirements) Requirement(key string) sets.String
- func (r Requirements) WellKnown() (requirements Requirements)
- func (r Requirements) With(requirements Requirements) Requirements
- func (r Requirements) Zones() sets.String
- type Taints
Constants ¶
const ( // Active is a condition implemented by all resources. It indicates that the // controller is able to take actions: it's correctly configured, can make // necessary API calls, and isn't disabled. Active apis.ConditionType = "Active" )
Variables ¶
var ( ArchitectureAmd64 = "amd64" ArchitectureArm64 = "arm64" OperatingSystemLinux = "linux" ProvisionerNameLabelKey = SchemeGroupVersion.Group + "/provisioner-name" NotReadyTaintKey = SchemeGroupVersion.Group + "/not-ready" DoNotEvictPodAnnotationKey = SchemeGroupVersion.Group + "/do-not-evict" EmptinessTimestampAnnotationKey = SchemeGroupVersion.Group + "/emptiness-timestamp" TerminationFinalizer = SchemeGroupVersion.Group + "/termination" DefaultProvisioner = types.NamespacedName{Name: "default"} )
var ( // RestrictedLabels are injected by Cloud Providers RestrictedLabels = sets.NewString( EmptinessTimestampAnnotationKey, v1.LabelHostname, ) // These are either prohibited by the kubelet or reserved by karpenter KarpenterLabelDomain = "karpenter.sh" RestrictedLabelDomains = sets.NewString( "kubernetes.io", "k8s.io", KarpenterLabelDomain, ) LabelCapacityType = KarpenterLabelDomain + "/capacity-type" // WellKnownLabels supported by karpenter WellKnownLabels = sets.NewString( v1.LabelTopologyZone, v1.LabelInstanceTypeStable, v1.LabelArchStable, LabelCapacityType, v1.LabelHostname, ) DefaultHook = func(ctx context.Context, constraints *Constraints) {} ValidateHook = func(ctx context.Context, constraints *Constraints) *apis.FieldError { return nil } )
var ( Group = "karpenter.sh" ExtensionsGroup = "extensions." + Group SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: "v1alpha5"} SchemeBuilder = runtime.NewSchemeBuilder(func(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Provisioner{}, &ProvisionerList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }) )
var (
SupportedNodeSelectorOps = []string{string(v1.NodeSelectorOpIn), string(v1.NodeSelectorOpNotIn)}
)
Functions ¶
func IsRestrictedLabelDomain ¶
Types ¶
type Constraints ¶
type Constraints struct { // Labels are layered with Requirements and applied to every node. //+optional Labels map[string]string `json:"labels,omitempty"` // Taints will be applied to every node launched by the Provisioner. If // specified, the provisioner will not provision nodes for pods that do not // have matching tolerations. Additional taints will be created that match // pod tolerations on a per-node basis. // +optional Taints Taints `json:"taints,omitempty"` // Requirements are layered with Labels and applied to every node. Requirements Requirements `json:"requirements,omitempty"` // Provider contains fields specific to your cloudprovider. // +kubebuilder:pruning:PreserveUnknownFields Provider *runtime.RawExtension `json:"provider,omitempty"` }
Constraints are applied to all nodes created by the provisioner.
func (*Constraints) DeepCopy ¶
func (in *Constraints) DeepCopy() *Constraints
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Constraints.
func (*Constraints) DeepCopyInto ¶
func (in *Constraints) DeepCopyInto(out *Constraints)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Constraints) Default ¶
func (c *Constraints) Default(ctx context.Context)
Default the constraints
func (*Constraints) Tighten ¶
func (c *Constraints) Tighten(pod *v1.Pod) *Constraints
func (*Constraints) Validate ¶
func (c *Constraints) Validate(ctx context.Context) (errs *apis.FieldError)
Validate the constraints
func (*Constraints) ValidatePod ¶
func (c *Constraints) ValidatePod(pod *v1.Pod) error
ValidatePod returns an error if the pod's requirements are not met by the constraints
type Limits ¶
type Limits struct { // Resources contains all the allocatable resources that Karpenter supports for limiting. Resources v1.ResourceList `json:"resources,omitempty"` }
Limits define bounds on the resources being provisioned by Karpenter
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 Provisioner ¶
type Provisioner struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ProvisionerSpec `json:"spec,omitempty"` Status ProvisionerStatus `json:"status,omitempty"` }
Provisioner is the Schema for the Provisioners API +kubebuilder:object:root=true +kubebuilder:resource:path=provisioners,scope=Cluster +kubebuilder:subresource:status
func (*Provisioner) DeepCopy ¶
func (in *Provisioner) DeepCopy() *Provisioner
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Provisioner.
func (*Provisioner) DeepCopyInto ¶
func (in *Provisioner) DeepCopyInto(out *Provisioner)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Provisioner) DeepCopyObject ¶
func (in *Provisioner) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Provisioner) GetConditions ¶
func (p *Provisioner) GetConditions() apis.Conditions
func (*Provisioner) SetConditions ¶
func (p *Provisioner) SetConditions(conditions apis.Conditions)
func (*Provisioner) SetDefaults ¶
func (p *Provisioner) SetDefaults(ctx context.Context)
SetDefaults for the provisioner
func (*Provisioner) StatusConditions ¶
func (p *Provisioner) StatusConditions() apis.ConditionManager
func (*Provisioner) Validate ¶
func (p *Provisioner) Validate(ctx context.Context) (errs *apis.FieldError)
type ProvisionerList ¶
type ProvisionerList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []Provisioner `json:"items"` }
ProvisionerList contains a list of Provisioner +kubebuilder:object:root=true
func (*ProvisionerList) DeepCopy ¶
func (in *ProvisionerList) DeepCopy() *ProvisionerList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProvisionerList.
func (*ProvisionerList) DeepCopyInto ¶
func (in *ProvisionerList) DeepCopyInto(out *ProvisionerList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ProvisionerList) DeepCopyObject ¶
func (in *ProvisionerList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ProvisionerSpec ¶
type ProvisionerSpec struct { // Constraints are applied to all nodes launched by this provisioner. Constraints `json:",inline"` // TTLSecondsAfterEmpty is the number of seconds the controller will wait // before attempting to delete a node, measured from when the node is // detected to be empty. A Node is considered to be empty when it does not // have pods scheduled to it, excluding daemonsets. // // Termination due to underutilization is disabled if this field is not set. // +optional TTLSecondsAfterEmpty *int64 `json:"ttlSecondsAfterEmpty,omitempty"` // TTLSecondsUntilExpired is the number of seconds 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. // // Termination due to expiration is disabled if this field is not set. // +optional TTLSecondsUntilExpired *int64 `json:"ttlSecondsUntilExpired,omitempty"` // Limits define a set of bounds for provisioning capacity. Limits Limits `json:"limits,omitempty"` }
ProvisionerSpec is the top level provisioner specification. Provisioners launch nodes in response to pods where status.conditions[type=unschedulable, status=true]. Node configuration is driven by through a combination of provisioner specification (defaults) and pod scheduling constraints (overrides). A single provisioner is capable of managing highly diverse capacity within a single cluster and in most cases, only one should be necessary. It's possible to define multiple provisioners. These provisioners may have different defaults and can be specifically targeted by pods using pod.spec.nodeSelector["karpenter.sh/provisioner-name"]=$PROVISIONER_NAME.
func (*ProvisionerSpec) DeepCopy ¶
func (in *ProvisionerSpec) DeepCopy() *ProvisionerSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProvisionerSpec.
func (*ProvisionerSpec) DeepCopyInto ¶
func (in *ProvisionerSpec) DeepCopyInto(out *ProvisionerSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ProvisionerStatus ¶
type ProvisionerStatus struct { // LastScaleTime is the last time the Provisioner scaled the number // of nodes // +optional // +kubebuilder:validation:Format="date-time" LastScaleTime *apis.VolatileTime `json:"lastScaleTime,omitempty"` // Conditions is the set of conditions required for this provisioner to scale // its target, and indicates whether or not those conditions are met. // +optional Conditions apis.Conditions `json:"conditions,omitempty"` // Resources is the list of resources that have been provisioned. Resources v1.ResourceList `json:"resources,omitempty"` }
ProvisionerStatus defines the observed state of Provisioner
func (*ProvisionerStatus) DeepCopy ¶
func (in *ProvisionerStatus) DeepCopy() *ProvisionerStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProvisionerStatus.
func (*ProvisionerStatus) DeepCopyInto ¶
func (in *ProvisionerStatus) DeepCopyInto(out *ProvisionerStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Requirements ¶
type Requirements []v1.NodeSelectorRequirement
Requirements is a decorated alias type for []v1.NodeSelectorRequirements
func LabelRequirements ¶
func LabelRequirements(labels map[string]string) (r Requirements)
func PodRequirements ¶
func PodRequirements(pod *v1.Pod) (r Requirements)
func (Requirements) Architectures ¶
func (r Requirements) Architectures() sets.String
func (Requirements) CapacityTypes ¶
func (r Requirements) CapacityTypes() sets.String
func (Requirements) Consolidate ¶
func (r Requirements) Consolidate() (requirements Requirements)
Consolidate combines In and NotIn requirements for each unique key, producing an equivalent minimal representation of the requirements. This is useful as requirements may be appended from a variety of sources and then consolidated. Caution: If a key has contains a `NotIn` operator without a corresponding `In` operator, the requirement will permanently be [] after consolidation. To avoid this, include the broadest `In` requirements before consolidating.
func (Requirements) DeepCopy ¶
func (in Requirements) DeepCopy() Requirements
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Requirements.
func (Requirements) DeepCopyInto ¶
func (in Requirements) DeepCopyInto(out *Requirements)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (Requirements) InstanceTypes ¶
func (r Requirements) InstanceTypes() sets.String
func (Requirements) Keys ¶
func (r Requirements) Keys() []string
Keys returns unique set of the label keys from the requirements
func (Requirements) Requirement ¶
func (r Requirements) Requirement(key string) sets.String
Requirements for the provided key, nil if unconstrained
func (Requirements) WellKnown ¶
func (r Requirements) WellKnown() (requirements Requirements)
func (Requirements) With ¶
func (r Requirements) With(requirements Requirements) Requirements
func (Requirements) Zones ¶
func (r Requirements) Zones() sets.String
type Taints ¶
Taints is a decorated alias type for []v1.Taint
func (Taints) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Taints.
func (Taints) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.