Support additional block devices for nodes (#92)

* Changes to support node data disks

* Fix example values

* Enable config drive if data volumes are enabled, as it is required for /dev/disk/openstack/by-tag

* Fix broken space characters

* Tweaks to match the released options

* Fix typo in machine templates
This commit is contained in:
Matt Pryor 2024-01-18 15:31:31 +00:00 committed by GitHub
parent 4cf8672e73
commit 9e2bd75dff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 67 additions and 0 deletions

View File

@ -13,6 +13,9 @@ template:
{{- with .Values.machineSSHKeyName }}
sshKeyName: {{ . }}
{{- end }}
{{- if or .Values.controlPlane.machineConfigDrive .Values.controlPlane.additionalBlockDevices }}
configDrive: true
{{- end }}
{{- if .Values.controlPlane.machineRootVolume.diskSize }}
rootVolume: {{ toYaml .Values.controlPlane.machineRootVolume | nindent 6 }}
{{- end }}
@ -27,6 +30,24 @@ template:
{{- else }}
{{- fail "Either controlPlane.machineImageId, controlPlane.machineImage, machineImage or machineImageId is required" }}
{{- end }}
{{- with .Values.controlPlane.additionalBlockDevices }}
additionalBlockDevices:
{{- range $name, $blockDevice := . }}
- name: {{ $name }}
sizeGiB: {{ required "size is required for a block device" $blockDevice.size }}
storage:
type: {{ default "Volume" $blockDevice.type }}
{{- if or $blockDevice.volumeType $blockDevice.availabilityZone }}
volume:
{{- with $blockDevice.volumeType }}
type: {{ . }}
{{- end }}
{{- with $blockDevice.availabilityZone }}
availabilityZone: {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.controlPlane.machineNetworking.ports }}
ports: {{ toYaml . | nindent 6 }}
{{- end }}

View File

@ -15,6 +15,9 @@ template:
{{- with $ctx.Values.machineSSHKeyName }}
sshKeyName: {{ . }}
{{- end }}
{{- if or $nodeGroup.machineConfigDrive $nodeGroup.additionalBlockDevices }}
configDrive: true
{{- end }}
{{- if $nodeGroup.machineRootVolume.diskSize }}
rootVolume: {{ toYaml $nodeGroup.machineRootVolume | nindent 6 }}
{{- end }}
@ -29,6 +32,24 @@ template:
{{- else }}
{{- fail "Either nodeGroupDefaults.machineImageId, nodeGroupDefaults.machineImage, machineImageId or machineImage is required" }}
{{- end }}
{{- with $nodeGroup.additionalBlockDevices }}
additionalBlockDevices:
{{- range $name, $blockDevice := . }}
- name: {{ $name }}
sizeGiB: {{ required "size is required for a block device" $blockDevice.size }}
storage:
type: {{ default "Volume" $blockDevice.type }}
{{- if or $blockDevice.volumeType $blockDevice.availabilityZone }}
volume:
{{- with $blockDevice.volumeType }}
type: {{ . }}
{{- end }}
{{- with $blockDevice.availabilityZone }}
availabilityZone: {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with $nodeGroup.machineNetworking.ports }}
ports: {{ toYaml . | nindent 6 }}
{{- end }}

View File

@ -175,6 +175,26 @@ controlPlane:
# Labels to apply to the node objects in Kubernetes that correspond to control plane machines
nodeLabels:
# my.company.org/label: value
# Additional block devices for control plane machines
additionalBlockDevices: {}
# # The key is the name for the block device in the context of the machine
# # It is also used to tag the block device, so that the volume can be identified in instance metadata
# etcd:
# # The size of the block device
# size: 20
# # The type of the block device
# # If set to "Volume", which is the default, then a Cinder volume is used to back the block device
# # If set to "Local", local ephemeral storage is used to back the block device
# # In both cases, the lifecycle of the device is the same as the machine
# type: Volume
# # The volume type to use
# # If not specified, the default volume type is used
# volumeType:
# # The volume availability zone to use
# # If not specified, the machine availability zone is used
# availabilityZone:
# Indicates whether control plane machines should use config drive or not
machineConfigDrive: false
# The time to wait for a node to finish draining before it can be removed
nodeDrainTimeout: 5m0s
# The time to wait for a node to detach all volumes before it can be removed
@ -283,6 +303,11 @@ nodeGroupDefaults:
# By default, nodes get the label "capi.stackhpc.com/node-group=<node group name>"
nodeLabels:
# my.company.org/label: value
# Additional block devices for node groups machines
# Options are the same as for controlPlane.additionalBlockDevices above
additionalBlockDevices: {}
# Indicates whether control plane machines should use config drive or not
machineConfigDrive: false
# The time to wait for a node to finish draining before it can be removed
nodeDrainTimeout: 5m0s
# The time to wait for a node to detach all volumes before it can be removed