Skip to content

Commit

Permalink
Add nodetags (#929)
Browse files Browse the repository at this point in the history
* add nodetags

* normalize

* fix global variables

* Update helm/cluster-aws/templates/_machine_pools.tpl

Co-authored-by: Marco Ebert <[email protected]>

* Update helm/cluster-aws/templates/_control_plane.tpl

Co-authored-by: Marco Ebert <[email protected]>

* add changelog

* Update CHANGELOG.md

Co-authored-by: Jose Armesto <[email protected]>

---------

Co-authored-by: Marco Ebert <[email protected]>
Co-authored-by: Jose Armesto <[email protected]>
  • Loading branch information
3 people authored Nov 12, 2024
1 parent 662e526 commit 8285d78
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `global.providerSpecific.additionalNodeTags`. Field used to specify tags applied to nodes only.

### Fixed

- Only try to render subnet tags if they are defined by the user.
Expand Down
2 changes: 2 additions & 0 deletions helm/cluster-aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Properties within the `.global.providerSpecific` object

| **Property** | **Description** | **More Details** |
| :----------- | :-------------- | :--------------- |
| `global.providerSpecific.additionalNodeTags` | **Additional node tags** - Additional tags to add to AWS nodes created by the cluster.|**Type:** `object`<br/>|
| `global.providerSpecific.additionalNodeTags.*` | **Tag value**|**Type:** `string`<br/>**Value pattern:** `^[ a-zA-Z0-9\._:/=+-@]+$`<br/>|
| `global.providerSpecific.additionalResourceTags` | **Additional resource tags** - Additional tags to add to AWS resources created by the cluster.|**Type:** `object`<br/>|
| `global.providerSpecific.additionalResourceTags.*` | **Tag value**|**Type:** `string`<br/>**Value pattern:** `^[ a-zA-Z0-9\._:/=+-@]+$`<br/>|
| `global.providerSpecific.ami` | **Amazon machine image (AMI)** - If specified, this image will be used to provision EC2 instances.|**Type:** `string`<br/>|
Expand Down
3 changes: 3 additions & 0 deletions helm/cluster-aws/templates/_control_plane.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Any changes to this will trigger the resource to be recreated rather than attemp
*/}}
{{- define "controlplane-awsmachinetemplate-spec" -}}
{{- include "ami" $ }}
{{- if $.Values.global.providerSpecific.additionalNodeTags }}
additionalTags: {{ toYaml $.Values.global.providerSpecific.additionalNodeTags | nindent 2 }}
{{- end }}
cloudInit: {}
instanceType: {{ .Values.global.controlPlane.instanceType }}
nonRootVolumes:
Expand Down
3 changes: 3 additions & 0 deletions helm/cluster-aws/templates/_machine_pools.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ spec:
additionalTags:
k8s.io/cluster-autoscaler/enabled: "true"
giantswarm.io/machinepool: {{ $name }}
{{- if $.Values.global.providerSpecific.additionalNodeTags }}
{{- toYaml $.Values.global.providerSpecific.additionalNodeTags | nindent 4 }}
{{- end}}
availabilityZones: {{ include "aws-availability-zones" (dict "mp" $value "Values" $.Values "Files" $.Files) | nindent 2 }}
subnets:
- filters:
Expand Down
8 changes: 8 additions & 0 deletions helm/cluster-aws/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,14 @@
"title": "AWS settings",
"additionalProperties": false,
"properties": {
"additionalNodeTags": {
"type": "object",
"title": "Additional node tags",
"description": "Additional tags to add to AWS nodes created by the cluster.",
"additionalProperties": {
"$ref": "#/$defs/awsResourceTagValue"
}
},
"additionalResourceTags": {
"type": "object",
"title": "Additional resource tags",
Expand Down

0 comments on commit 8285d78

Please sign in to comment.