Skip to content

Commit

Permalink
Switch to v1 APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam committed Jul 5, 2024
1 parent 65b79e1 commit 5d221a8
Show file tree
Hide file tree
Showing 107 changed files with 2,785 additions and 2,608 deletions.
22 changes: 11 additions & 11 deletions hack/docs/instancetypes_gen_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/manager"
corev1beta1 "sigs.k8s.io/karpenter/pkg/apis/v1beta1"
corev1 "sigs.k8s.io/karpenter/pkg/apis/v1"

coreoperator "sigs.k8s.io/karpenter/pkg/operator"
coreoptions "sigs.k8s.io/karpenter/pkg/operator/options"
coretest "sigs.k8s.io/karpenter/pkg/test"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
providerv1 "github.com/aws/karpenter-provider-aws/pkg/apis/v1"
"github.com/aws/karpenter-provider-aws/pkg/operator"
"github.com/aws/karpenter-provider-aws/pkg/operator/options"
"github.com/aws/karpenter-provider-aws/pkg/test"
Expand Down Expand Up @@ -103,10 +103,10 @@ func main() {
log.Fatalf("updating instance types offerings, %s", err)
}
// Fake a NodeClass so we can use it to get InstanceTypes
nodeClass := &v1beta1.EC2NodeClass{
Spec: v1beta1.EC2NodeClassSpec{
AMIFamily: &v1beta1.AMIFamilyAL2023,
SubnetSelectorTerms: []v1beta1.SubnetSelectorTerm{
nodeClass := &providerv1.EC2NodeClass{
Spec: providerv1.EC2NodeClassSpec{
AMIFamily: &providerv1.AMIFamilyAL2023,
SubnetSelectorTerms: []providerv1.SubnetSelectorTerm{
{
Tags: map[string]string{
"*": "*",
Expand All @@ -119,13 +119,13 @@ func main() {
if err != nil {
log.Fatalf("listing subnets, %s", err)
}
nodeClass.Status.Subnets = lo.Map(subnets, func(ec2subnet *ec2.Subnet, _ int) v1beta1.Subnet {
return v1beta1.Subnet{
nodeClass.Status.Subnets = lo.Map(subnets, func(ec2subnet *ec2.Subnet, _ int) providerv1.Subnet {
return providerv1.Subnet{
ID: *ec2subnet.SubnetId,
Zone: *ec2subnet.AvailabilityZone,
}
})
instanceTypes, err := op.InstanceTypesProvider.List(ctx, &corev1beta1.KubeletConfiguration{}, nodeClass)
instanceTypes, err := op.InstanceTypesProvider.List(ctx, &providerv1.KubeletConfiguration{}, nodeClass)
if err != nil {
log.Fatalf("listing instance types, %s", err)
}
Expand Down Expand Up @@ -172,8 +172,8 @@ below are the resources available with some assumptions and after the instance o

// we don't want to show a few labels that will vary amongst regions
delete(labelNameMap, v1.LabelTopologyZone)
delete(labelNameMap, v1beta1.LabelTopologyZoneID)
delete(labelNameMap, corev1beta1.CapacityTypeLabelKey)
delete(labelNameMap, providerv1.LabelTopologyZoneID)
delete(labelNameMap, corev1.CapacityTypeLabelKey)

labelNames := lo.Keys(labelNameMap)

Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/crds/karpenter.sh_nodeclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ spec:
- spec
type: object
served: true
storage: false
storage: true
subresources:
status: {}
- additionalPrinterColumns:
Expand Down Expand Up @@ -790,6 +790,6 @@ spec:
- spec
type: object
served: true
storage: true
storage: false
subresources:
status: {}
156 changes: 154 additions & 2 deletions pkg/apis/crds/karpenter.sh_nodepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,26 @@ spec:
- jsonPath: .spec.template.spec.nodeClassRef.name
name: NodeClass
type: string
- jsonPath: .status.resources.nodes
name: Nodes
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .spec.weight
name: Weight
priority: 1
type: integer
- jsonPath: .status.resources.cpu
name: CPU
priority: 1
type: string
- jsonPath: .status.resources.memory
name: Memory
priority: 1
type: string
name: v1
schema:
Expand Down Expand Up @@ -94,6 +111,19 @@ spec:
Ref: https://github.com/kubernetes-sigs/controller-tools/blob/55efe4be40394a288216dab63156b0a64fb82929/pkg/crd/markers/validation.go#L379-L388
pattern: ^((100|[0-9]{1,2})%|[0-9]+)$
type: string
reasons:
description: |-
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.
items:
description: DisruptionReason defines valid reasons for disruption budgets.
enum:
- underutilized
- empty
- drifted
type: string
type: array
schedule:
description: |-
Schedule specifies when a budget begins being active, following
Expand Down Expand Up @@ -383,6 +413,67 @@ spec:
status:
description: NodePoolStatus defines the observed state of NodePool
properties:
conditions:
description: Conditions contains signals for health and readiness
items:
description: Condition aliases the upstream type and adds additional helper methods
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
resources:
additionalProperties:
anyOf:
Expand All @@ -397,7 +488,7 @@ spec:
- spec
type: object
served: true
storage: false
storage: true
subresources:
status: {}
- additionalPrinterColumns:
Expand Down Expand Up @@ -902,6 +993,67 @@ spec:
status:
description: NodePoolStatus defines the observed state of NodePool
properties:
conditions:
description: Conditions contains signals for health and readiness
items:
description: Condition aliases the upstream type and adds additional helper methods
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
resources:
additionalProperties:
anyOf:
Expand All @@ -916,6 +1068,6 @@ spec:
- spec
type: object
served: true
storage: true
storage: false
subresources:
status: {}
Loading

0 comments on commit 5d221a8

Please sign in to comment.