diff --git a/charts/openstack-cluster/templates/_helpers.tpl b/charts/openstack-cluster/templates/_helpers.tpl index 4f107c344..e208e18e2 100644 --- a/charts/openstack-cluster/templates/_helpers.tpl +++ b/charts/openstack-cluster/templates/_helpers.tpl @@ -80,12 +80,19 @@ mirrors and additional packages. */}} {{- define "openstack-cluster.kubeadmConfigSpec" -}} {{- $ctx := index . 0 }} +{{/* WARN(travis) Ignition based images. */}} +{{- $ignitionBasedOS := $ctx.Values.ignitionBasedOS }} +{{- $ignitionContainerLinuxConfig := $ctx.Values.ignitionContainerLinuxConfig }} +{{- $ignitionPreKubeadmCommands := $ctx.Values.ignitionPreKubeadmCommands }} {{- $registryMirrors := $ctx.Values.registryMirrors }} {{- $additionalPackages := $ctx.Values.additionalPackages }} {{- $trustedCAs := $ctx.Values.trustedCAs }} {{- $kubeadmConfigSpec := omit (index . 1) "files" "preKubeadmCommands" }} {{- $files := index . 1 | dig "files" list }} {{- $preKubeadmCommands := index . 1 | dig "preKubeadmCommands" list }} +{{- if $ignitionBasedOS }} +{{- $kubeadmConfigSpec := mergeOverwrite $kubeadmConfigSpec $ctx.Values.ignitionKubeadmConfigSpec }} +{{- end }} {{- with $kubeadmConfigSpec }} {{- toYaml . }} @@ -134,7 +141,13 @@ files: - {{ toYaml . | nindent 4 }} {{- end }} {{- end }} -{{- if or $trustedCAs $additionalPackages $preKubeadmCommands }} +{{- if $ignitionBasedOS }} +{{/* WARN(travis) Ignition based images. */}} +{{- with $ignitionContainerLinuxConfig }} +{{- toYaml . }} +{{- end }} +{{- end }} +{{- if or $trustedCAs $additionalPackages $preKubeadmCommands $ignitionBasedOS }} preKubeadmCommands: {{- if $trustedCAs }} - update-ca-certificates @@ -146,8 +159,17 @@ preKubeadmCommands: {{- range $preKubeadmCommands }} - {{ . }} {{- end }} + {{- range $ignitionPreKubeadmCommands }} + - {{ . }} + {{- end }} +{{- end }} {{- end }} +{{/* WARN(travis) Ignition based images */}} +{{- if .Values.ignitionBasedOS }} +{{- with .Values.ignitionContainerLinuxConfig }} +{{ toYaml . }} {{- end }} +{{- end}} {{/* Produces the image for the cluster autoscaler. diff --git a/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml b/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml index 31fe40a70..58e73899f 100644 --- a/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml +++ b/charts/openstack-cluster/templates/control-plane/kubeadm-control-plane.yaml @@ -14,6 +14,10 @@ option of InitConfiguration and specifying a KubeProxyConfiguration. {{- $initConfiguration := omit (index . 1 | dig "initConfiguration" dict) "skipPhases" }} {{- $skipPhases := index . 1 | dig "initConfiguration" "skipPhases" list }} {{- $kubeProxyConfiguration := index . 1 | dig "kubeProxyConfiguration" dict }} +{{- $ignitionBasedOS := $ctx.Values.ignitionBasedOS }} +{{- if $ignitionBasedOS }} +{{- $initConfiguration := mergeOverwrite $initConfiguration $ctx.Values.ignitionInitConfiguration }} +{{- end}} {{- $files := index . 1 | dig "files" list }} {{- $preKubeadmCommands := index . 1 | dig "preKubeadmCommands" list }} @@ -58,9 +62,11 @@ preKubeadmCommands: {{- if $skipPhases }} - cat /run/kubeadm/skip-phases.yaml >> /run/kubeadm/kubeadm.yaml {{- end }} + {{- if not $ignitionBasedOS }} {{- if $kubeProxyConfiguration }} - cat /run/kubeadm/kube-proxy-configuration.yaml >> /run/kubeadm/kubeadm.yaml {{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/openstack-cluster/values.yaml b/charts/openstack-cluster/values.yaml index cf3983673..dc936c831 100644 --- a/charts/openstack-cluster/values.yaml +++ b/charts/openstack-cluster/values.yaml @@ -24,6 +24,38 @@ cloudName: openstack # This should match the version of kubelet and kubeadm in the image kubernetesVersion: +# WARN(travis) Ignition based images +ignitionBasedOS: false +ignitionInitConfiguration: + nodeRegistration: + name: ${COREOS_OPENSTACK_HOSTNAME} +ignitionKubeadmConfigSpec: + joinConfiguration: + nodeRegistration: + name: ${COREOS_OPENSTACK_HOSTNAME} +ignitionPreKubeadmCommands: + - export COREOS_OPENSTACK_HOSTNAME=${COREOS_OPENSTACK_HOSTNAME%.*} + - envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp + - mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml +ignitionContainerLinuxConfig: + format: ignition + ignition: + containerLinuxConfig: + additionalConfig: | + systemd: + units: + - name: coreos-metadata-sshkeys@.service + enabled: true + - name: kubeadm.service + enabled: true + dropins: + - name: 10-flatcar.conf + contents: | + [Unit] + Requires=containerd.service coreos-metadata.service + After=containerd.service coreos-metadata.service + [Service] + EnvironmentFile=/run/metadata/flatcar # The name of the image to use for cluster machines machineImage: # OR