From a6f33a4aaf271d935d1e24a0d365e60d4988e9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Prokopi=C4=87?= <5638639+nprokopic@users.noreply.github.com> Date: Thu, 30 Nov 2023 01:12:24 +0100 Subject: [PATCH] Move Values.nodePools to Values.global.nodePools (#416) * Move .Values.nodePools to .Values.global.nodePools * Fix nodePools values usage in AWSCluster resource * Fix nodePools values usage in node pools templates * Update CHANGELOG * Fix CI values --- CHANGELOG.md | 1 + helm/cluster-aws/README.md | 52 +++++++++---------- helm/cluster-aws/ci/ci-values.yaml | 14 ++--- helm/cluster-aws/ci/test-spot-instances.yaml | 14 ++--- helm/cluster-aws/templates/_aws_cluster.tpl | 2 +- helm/cluster-aws/templates/_machine_pools.tpl | 2 +- helm/cluster-aws/values.schema.json | 22 ++++---- 7 files changed, 54 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b511ec67..aedb0b2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Move Helm values property `.Values.metadata` to `.Values.global.metadata`. - Move Helm values property `.Values.connectivity` to `.Values.global.connectivity`. - Move Helm values property `.Values.controlPlane` to `.Values.global.controlPlane`. +- Move Helm values property `.Values.nodePools` to `.Values.global.nodePools`. ### Added diff --git a/helm/cluster-aws/README.md b/helm/cluster-aws/README.md index 9258037f..091b345c 100644 --- a/helm/cluster-aws/README.md +++ b/helm/cluster-aws/README.md @@ -202,36 +202,36 @@ Properties within the `.global.metadata` object | `global.metadata.servicePriority` | **Service priority** - The relative importance of this cluster.|**Type:** `string`
**Default:** `"highest"`| ### Node pools -Properties within the `.nodePools` top-level object +Properties within the `.global.nodePools` object Node pools of the cluster. If not specified, this defaults to the value of `internal.nodePools`. | **Property** | **Description** | **More Details** | | :----------- | :-------------- | :--------------- | -| `nodePools.PATTERN` | **Node pool**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.additionalSecurityGroups` | **Machine pool additional security groups** - Additional security groups that will be added to the machine pool nodes.|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.additionalSecurityGroups[*]` | **security group**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.additionalSecurityGroups[*].id` | **Id of the security group** - ID of the security group that will be added to the machine pool nodes. The security group must exist.|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.availabilityZones` | **Availability zones**|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.availabilityZones[*]` | **Availability zone**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.customNodeLabels` | **Custom node labels**|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.customNodeLabels[*]` | **Label**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.customNodeTaints` | **Custom node taints**|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.customNodeTaints[*]` |**None**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.customNodeTaints[*].effect` | **Effect**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.customNodeTaints[*].key` | **Key**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.customNodeTaints[*].value` | **Value**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.instanceType` | **EC2 instance type**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.instanceTypeOverrides` | **Instance type overrides** - Ordered list of instance types to be used for the machine pool. The first instance type that is available in the region will be used. Read more in our docs https://docs.giantswarm.io/advanced/cluster-management/node-pools-capi/|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
**Default:** `[]`| -| `nodePools.PATTERN.instanceTypeOverrides[*]` | **EC2 instance type**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.maxSize` | **Maximum number of nodes**|**Type:** `integer`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.minSize` | **Minimum number of nodes**|**Type:** `integer`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.rootVolumeSizeGB` | **Root volume size (GB)**|**Type:** `integer`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.spotInstances` | **Spot instances** - Compared to on-demand instances, spot instances can help you save cost.|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.spotInstances.enabled` | **Enable**|**Type:** `boolean`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
**Default:** `false`| -| `nodePools.PATTERN.spotInstances.maxPrice` | **Maximum price to pay per instance per hour, in USD.**|**Type:** `number`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.subnetTags` | **Subnet tags** - Tags to filter which AWS subnets will be used for this node pool.|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.subnetTags[*]` | **Subnet tag**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| -| `nodePools.PATTERN.subnetTags[*].*` | **Tag value**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
**Value pattern:** `^[ a-zA-Z0-9\._:/=+-@]+$`
| +| `global.nodePools.PATTERN` | **Node pool**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.additionalSecurityGroups` | **Machine pool additional security groups** - Additional security groups that will be added to the machine pool nodes.|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.additionalSecurityGroups[*]` | **security group**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.additionalSecurityGroups[*].id` | **Id of the security group** - ID of the security group that will be added to the machine pool nodes. The security group must exist.|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.availabilityZones` | **Availability zones**|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.availabilityZones[*]` | **Availability zone**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.customNodeLabels` | **Custom node labels**|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.customNodeLabels[*]` | **Label**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.customNodeTaints` | **Custom node taints**|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.customNodeTaints[*]` |**None**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.customNodeTaints[*].effect` | **Effect**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.customNodeTaints[*].key` | **Key**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.customNodeTaints[*].value` | **Value**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.instanceType` | **EC2 instance type**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.instanceTypeOverrides` | **Instance type overrides** - Ordered list of instance types to be used for the machine pool. The first instance type that is available in the region will be used. Read more in our docs https://docs.giantswarm.io/advanced/cluster-management/node-pools-capi/|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
**Default:** `[]`| +| `global.nodePools.PATTERN.instanceTypeOverrides[*]` | **EC2 instance type**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.maxSize` | **Maximum number of nodes**|**Type:** `integer`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.minSize` | **Minimum number of nodes**|**Type:** `integer`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.rootVolumeSizeGB` | **Root volume size (GB)**|**Type:** `integer`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.spotInstances` | **Spot instances** - Compared to on-demand instances, spot instances can help you save cost.|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.spotInstances.enabled` | **Enable**|**Type:** `boolean`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
**Default:** `false`| +| `global.nodePools.PATTERN.spotInstances.maxPrice` | **Maximum price to pay per instance per hour, in USD.**|**Type:** `number`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.subnetTags` | **Subnet tags** - Tags to filter which AWS subnets will be used for this node pool.|**Type:** `array`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.subnetTags[*]` | **Subnet tag**|**Type:** `object`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
| +| `global.nodePools.PATTERN.subnetTags[*].*` | **Tag value**|**Type:** `string`
**Key pattern:**
`PATTERN`=`^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$`
**Value pattern:** `^[ a-zA-Z0-9\._:/=+-@]+$`
| ### Other diff --git a/helm/cluster-aws/ci/ci-values.yaml b/helm/cluster-aws/ci/ci-values.yaml index 3cabba20..770d0093 100644 --- a/helm/cluster-aws/ci/ci-values.yaml +++ b/helm/cluster-aws/ci/ci-values.yaml @@ -9,11 +9,11 @@ global: username: giantswarmpull password: abcdef - endpoint: quay.io + nodePools: + pool0: + maxSize: 2 + minSize: 2 + instanceTypeOverrides: + - r6i.xlarge + - m5.xlarge baseDomain: example.com -nodePools: - pool0: - maxSize: 2 - minSize: 2 - instanceTypeOverrides: - - r6i.xlarge - - m5.xlarge diff --git a/helm/cluster-aws/ci/test-spot-instances.yaml b/helm/cluster-aws/ci/test-spot-instances.yaml index 5df39d0d..29cb4044 100644 --- a/helm/cluster-aws/ci/test-spot-instances.yaml +++ b/helm/cluster-aws/ci/test-spot-instances.yaml @@ -3,11 +3,11 @@ global: name: test-wc-minimal organization: test servicePriority: lowest + nodePools: + pool0: + maxSize: 2 + minSize: 2 + spotInstances: + enabled: true + maxPrice: 1.2 baseDomain: example.com -nodePools: - pool0: - maxSize: 2 - minSize: 2 - spotInstances: - enabled: true - maxPrice: 1.2 diff --git a/helm/cluster-aws/templates/_aws_cluster.tpl b/helm/cluster-aws/templates/_aws_cluster.tpl index 5936f967..c6058aad 100644 --- a/helm/cluster-aws/templates/_aws_cluster.tpl +++ b/helm/cluster-aws/templates/_aws_cluster.tpl @@ -93,7 +93,7 @@ spec: controlPlaneIAMInstanceProfile: control-plane-{{ include "resource.default.name" $ }} name: {{ include "aws-region" . }}-capa-{{ include "resource.default.name" $ }} nodesIAMInstanceProfiles: - {{- range $name, $value := .Values.nodePools | default .Values.internal.nodePools }} + {{- range $name, $value := .Values.global.nodePools | default .Values.internal.nodePools }} - nodes-{{ $name }}-{{ include "resource.default.name" $ }} {{- end }} region: {{ include "aws-region" . }} diff --git a/helm/cluster-aws/templates/_machine_pools.tpl b/helm/cluster-aws/templates/_machine_pools.tpl index 44b029ed..9bb5d027 100644 --- a/helm/cluster-aws/templates/_machine_pools.tpl +++ b/helm/cluster-aws/templates/_machine_pools.tpl @@ -1,5 +1,5 @@ {{- define "machine-pools" }} -{{- range $name, $value := .Values.nodePools | default .Values.internal.nodePools }} +{{- range $name, $value := .Values.global.nodePools | default .Values.internal.nodePools }} apiVersion: cluster.x-k8s.io/v1beta1 kind: MachinePool metadata: diff --git a/helm/cluster-aws/values.schema.json b/helm/cluster-aws/values.schema.json index 395ce0b5..0f93a9cb 100644 --- a/helm/cluster-aws/values.schema.json +++ b/helm/cluster-aws/values.schema.json @@ -744,6 +744,17 @@ "default": "highest" } } + }, + "nodePools": { + "type": "object", + "title": "Node pools", + "description": "Node pools of the cluster. If not specified, this defaults to the value of `internal.nodePools`.", + "additionalProperties": false, + "patternProperties": { + "^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$": { + "$ref": "#/$defs/machinePool" + } + } } } }, @@ -941,17 +952,6 @@ "title": "Management cluster", "description": "Name of the Cluster API cluster managing this workload cluster." }, - "nodePools": { - "type": "object", - "title": "Node pools", - "description": "Node pools of the cluster. If not specified, this defaults to the value of `internal.nodePools`.", - "additionalProperties": false, - "patternProperties": { - "^[a-z0-9][-a-z0-9]{3,18}[a-z0-9]$": { - "$ref": "#/$defs/machinePool" - } - } - }, "provider": { "type": "string", "title": "Cluster API provider name"