2021-09-06 15:14:56 +01:00
|
|
|
{{- range $nodeGroupOverrides := .Values.nodeGroups }}
|
|
|
|
{{- $nodeGroup := deepCopy $.Values.nodeGroupDefaults | mustMerge $nodeGroupOverrides }}
|
2021-08-26 10:40:10 +01:00
|
|
|
---
|
2021-11-17 10:02:06 +00:00
|
|
|
apiVersion: cluster.x-k8s.io/v1beta1
|
2021-08-26 10:40:10 +01:00
|
|
|
kind: MachineDeployment
|
|
|
|
metadata:
|
|
|
|
name: {{ include "openstack-cluster.componentName" (list $ $nodeGroup.name) }}
|
2022-09-22 11:23:14 +01:00
|
|
|
labels:
|
|
|
|
{{- include "openstack-cluster.componentLabels" (list $ "worker") | nindent 4 }}
|
|
|
|
capi.stackhpc.com/node-group: {{ $nodeGroup.name }}
|
2022-03-22 14:14:46 +00:00
|
|
|
{{- if $nodeGroup.autoscale }}
|
|
|
|
{{-
|
|
|
|
$machineCountMin := $nodeGroup.machineCountMin |
|
|
|
|
required (printf "no minimum machine count specified for node group '%s'" $nodeGroup.name)
|
|
|
|
}}
|
|
|
|
{{- if lt $machineCountMin 1.0 }}
|
|
|
|
{{- fail "autoscaling node groups with a minimum machine count < 1 are not currently supported" }}
|
|
|
|
{{- end }}
|
|
|
|
{{-
|
|
|
|
$machineCountMax := $nodeGroup.machineCountMax |
|
|
|
|
required (printf "no maximum machine count specified for node group '%s'" $nodeGroup.name)
|
|
|
|
}}
|
|
|
|
{{- if lt $machineCountMax $machineCountMin }}
|
|
|
|
{{- fail (printf "maximum machine count < minimum machine count for node group '%s'" $nodeGroup.name) }}
|
|
|
|
{{- end }}
|
2022-08-03 13:01:44 +01:00
|
|
|
annotations:
|
2022-03-22 14:14:46 +00:00
|
|
|
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: {{ quote $machineCountMin }}
|
|
|
|
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: {{ quote $machineCountMax }}
|
|
|
|
{{- end }}
|
2021-08-26 10:40:10 +01:00
|
|
|
spec:
|
|
|
|
clusterName: {{ include "openstack-cluster.clusterName" $ }}
|
2022-03-22 14:14:46 +00:00
|
|
|
{{- if not $nodeGroup.autoscale }}
|
2021-08-26 10:40:10 +01:00
|
|
|
replicas: {{ $nodeGroup.machineCount | required (printf "no machine count specified for node group '%s'" $nodeGroup.name) }}
|
2022-03-22 14:14:46 +00:00
|
|
|
{{- end }}
|
2022-01-11 17:09:34 +00:00
|
|
|
strategy: {{ toYaml $nodeGroup.rolloutStrategy | nindent 4 }}
|
2021-08-26 10:40:10 +01:00
|
|
|
selector:
|
2022-09-22 11:23:14 +01:00
|
|
|
matchLabels:
|
|
|
|
{{- include "openstack-cluster.componentSelectorLabels" (list $ "worker") | nindent 6 }}
|
|
|
|
capi.stackhpc.com/node-group: {{ $nodeGroup.name }}
|
2021-08-26 10:40:10 +01:00
|
|
|
template:
|
|
|
|
metadata:
|
2022-09-22 11:23:14 +01:00
|
|
|
labels:
|
|
|
|
{{- include "openstack-cluster.componentSelectorLabels" (list $ "worker") | nindent 8 }}
|
|
|
|
capi.stackhpc.com/node-group: {{ $nodeGroup.name }}
|
2021-08-26 10:40:10 +01:00
|
|
|
spec:
|
|
|
|
clusterName: {{ include "openstack-cluster.clusterName" $ }}
|
2022-01-19 15:34:54 +00:00
|
|
|
version: {{ $.Values.global.kubernetesVersion }}
|
2022-08-01 17:50:23 +01:00
|
|
|
{{- with $nodeGroup.failureDomain }}
|
|
|
|
failureDomain: {{ . }}
|
|
|
|
{{- end }}
|
2021-08-26 10:40:10 +01:00
|
|
|
bootstrap:
|
|
|
|
configRef:
|
2021-11-17 10:02:06 +00:00
|
|
|
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
|
2021-08-26 10:40:10 +01:00
|
|
|
kind: KubeadmConfigTemplate
|
2021-09-02 12:19:53 +01:00
|
|
|
name: {{ include "openstack-cluster.nodegroup.kct.name" (list $ $nodeGroup) }}
|
2021-08-26 10:40:10 +01:00
|
|
|
infrastructureRef:
|
2022-08-01 17:50:23 +01:00
|
|
|
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
|
2021-08-26 10:40:10 +01:00
|
|
|
kind: OpenStackMachineTemplate
|
2021-09-01 11:20:23 +01:00
|
|
|
name: {{ include "openstack-cluster.nodegroup.mt.name" (list $ $nodeGroup) }}
|
2022-01-11 17:09:34 +00:00
|
|
|
nodeDrainTimeout: {{ $nodeGroup.nodeDrainTimeout }}
|
2021-08-26 10:40:10 +01:00
|
|
|
{{- end }}
|