forked from aws/karpenter-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Create v1beta1 APIs (aws#4405)
- Loading branch information
1 parent
05435d8
commit 104737b
Showing
19 changed files
with
2,894 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../pkg/apis/crds/karpenter.k8s.aws_awsnodetemplates.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../pkg/apis/crds/karpenter.sh_machines.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../pkg/apis/crds/karpenter.sh_provisioners.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// +k8s:openapi-gen=true | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +groupName=compute.k8s.aws | ||
package v1beta1 // doc.go is discovered by codegen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
"fmt" | ||
"regexp" | ||
|
||
"github.com/aws/aws-sdk-go/service/ec2" | ||
v1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
|
||
"github.com/aws/karpenter-core/pkg/apis/v1alpha5" | ||
"github.com/aws/karpenter-core/pkg/apis/v1beta1" | ||
) | ||
|
||
func init() { | ||
v1beta1.RestrictedLabelDomains = v1beta1.RestrictedLabelDomains.Insert(RestrictedLabelDomains...) | ||
v1beta1.WellKnownLabels = v1beta1.WellKnownLabels.Insert( | ||
LabelInstanceHypervisor, | ||
LabelInstanceEncryptionInTransitSupported, | ||
LabelInstanceCategory, | ||
LabelInstanceFamily, | ||
LabelInstanceGeneration, | ||
LabelInstanceSize, | ||
LabelInstanceLocalNVME, | ||
LabelInstanceCPU, | ||
LabelInstanceMemory, | ||
LabelInstanceNetworkBandwidth, | ||
LabelInstancePods, | ||
LabelInstanceGPUName, | ||
LabelInstanceGPUManufacturer, | ||
LabelInstanceGPUCount, | ||
LabelInstanceGPUMemory, | ||
LabelInstanceAcceleratorName, | ||
LabelInstanceAcceleratorManufacturer, | ||
LabelInstanceAcceleratorCount, | ||
v1.LabelWindowsBuild, | ||
) | ||
} | ||
|
||
var ( | ||
CapacityTypeSpot = ec2.DefaultTargetCapacityTypeSpot | ||
CapacityTypeOnDemand = ec2.DefaultTargetCapacityTypeOnDemand | ||
AWSToKubeArchitectures = map[string]string{ | ||
"x86_64": v1beta1.ArchitectureAmd64, | ||
v1beta1.ArchitectureArm64: v1beta1.ArchitectureArm64, | ||
} | ||
WellKnownArchitectures = sets.NewString( | ||
v1beta1.ArchitectureAmd64, | ||
v1beta1.ArchitectureArm64, | ||
) | ||
RestrictedLabelDomains = []string{ | ||
Group, | ||
} | ||
RestrictedTagPatterns = []*regexp.Regexp{ | ||
// Adheres to cluster name pattern matching as specified in the API spec | ||
// https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html | ||
regexp.MustCompile(`^kubernetes\.io/cluster/[0-9A-Za-z][A-Za-z0-9\-_]*$`), | ||
regexp.MustCompile(fmt.Sprintf("^%s$", regexp.QuoteMeta(v1alpha5.ProvisionerNameLabelKey))), | ||
regexp.MustCompile(fmt.Sprintf("^%s$", regexp.QuoteMeta(v1alpha5.MachineManagedByAnnotationKey))), | ||
regexp.MustCompile(fmt.Sprintf("^%s$", regexp.QuoteMeta(v1beta1.NodePoolLabelKey))), | ||
regexp.MustCompile(fmt.Sprintf("^%s$", regexp.QuoteMeta(v1beta1.ManagedByAnnotationKey))), | ||
} | ||
AMIFamilyBottlerocket = "Bottlerocket" | ||
AMIFamilyAL2 = "AL2" | ||
AMIFamilyUbuntu = "Ubuntu" | ||
AMIFamilyWindows2019 = "Windows2019" | ||
AMIFamilyWindows2022 = "Windows2022" | ||
AMIFamilyCustom = "Custom" | ||
SupportedAMIFamilies = []string{ | ||
AMIFamilyBottlerocket, | ||
AMIFamilyAL2, | ||
AMIFamilyUbuntu, | ||
AMIFamilyWindows2019, | ||
AMIFamilyWindows2022, | ||
AMIFamilyCustom, | ||
} | ||
Windows2019 = "2019" | ||
Windows2022 = "2022" | ||
WindowsCore = "Core" | ||
Windows2019Build = "10.0.17763" | ||
Windows2022Build = "10.0.20348" | ||
ResourceNVIDIAGPU v1.ResourceName = "nvidia.com/gpu" | ||
ResourceAMDGPU v1.ResourceName = "amd.com/gpu" | ||
ResourceAWSNeuron v1.ResourceName = "aws.amazon.com/neuron" | ||
ResourceHabanaGaudi v1.ResourceName = "habana.ai/gaudi" | ||
ResourceAWSPodENI v1.ResourceName = "vpc.amazonaws.com/pod-eni" | ||
ResourcePrivateIPv4Address v1.ResourceName = "vpc.amazonaws.com/PrivateIPv4Address" | ||
|
||
LabelInstanceHypervisor = Group + "/instance-hypervisor" | ||
LabelInstanceEncryptionInTransitSupported = Group + "/instance-encryption-in-transit-supported" | ||
LabelInstanceCategory = Group + "/instance-category" | ||
LabelInstanceFamily = Group + "/instance-family" | ||
LabelInstanceGeneration = Group + "/instance-generation" | ||
LabelInstanceLocalNVME = Group + "/instance-local-nvme" | ||
LabelInstanceSize = Group + "/instance-size" | ||
LabelInstanceCPU = Group + "/instance-cpu" | ||
LabelInstanceMemory = Group + "/instance-memory" | ||
LabelInstanceNetworkBandwidth = Group + "/instance-network-bandwidth" | ||
LabelInstancePods = Group + "/instance-pods" | ||
LabelInstanceGPUName = Group + "/instance-gpu-name" | ||
LabelInstanceGPUManufacturer = Group + "/instance-gpu-manufacturer" | ||
LabelInstanceGPUCount = Group + "/instance-gpu-count" | ||
LabelInstanceGPUMemory = Group + "/instance-gpu-memory" | ||
LabelInstanceAcceleratorName = Group + "/instance-accelerator-name" | ||
LabelInstanceAcceleratorManufacturer = Group + "/instance-accelerator-manufacturer" | ||
LabelInstanceAcceleratorCount = Group + "/instance-accelerator-count" | ||
AnnotationNodeClassHash = Group + "/nodeclass-hash" | ||
) |
Oops, something went wrong.