Skip to content

Commit

Permalink
Merge branch 'flatcar-condtional-sections' into 'main'
Browse files Browse the repository at this point in the history
Flatcar condtional sections

See merge request catalystcloud/capi-helm-charts!6
  • Loading branch information
Travis Holton committed Jul 5, 2023
2 parents 7850c89 + 3cbb336 commit 095f920
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 115 deletions.
59 changes: 0 additions & 59 deletions .gitlab-ci.yml

This file was deleted.

38 changes: 0 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
## Catalyst cloud


Add dev channel to helm:
```
helm repo add dev-cc-capi-helm-charts \
--username <gitlab user> \
--password <gitlab password or token> \
https://gitlab.int.catalystcloud.nz/api/v4/projects/848/packages/helm/dev
```


Add stable channel:
```
helm repo add cc-capi-helm-charts \
--username <gitlab user> \
--password <gitlab password or token> \
https://gitlab.int.catalystcloud.nz/api/v4/projects/848/packages/helm/stable
```

Update the repo get any recent packages:
```
helm repo update cc-capi-helm-charts
```

Assuming you have all the necessary default values defined in `values.yml`, `clouds.yaml` etc. you can create a cluster as follows:
```
helm install lf-7 -f addons.yaml -f values.yaml -f clouds.yaml cc-capi-helm-charts/openstack-cluster
```


### Creating helm packages

* commits tagged with a semantic version on `${CI_DEFAULT_BRANCH}` (i.e. main) are published in the **stable** channel
* commits tagged with a semantic version on any branch other than the default branch are published to the **dev** channel


# capi-helm-charts
![Lint](https://github.com/stackhpc/capi-helm-charts/actions/workflows/lint.yaml/badge.svg?branch=main)
![Test Helm](https://github.com/stackhpc/capi-helm-charts/actions/workflows/install.yaml/badge.svg?branch=main)
Expand Down
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 095f920

Please sign in to comment.