Skip to content

Commit d0dfe6a

Browse files
committed
Add excludedInstanceTypes to instanceRequirements
When defining instanceRequirements in the mixedInstancesPolicy for an instance group, allow defining a list of instance types that can be excluded from the set of eligible instances using a new excludedInstanceTypes field.
1 parent 46d8ed7 commit d0dfe6a

12 files changed

Lines changed: 84 additions & 16 deletions

docs/instance_groups.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,24 @@ spec:
294294
295295
Note that burstable instances are always included in the set of eligible instances.
296296
297+
You can exclude instance types from the set of eligible instances using `excludedInstanceTypes`.
298+
You can use strings with one or more wild cards, represented by an asterisk (*), to exclude an instance type, size, or generation.
299+
For example, `m7i.8xlarge`, `c7*.*`, `m7a.*`, `r*`, `*3*`.
300+
301+
```
302+
spec:
303+
mixedInstancesPolicy:
304+
instanceRequirements:
305+
cpu:
306+
min: "2"
307+
max: "16"
308+
memory:
309+
min: "2G"
310+
excludedInstanceTypes:
311+
- t2.*
312+
- t3.*
313+
```
314+
297315
## warmPool (AWS Only)
298316
299317
{{ kops_feature_table(kops_added_default='1.21') }}

k8s/crds/kops.k8s.io_instancegroups.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,14 @@ spec:
939939
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
940940
x-kubernetes-int-or-string: true
941941
type: object
942+
excludedInstanceTypes:
943+
description: |-
944+
ExcludedInstanceTypes is a list of instance types which will not be used by the instance group.
945+
You can use strings with one or more wild cards, represented by an asterisk (*), to exclude an
946+
instance type, size, or generation.
947+
items:
948+
type: string
949+
type: array
942950
memory:
943951
properties:
944952
max:

pkg/apis/kops/instancegroup.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ type MixedInstancesPolicySpec struct {
279279
type InstanceRequirementsSpec struct {
280280
CPU *MinMaxSpec `json:"cpu,omitempty"`
281281
Memory *MinMaxSpec `json:"memory,omitempty"`
282+
// ExcludedInstanceTypes is a list of instance types which will not be used by the instance group.
283+
// You can use strings with one or more wild cards, represented by an asterisk (*), to exclude an
284+
// instance type, size, or generation.
285+
ExcludedInstanceTypes []string `json:"excludedInstanceTypes,omitempty"`
282286
}
283287

284288
type MinMaxSpec struct {

pkg/apis/kops/v1alpha2/instancegroup.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ type MixedInstancesPolicySpec struct {
225225
type InstanceRequirementsSpec struct {
226226
CPU *MinMaxSpec `json:"cpu,omitempty"`
227227
Memory *MinMaxSpec `json:"memory,omitempty"`
228+
// ExcludedInstanceTypes is a list of instance types which will not be used by the instance group.
229+
// You can use strings with one or more wild cards, represented by an asterisk (*), to exclude an
230+
// instance type, size, or generation.
231+
ExcludedInstanceTypes []string `json:"excludedInstanceTypes,omitempty"`
228232
}
229233

230234
type MinMaxSpec struct {

pkg/apis/kops/v1alpha2/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.

pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go

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

pkg/apis/kops/v1alpha3/instancegroup.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ type MixedInstancesPolicySpec struct {
218218
type InstanceRequirementsSpec struct {
219219
CPU *MinMaxSpec `json:"cpu,omitempty"`
220220
Memory *MinMaxSpec `json:"memory,omitempty"`
221+
// ExcludedInstanceTypes is a list of instance types which will not be used by the instance group.
222+
// You can use strings with one or more wild cards, represented by an asterisk (*), to exclude an
223+
// instance type, size, or generation.
224+
ExcludedInstanceTypes []string `json:"excludedInstanceTypes,omitempty"`
221225
}
222226

223227
type MinMaxSpec struct {

pkg/apis/kops/v1alpha3/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.

pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go

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

pkg/apis/kops/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)