Skip to content

Commit 0378805

Browse files
committed
update v1beta2 with CapacityReservationPreference
update AWSMachine and Instance types with CapacityReservationPreference and rerun generators. Update conversions appropriately
1 parent 49f7c86 commit 0378805

9 files changed

+90
-0
lines changed

api/v1beta1/awscluster_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func (src *AWSCluster) ConvertTo(dstRaw conversion.Hub) error {
6363
dst.Status.Bastion.NetworkInterfaceType = restored.Status.Bastion.NetworkInterfaceType
6464
dst.Status.Bastion.CapacityReservationID = restored.Status.Bastion.CapacityReservationID
6565
dst.Status.Bastion.MarketType = restored.Status.Bastion.MarketType
66+
dst.Status.Bastion.CapacityReservationPreference = restored.Status.Bastion.CapacityReservationPreference
6667
}
6768
dst.Spec.Partition = restored.Spec.Partition
6869

api/v1beta1/awsmachine_conversion.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func (src *AWSMachine) ConvertTo(dstRaw conversion.Hub) error {
4444
dst.Spec.SecurityGroupOverrides = restored.Spec.SecurityGroupOverrides
4545
dst.Spec.CapacityReservationID = restored.Spec.CapacityReservationID
4646
dst.Spec.MarketType = restored.Spec.MarketType
47+
dst.Spec.CapacityReservationPreference = restored.Spec.CapacityReservationPreference
4748
dst.Spec.NetworkInterfaceType = restored.Spec.NetworkInterfaceType
4849
if restored.Spec.ElasticIPPool != nil {
4950
if dst.Spec.ElasticIPPool == nil {
@@ -108,6 +109,7 @@ func (r *AWSMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
108109
dst.Spec.Template.Spec.SecurityGroupOverrides = restored.Spec.Template.Spec.SecurityGroupOverrides
109110
dst.Spec.Template.Spec.CapacityReservationID = restored.Spec.Template.Spec.CapacityReservationID
110111
dst.Spec.Template.Spec.MarketType = restored.Spec.Template.Spec.MarketType
112+
dst.Spec.Template.Spec.CapacityReservationPreference = restored.Spec.Template.Spec.CapacityReservationPreference
111113
dst.Spec.Template.Spec.NetworkInterfaceType = restored.Spec.Template.Spec.NetworkInterfaceType
112114
if restored.Spec.Template.Spec.ElasticIPPool != nil {
113115
if dst.Spec.Template.Spec.ElasticIPPool == nil {

api/v1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/awsmachine_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ type AWSMachineSpec struct {
233233
// If marketType is not specified and spotMarketOptions is provided, the marketType defaults to "Spot".
234234
// +optional
235235
MarketType MarketType `json:"marketType,omitempty"`
236+
237+
// CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
238+
// "Open" (default): The instance may make make use of open Capacity Reservations that match its AZ and InstanceType
239+
// "None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
240+
// "CapacityReservationsOnly": The instance will only run if matched or targeted to a Capacity Reservation
241+
// +optional
242+
CapacityReservationPreference CapacityReservationPreference `json:"capacityReservationPreference,omitempty"`
236243
}
237244

238245
// CloudInit defines options related to the bootstrapping systems where

api/v1beta2/types.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,31 @@ type Instance struct {
273273
// If marketType is not specified and spotMarketOptions is provided, the marketType defaults to "Spot".
274274
// +optional
275275
MarketType MarketType `json:"marketType,omitempty"`
276+
277+
// CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
278+
// "Open" (default): The instance may make make use of open Capacity Reservations that match its AZ and InstanceType
279+
// "None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
280+
// "CapacityReservationsOnly": The instance will only run if matched or targeted to a Capacity Reservation
281+
// +optional
282+
CapacityReservationPreference CapacityReservationPreference `json:"capacityReservationPreference,omitempty"`
276283
}
277284

285+
// CapacityReservationPreference describes the preferred use of capacity reservations
286+
// of an instance
287+
// +kubebuilder:validation:Enum:=None;CapacityReservationsOnly;Open
288+
type CapacityReservationPreference string
289+
290+
const (
291+
// CapacityReservationPreferenceNone is a CapacityReservationPreference enum value
292+
CapacityReservationPreferenceNone CapacityReservationPreference = "None"
293+
294+
// CapacityReservationPreferenceOnly is a CapacityReservationPreference enum value
295+
CapacityReservationPreferenceOnly CapacityReservationPreference = "CapacityReservationsOnly"
296+
297+
// CapacityReservationPreferenceOpen is a CapacityReservationPreference enum value
298+
CapacityReservationPreferenceOpen CapacityReservationPreference = "Open"
299+
)
300+
278301
// MarketType describes the market type of an Instance
279302
// +kubebuilder:validation:Enum:=OnDemand;Spot;CapacityBlock
280303
type MarketType string

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,17 @@ spec:
12141214
description: CapacityReservationID specifies the target Capacity
12151215
Reservation into which the instance should be launched.
12161216
type: string
1217+
capacityReservationPreference:
1218+
description: |-
1219+
CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
1220+
"Open" (default): The instance may make make use of open Capacity Reservations that match its AZ and InstanceType
1221+
"None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
1222+
"CapacityReservationsOnly": The instance will only run if matched or targeted to a Capacity Reservation
1223+
enum:
1224+
- None
1225+
- CapacityReservationsOnly
1226+
- Open
1227+
type: string
12171228
ebsOptimized:
12181229
description: Indicates whether the instance is optimized for Amazon
12191230
EBS I/O.
@@ -3395,6 +3406,17 @@ spec:
33953406
description: CapacityReservationID specifies the target Capacity
33963407
Reservation into which the instance should be launched.
33973408
type: string
3409+
capacityReservationPreference:
3410+
description: |-
3411+
CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
3412+
"Open" (default): The instance may make make use of open Capacity Reservations that match its AZ and InstanceType
3413+
"None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
3414+
"CapacityReservationsOnly": The instance will only run if matched or targeted to a Capacity Reservation
3415+
enum:
3416+
- None
3417+
- CapacityReservationsOnly
3418+
- Open
3419+
type: string
33983420
ebsOptimized:
33993421
description: Indicates whether the instance is optimized for Amazon
34003422
EBS I/O.

config/crd/bases/infrastructure.cluster.x-k8s.io_awsclusters.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,17 @@ spec:
21972197
description: CapacityReservationID specifies the target Capacity
21982198
Reservation into which the instance should be launched.
21992199
type: string
2200+
capacityReservationPreference:
2201+
description: |-
2202+
CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
2203+
"Open" (default): The instance may make make use of open Capacity Reservations that match its AZ and InstanceType
2204+
"None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
2205+
"CapacityReservationsOnly": The instance will only run if matched or targeted to a Capacity Reservation
2206+
enum:
2207+
- None
2208+
- CapacityReservationsOnly
2209+
- Open
2210+
type: string
22002211
ebsOptimized:
22012212
description: Indicates whether the instance is optimized for Amazon
22022213
EBS I/O.

config/crd/bases/infrastructure.cluster.x-k8s.io_awsmachines.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,17 @@ spec:
641641
description: CapacityReservationID specifies the target Capacity Reservation
642642
into which the instance should be launched.
643643
type: string
644+
capacityReservationPreference:
645+
description: |-
646+
CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
647+
"Open" (default): The instance may make make use of open Capacity Reservations that match its AZ and InstanceType
648+
"None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
649+
"CapacityReservationsOnly": The instance will only run if matched or targeted to a Capacity Reservation
650+
enum:
651+
- None
652+
- CapacityReservationsOnly
653+
- Open
654+
type: string
644655
cloudInit:
645656
description: |-
646657
CloudInit defines options related to the bootstrapping systems where

config/crd/bases/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,17 @@ spec:
560560
description: CapacityReservationID specifies the target Capacity
561561
Reservation into which the instance should be launched.
562562
type: string
563+
capacityReservationPreference:
564+
description: |-
565+
CapacityReservationPreference specifies the preference for use of Capacity Reservations by the instance. Valid values include:
566+
"Open" (default): The instance may make make use of open Capacity Reservations that match its AZ and InstanceType
567+
"None": The instance may not make use of any Capacity Reservations. This is to conserve open reservations for desired workloads
568+
"CapacityReservationsOnly": The instance will only run if matched or targeted to a Capacity Reservation
569+
enum:
570+
- None
571+
- CapacityReservationsOnly
572+
- Open
573+
type: string
563574
cloudInit:
564575
description: |-
565576
CloudInit defines options related to the bootstrapping systems where

0 commit comments

Comments
 (0)