Skip to content

Commit

Permalink
Flatcar based clusters
Browse files Browse the repository at this point in the history
* Override name used for init and join configurations on flatcar
* Use a dictionary merge to selectively replace the name field with
  CORES_OPENSTACK_HOSTNAME when flatcarOS is true
* disable some subcharts by default
* Change flatcar to more agnostic term "ignitionBased"
  • Loading branch information
Travis Holton committed Jul 4, 2023
1 parent 7850c89 commit 3cbb336
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 18 deletions.
8 changes: 4 additions & 4 deletions charts/cluster-addons/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ monitoring:
requests:
storage: 10Gi
lokiStack:
enabled: true
enabled: false
chart:
repo: https://grafana.github.io/helm-charts
name: loki-stack
Expand All @@ -227,7 +227,7 @@ monitoring:
# https://github.com/kubernetes-sigs/node-feature-discovery/tree/master/deployment/helm/node-feature-discovery
nodeFeatureDiscovery:
# Indicates if node feature discovery should be enabled
enabled: true
enabled: false
chart:
repo: https://kubernetes-sigs.github.io/node-feature-discovery/charts
name: node-feature-discovery
Expand All @@ -242,7 +242,7 @@ nvidiaGPUOperator:
# Note that because it uses node feature discovery to run only on nodes
# with an NVIDIA GPU available, the overhead of enabling this on clusters
# that do not need it now but may need it in the future is low
enabled: true
enabled: false
chart:
repo: https://nvidia.github.io/gpu-operator
name: gpu-operator
Expand All @@ -257,7 +257,7 @@ mellanoxNetworkOperator:
# Note that because it uses node feature discovery to run only on nodes
# with a Mellanox NIC available, the overhead of enabling this on clusters
# that do not need it now but may need it in the future is low
enabled: true
enabled: false
chart:
repo: https://mellanox.github.io/network-operator
name: network-operator
Expand Down
27 changes: 17 additions & 10 deletions charts/openstack-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,19 @@ mirrors and additional packages.
*/}}
{{- define "openstack-cluster.kubeadmConfigSpec" -}}
{{- $ctx := index . 0 }}
{{/* WARN(travis) Flatcar is experimental. Do not merge yet! */}}
{{- $flatcarOS := $ctx.Values.flatcarOS }}
{{- $flatcarContainerLinuxConfig := $ctx.Values.flatcarContainerLinuxConfig }}
{{/* 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 . }}
Expand Down Expand Up @@ -137,13 +141,13 @@ files:
- {{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if $flatcarOS }}
{{/* WARN(travis) Flatcar based images. */}}
{{- with $flatcarContainerLinuxConfig }}
{{- if $ignitionBasedOS }}
{{/* WARN(travis) Ignition based images. */}}
{{- with $ignitionContainerLinuxConfig }}
{{- toYaml . }}
{{- end }}
{{- end }}
{{- if or $trustedCAs $additionalPackages $preKubeadmCommands $flatcarOS }}
{{- if or $trustedCAs $additionalPackages $preKubeadmCommands $ignitionBasedOS }}
preKubeadmCommands:
{{- if $trustedCAs }}
- update-ca-certificates
Expand All @@ -155,11 +159,14 @@ preKubeadmCommands:
{{- range $preKubeadmCommands }}
- {{ . }}
{{- end }}
{{- range $ignitionPreKubeadmCommands }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{/* WARN(travis) Flatcar based images */}}
{{- if .Values.flatcarOS }}
{{- with .Values.flatcarContainerLinuxConfig }}
{{/* WARN(travis) Ignition based images */}}
{{- if .Values.ignitionBasedOS }}
{{- with .Values.ignitionContainerLinuxConfig }}
{{ toYaml . }}
{{- end }}
{{- end}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -58,7 +62,7 @@ preKubeadmCommands:
{{- if $skipPhases }}
- cat /run/kubeadm/skip-phases.yaml >> /run/kubeadm/kubeadm.yaml
{{- end }}
{{- if not $ctx.Values.flatcarOS }}
{{- if not $ignitionBasedOS }}
{{- if $kubeProxyConfiguration }}
- cat /run/kubeadm/kube-proxy-configuration.yaml >> /run/kubeadm/kubeadm.yaml
{{- end }}
Expand Down
17 changes: 14 additions & 3 deletions charts/openstack-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@ cloudName: openstack
# This should match the version of kubelet and kubeadm in the image
kubernetesVersion:

# WARN(travis) Flatcar based images
flatcarOS: false
flatcarContainerLinuxConfig:
# 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:
Expand Down

0 comments on commit 3cbb336

Please sign in to comment.