Skip to content

Commit

Permalink
Add missing machine template to KubeadmControlPlane
Browse files Browse the repository at this point in the history
  • Loading branch information
nprokopic committed Oct 21, 2023
1 parent bc2f86d commit 1b9a3e2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
6 changes: 6 additions & 0 deletions helm/cluster/ci/ci-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ internal:
postKubeadmCommands:
- echo "hello control plane after kubeadm"
- echo "cluster control plane after kubeadm"
resources:
infrastructureMachineTemplate:
group: infrastructure.cluster.x-k8s.io
version: v1beta1
kind: AWSMachineTemplate
infrastructureMachineTemplateSpecTemplateName: "cluster.internal.test.controlPlane.machineTemplate.spec"
components:
kubelet:
gracefulNodeShutdown:
Expand Down
8 changes: 8 additions & 0 deletions helm/cluster/templates/clusterapi/controlplane/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- define "cluster.internal.test.controlPlane.machineTemplate.spec" -}}
template:
metadata:
cluster.x-k8s.io/role: controlPlane
{{- include "cluster.labels.common" $ | nindent 4 }}
spec:
machineType: "superBig"
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ metadata:
{{- end }}
labels:
{{- include "cluster.labels.common" $ | nindent 4 }}
{{- if $.Values.global.metadata.labels }}
{{- range $key, $val := $.Values.global.metadata.labels }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
{{- include "cluster.labels.custom" $ | indent 4 }}
name: {{ include "cluster.resource.name" $ }}
namespace: {{ .Release.Namespace }}
spec:
version: v{{ trimPrefix "v" .Values.internal.kubernetesVersion }}
machineTemplate:
metadata:
labels:
{{- include "cluster.labels.common" $ | nindent 8 }}
{{- include "cluster.labels.custom" $ | indent 8 }}
infrastructureRef:
apiVersion: {{ $.Values.internal.controlPlane.resources.infrastructureMachineTemplate.group }}/{{ $.Values.internal.controlPlane.resources.infrastructureMachineTemplate.version }}
kind: {{ $.Values.internal.controlPlane.resources.infrastructureMachineTemplate.kind }}
name: {{ include "cluster.resource.name" $ }}-control-plane-{{ include "cluster.data.hash" (dict "data" (include $.Values.internal.controlPlane.resources.infrastructureMachineTemplateSpecTemplateName $) "salt" $.Values.internal.hashSalt) }}
kubeadmConfigSpec:
format: ignition
ignition:
Expand Down Expand Up @@ -51,4 +55,6 @@ spec:
{{- include "cluster.internal.controlPlane.kubeadm.postKubeadmCommands" $ | indent 4 }}
users:
{{- include "cluster.internal.kubeadm.users" $ | indent 4 }}
replicas: {{ .Values.global.controlPlane.replicas }}
version: v{{ trimPrefix "v" .Values.internal.kubernetesVersion }}
{{- end }}
12 changes: 11 additions & 1 deletion helm/cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,9 @@
"title": "Resources configuration",
"description": "GVK and other configuration for control plane resources.",
"required": [
"controlPlane"
"controlPlane",
"infrastructureMachineTemplate",
"infrastructureMachineTemplateSpecTemplateName"
],
"additionalProperties": false,
"properties": {
Expand All @@ -1310,6 +1312,14 @@
"version": "v1beta1"
}
}
},
"infrastructureMachineTemplate": {
"$ref": "#/$defs/infrastructureMachineTemplate"
},
"infrastructureMachineTemplateSpecTemplateName": {
"type": "string",
"title": "Infrastructure Machine template spec template name",
"description": "The name of Helm template that renders Infrastructure Machine template spec."
}
}
}
Expand Down

0 comments on commit 1b9a3e2

Please sign in to comment.