v1alpha2

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

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

Index

Constants

View Source
const (
	Ubuntu2204ImageFamily = "Ubuntu2204"
	AzureLinuxImageFamily = "AzureLinux"
)
View Source
const AKSNodeClassHashVersion = "v1"

We need to bump the AKSNodeClassHashVersion when we make an update to the AKSNodeClass 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 Group = "karpenter.azure.com"

Variables

View Source
var (
	TerminationFinalizer     = apis.Group + "/termination"
	AzureToKubeArchitectures = map[string]string{

		"x64":   karpv1.ArchitectureAmd64,
		"Arm64": karpv1.ArchitectureArm64,
	}
	RestrictedLabelDomains = []string{
		Group,
	}

	RestrictedLabels = sets.New(
		LabelSKUHyperVGeneration,
	)

	AllowUndefinedWellKnownAndRestrictedLabels = func(options *scheduling.CompatibilityOptions) {
		options.AllowUndefined = karpv1.WellKnownLabels.Union(RestrictedLabels)
	}

	// alternative zone label for Machine (the standard one is protected for AKS nodes)
	AlternativeLabelTopologyZone = Group + "/zone"

	HyperVGenerationV1 = "1"
	HyperVGenerationV2 = "2"
	ManufacturerNvidia = "nvidia"

	LabelSKUName    = Group + "/sku-name"    // Standard_A1_v2
	LabelSKUFamily  = Group + "/sku-family"  // A
	LabelSKUVersion = Group + "/sku-version" // numerical (without v), with 1 backfilled

	LabelSKUCPU         = Group + "/sku-cpu"    // sku.vCPUs
	LabelSKUMemory      = Group + "/sku-memory" // sku.MemoryGB
	LabelSKUAccelerator = Group + "/sku-accelerator"

	// selected capabilities (from additive features in VM size name, or from SKU capabilities)
	LabelSKUAcceleratedNetworking = Group + "/sku-networking-accelerated" // sku.AcceleratedNetworkingEnabled

	LabelSKUStoragePremiumCapable     = Group + "/sku-storage-premium-capable"     // sku.IsPremiumIO
	LabelSKUStorageEphemeralOSMaxSize = Group + "/sku-storage-ephemeralos-maxsize" // calculated as max(sku.CachedDiskBytes, sku.MaxResourceVolumeMB)

	LabelSKUEncryptionAtHostSupported = Group + "/sku-encryptionathost-capable" // sku.EncryptionAtHostSupported

	// GPU labels
	LabelSKUGPUName         = Group + "/sku-gpu-name"         // ie GPU Accelerator type we parse from vmSize
	LabelSKUGPUManufacturer = Group + "/sku-gpu-manufacturer" // ie NVIDIA, AMD, etc
	LabelSKUGPUCount        = Group + "/sku-gpu-count"        // ie 16, 32, etc

	// Internal/restricted labels
	LabelSKUHyperVGeneration = Group + "/sku-hyperv-generation" // sku.HyperVGenerations

	// AKS labels
	AKSLabelDomain = "kubernetes.azure.com"

	AKSLabelCluster = AKSLabelDomain + "/cluster"

	AnnotationAKSNodeClassHash        = apis.Group + "/aksnodeclass-hash"
	AnnotationAKSNodeClassHashVersion = apis.Group + "/aksnodeclass-hash-version"
)
View Source
var (
	SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: "v1alpha2"}
	SchemeBuilder      = runtime.NewSchemeBuilder(func(scheme *runtime.Scheme) error {
		scheme.AddKnownTypes(SchemeGroupVersion,
			&AKSNodeClass{},
			&AKSNodeClassList{},
		)
		metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
		return nil
	})
)
View Source
var (
	AnnotationInPlaceUpdateHash = Group + "/in-place-update-hash"
)

Annotations

Functions

This section is empty.

Types

type AKSNodeClass

type AKSNodeClass struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   AKSNodeClassSpec   `json:"spec,omitempty"`
	Status AKSNodeClassStatus `json:"status,omitempty"`
}

AKSNodeClass is the Schema for the AKSNodeClass API +kubebuilder:object:root=true +kubebuilder:resource:path=aksnodeclasses,scope=Cluster,categories=karpenter,shortName={aksnc,aksncs} +kubebuilder:storageversion +kubebuilder:subresource:status

func (*AKSNodeClass) DeepCopy

func (in *AKSNodeClass) DeepCopy() *AKSNodeClass

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

func (*AKSNodeClass) DeepCopyInto

func (in *AKSNodeClass) DeepCopyInto(out *AKSNodeClass)

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

func (*AKSNodeClass) DeepCopyObject

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

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

func (*AKSNodeClass) GetConditions added in v0.7.0

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

func (*AKSNodeClass) Hash

func (in *AKSNodeClass) Hash() string

TODO: add hash tests

func (*AKSNodeClass) SetConditions added in v0.7.0

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

func (*AKSNodeClass) StatusConditions added in v0.7.0

func (in *AKSNodeClass) StatusConditions() status.ConditionSet

type AKSNodeClassList

type AKSNodeClassList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []AKSNodeClass `json:"items"`
}

AKSNodeClassList contains a list of AKSNodeClass +kubebuilder:object:root=true

func (*AKSNodeClassList) DeepCopy

func (in *AKSNodeClassList) DeepCopy() *AKSNodeClassList

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

func (*AKSNodeClassList) DeepCopyInto

func (in *AKSNodeClassList) DeepCopyInto(out *AKSNodeClassList)

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

func (*AKSNodeClassList) DeepCopyObject

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

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

type AKSNodeClassSpec

type AKSNodeClassSpec struct {
	// VNETSubnetID is the subnet used by nics provisioned with this nodeclass.
	// If not specified, we will use the default --vnet-subnet-id specified in karpenter's options config
	// +kubebuilder:validation:Pattern=`(?i)^\/subscriptions\/[^\/]+\/resourceGroups\/[a-zA-Z0-9_\-().]{0,89}[a-zA-Z0-9_\-()]\/providers\/Microsoft\.Network\/virtualNetworks\/[^\/]+\/subnets\/[^\/]+$`
	// +optional
	VNETSubnetID *string `json:"vnetSubnetID,omitempty"`
	// +kubebuilder:default=128
	// +kubebuilder:validation:Minimum=100
	// osDiskSizeGB is the size of the OS disk in GB.
	OSDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"`
	// ImageID is the ID of the image that instances use.
	// Not exposed in the API yet
	ImageID *string `json:"-"`
	// ImageFamily is the image family that instances use.
	// +kubebuilder:default=Ubuntu2204
	// +kubebuilder:validation:Enum:={Ubuntu2204,AzureLinux}
	ImageFamily *string `json:"imageFamily,omitempty"`
	// Tags to be applied on Azure resources like instances.
	// +optional
	Tags map[string]string `json:"tags,omitempty"`
	// 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"
	// +optional
	Kubelet *KubeletConfiguration `json:"kubelet,omitempty" hash:"ignore"`
	// 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"`
}

AKSNodeClassSpec is the top level specification for the AKS Karpenter Provider. This will contain configuration necessary to launch instances in AKS.

func (*AKSNodeClassSpec) DeepCopy

func (in *AKSNodeClassSpec) DeepCopy() *AKSNodeClassSpec

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

func (*AKSNodeClassSpec) DeepCopyInto

func (in *AKSNodeClassSpec) DeepCopyInto(out *AKSNodeClassSpec)

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

type AKSNodeClassStatus

type AKSNodeClassStatus struct {
	// Conditions contains signals for health and readiness
	// +optional
	Conditions []status.Condition `json:"conditions,omitempty"`
}

AKSNodeClassStatus contains the resolved state of the AKSNodeClass

func (*AKSNodeClassStatus) DeepCopy

func (in *AKSNodeClassStatus) DeepCopy() *AKSNodeClassStatus

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

func (*AKSNodeClassStatus) DeepCopyInto

func (in *AKSNodeClassStatus) DeepCopyInto(out *AKSNodeClassStatus)

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

type Image

type Image struct {
	// ID of the image
	// +required
	ID string `json:"id"`
	// Requirements of the image to be utilized on an instance type
	// +required
	Requirements []corev1.NodeSelectorRequirement `json:"requirements"`
}

Image contains resolved image selector values utilized for node launch

func (*Image) DeepCopy

func (in *Image) DeepCopy() *Image

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

func (*Image) DeepCopyInto

func (in *Image) DeepCopyInto(out *Image)

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

type KubeletConfiguration added in v0.7.0

type KubeletConfiguration struct {
	// cpuManagerPolicy is the name of the policy to use.
	// +kubebuilder:validation:Enum:={none,static}
	// +kubebuilder:default="none"
	// +optional
	CPUManagerPolicy string `json:"cpuManagerPolicy,omitempty"`
	// CPUCFSQuota enables CPU CFS quota enforcement for containers that specify CPU limits.
	// Note: AKS CustomKubeletConfig uses cpuCfsQuota (camelCase)
	// +kubebuilder:default=true
	// +optional
	CPUCFSQuota *bool `json:"cpuCFSQuota,omitempty"`
	// cpuCfsQuotaPeriod sets the CPU CFS quota period value, `cpu.cfs_period_us`.
	// The value must be between 1 ms and 1 second, inclusive.
	// Default: "100ms"
	// +optional
	// +kubebuilder:default="100ms"
	// TODO: validation
	CPUCFSQuotaPeriod metav1.Duration `json:"cpuCFSQuotaPeriod,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.
	// Note: AKS CustomKubeletConfig does not have "Percent" in the field name
	// +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
	// Note: AKS CustomKubeletConfig does not have "Percent" in the field name
	// +kubebuilder:validation:Minimum:=0
	// +kubebuilder:validation:Maximum:=100
	// +optional
	ImageGCLowThresholdPercent *int32 `json:"imageGCLowThresholdPercent,omitempty"`
	// topologyManagerPolicy is the name of the topology manager policy to use.
	// Valid values include:
	//
	// - `restricted`: kubelet only allows pods with optimal NUMA node alignment for requested resources;
	// - `best-effort`: kubelet will favor pods with NUMA alignment of CPU and device resources;
	// - `none`: kubelet has no knowledge of NUMA alignment of a pod's CPU and device resources.
	// - `single-numa-node`: kubelet only allows pods with a single NUMA alignment
	//   of CPU and device resources.
	//
	// +kubebuilder:validation:Enum:={restricted,best-effort,none,single-numa-node}
	// +kubebuilder:default="none"
	// +optional
	TopologyManagerPolicy string `json:"topologyManagerPolicy,omitempty"`
	// A comma separated whitelist of unsafe sysctls or sysctl patterns (ending in `*`).
	// Unsafe sysctl groups are `kernel.shm*`, `kernel.msg*`, `kernel.sem`, `fs.mqueue.*`,
	// and `net.*`. For example: "`kernel.msg*,net.ipv4.route.min_pmtu`"
	// Default: []
	// TODO: validation
	// +optional
	AllowedUnsafeSysctls []string `json:"allowedUnsafeSysctls,omitempty"`
	// containerLogMaxSize is a quantity defining the maximum size of the container log
	// file before it is rotated. For example: "5Mi" or "256Ki".
	// Default: "10Mi"
	// AKS CustomKubeletConfig has containerLogMaxSizeMB (with units), defaults to 50
	// +kubebuilder:validation:Pattern=`^\d+(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)$`
	// +kubebuilder:default="50Mi"
	// +optional
	ContainerLogMaxSize string `json:"containerLogMaxSize,omitempty"`
	// containerLogMaxFiles specifies the maximum number of container log files that can be present for a container.
	// Default: 5
	// +kubebuilder:validation:Minimum:=2
	// +kubebuilder:default=5
	// +optional
	ContainerLogMaxFiles *int32 `json:"containerLogMaxFiles,omitempty"`
	// podPidsLimit is the maximum number of PIDs in any pod.
	// AKS CustomKubeletConfig uses PodMaxPids, int32 (!)
	// Default: -1
	// +optional
	PodPidsLimit *int64 `json:"podPidsLimit,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

AKS CustomKubeletConfig w/o CPUReserved,MemoryReserved,SeccompDefault https://learn.microsoft.com/en-us/azure/aks/custom-node-configuration?tabs=linux-node-pools

func (*KubeletConfiguration) DeepCopy added in v0.7.0

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

func (*KubeletConfiguration) DeepCopyInto added in v0.7.0

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

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