Skip to content

Commit 217f6eb

Browse files
faermanjrvanderp3
authored andcommitted
Draft dedicated hosts implementation
1 parent b925771 commit 217f6eb

18 files changed

+382
-0
lines changed

api/v1beta1/awscluster_conversion.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ func (src *AWSCluster) ConvertTo(dstRaw conversion.Hub) error {
6262
dst.Status.Bastion.NetworkInterfaceType = restored.Status.Bastion.NetworkInterfaceType
6363
dst.Status.Bastion.CapacityReservationID = restored.Status.Bastion.CapacityReservationID
6464
dst.Status.Bastion.MarketType = restored.Status.Bastion.MarketType
65+
dst.Status.Bastion.HostAffinity = restored.Status.Bastion.HostAffinity
66+
dst.Status.Bastion.HostID = restored.Status.Bastion.HostID
6567
}
6668
dst.Spec.Partition = restored.Spec.Partition
6769

api/v1beta1/awsmachine_conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ func (src *AWSMachine) ConvertTo(dstRaw conversion.Hub) error {
4343
dst.Spec.SecurityGroupOverrides = restored.Spec.SecurityGroupOverrides
4444
dst.Spec.CapacityReservationID = restored.Spec.CapacityReservationID
4545
dst.Spec.MarketType = restored.Spec.MarketType
46+
dst.Spec.HostID = restored.Spec.HostID
47+
dst.Spec.HostAffinity = restored.Spec.HostAffinity
4648
dst.Spec.NetworkInterfaceType = restored.Spec.NetworkInterfaceType
4749
if restored.Spec.ElasticIPPool != nil {
4850
if dst.Spec.ElasticIPPool == nil {
@@ -107,6 +109,8 @@ func (r *AWSMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
107109
dst.Spec.Template.Spec.SecurityGroupOverrides = restored.Spec.Template.Spec.SecurityGroupOverrides
108110
dst.Spec.Template.Spec.CapacityReservationID = restored.Spec.Template.Spec.CapacityReservationID
109111
dst.Spec.Template.Spec.MarketType = restored.Spec.Template.Spec.MarketType
112+
dst.Spec.Template.Spec.HostID = restored.Spec.Template.Spec.HostID
113+
dst.Spec.Template.Spec.HostAffinity = restored.Spec.Template.Spec.HostAffinity
110114
dst.Spec.Template.Spec.NetworkInterfaceType = restored.Spec.Template.Spec.NetworkInterfaceType
111115
if restored.Spec.Template.Spec.ElasticIPPool != nil {
112116
if dst.Spec.Template.Spec.ElasticIPPool == nil {

api/v1beta1/zz_generated.conversion.go

Lines changed: 4 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,16 @@ type AWSMachineSpec struct {
223223
// If marketType is not specified and spotMarketOptions is provided, the marketType defaults to "Spot".
224224
// +optional
225225
MarketType MarketType `json:"marketType,omitempty"`
226+
227+
// HostID specifies the Dedicated Host on which the instance must be started.
228+
// +optional
229+
HostID *string `json:"hostID,omitempty"`
230+
231+
// Affinity specifies the dedicated host affinity setting for the instance.
232+
// When affinity is set to Host, an instance started onto a specific host always restarts on the same host if stopped.
233+
// +optional
234+
// +kubebuilder:validation:Enum:=Default;Host
235+
HostAffinity *string `json:"hostAffinity,omitempty"`
226236
}
227237

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

api/v1beta2/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,14 @@ 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+
// HostID specifies the dedicated host on which the instance should be started
278+
// +optional
279+
HostID *string `json:"hostID,omitempty"`
280+
281+
// Affinity specifies the dedicated host affinity setting for the instance.
282+
// +optional
283+
HostAffinity *string `json:"hostAffinity,omitempty"`
276284
}
277285

278286
// MarketType describes the market type of an Instance

api/v1beta2/zz_generated.deepcopy.go

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

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,14 @@ spec:
12131213
description: Specifies whether enhanced networking with ENA is
12141214
enabled.
12151215
type: boolean
1216+
hostAffinity:
1217+
description: Affinity specifies the dedicated host affinity setting
1218+
for the instance.
1219+
type: string
1220+
hostID:
1221+
description: HostID specifies the dedicated host on which the
1222+
instance should be started
1223+
type: string
12161224
iamProfile:
12171225
description: The name of the IAM instance profile associated with
12181226
the instance, if applicable.
@@ -3378,6 +3386,14 @@ spec:
33783386
description: Specifies whether enhanced networking with ENA is
33793387
enabled.
33803388
type: boolean
3389+
hostAffinity:
3390+
description: Affinity specifies the dedicated host affinity setting
3391+
for the instance.
3392+
type: string
3393+
hostID:
3394+
description: HostID specifies the dedicated host on which the
3395+
instance should be started
3396+
type: string
33813397
iamProfile:
33823398
description: The name of the IAM instance profile associated with
33833399
the instance, if applicable.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,14 @@ spec:
21802180
description: Specifies whether enhanced networking with ENA is
21812181
enabled.
21822182
type: boolean
2183+
hostAffinity:
2184+
description: Affinity specifies the dedicated host affinity setting
2185+
for the instance.
2186+
type: string
2187+
hostID:
2188+
description: HostID specifies the dedicated host on which the
2189+
instance should be started
2190+
type: string
21832191
iamProfile:
21842192
description: The name of the IAM instance profile associated with
21852193
the instance, if applicable.

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,18 @@ spec:
686686
- message: allowed values are 'none' and 'amazon-pool'
687687
rule: self in ['none','amazon-pool']
688688
type: object
689+
hostAffinity:
690+
description: |-
691+
Affinity specifies the dedicated host affinity setting for the instance.
692+
When affinity is set to Host, an instance started onto a specific host always restarts on the same host if stopped.
693+
enum:
694+
- Default
695+
- Host
696+
type: string
697+
hostID:
698+
description: HostID specifies the Dedicated Host on which the instance
699+
must be started.
700+
type: string
689701
iamInstanceProfile:
690702
description: IAMInstanceProfile is a name of an IAM instance profile
691703
to assign to the instance

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,18 @@ spec:
620620
- message: allowed values are 'none' and 'amazon-pool'
621621
rule: self in ['none','amazon-pool']
622622
type: object
623+
hostAffinity:
624+
description: |-
625+
Affinity specifies the dedicated host affinity setting for the instance.
626+
When affinity is set to Host, an instance started onto a specific host always restarts on the same host if stopped.
627+
enum:
628+
- Default
629+
- Host
630+
type: string
631+
hostID:
632+
description: HostID specifies the Dedicated Host on which
633+
the instance must be started.
634+
type: string
623635
iamInstanceProfile:
624636
description: IAMInstanceProfile is a name of an IAM instance
625637
profile to assign to the instance

0 commit comments

Comments
 (0)