diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index a8b31fb7..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -include: - - remote: https://gitlab.int.catalystcloud.nz/catalystcloud/gitlab-build-tools/raw/main/templates/docker-setup.gitlab-ci.yml - -stages: - - template - - package - - publish - -.helm_publish_jobs: - image: gitlab.int.catalystcloud.nz:4567/catalystcloud/helm-environment:20230606T015011Z - before_script: - - cd ${CI_PROJECT_DIR}/charts/openstack-cluster - - export CHART_VERSION=$(git describe --tags) - rules: - - if: $CI_COMMIT_TAG && $CI_COMMIT_REF_NAME =~ /^\d+\.\d+\.\d+.*$/ - - -helm_package: - extends: .helm_publish_jobs - stage: package - script: - - helm dependency build ${CI_PROJECT_DIR}/charts/openstack-cluster - - helm package --app-version $(git describe --always) --version ${CHART_VERSION} ${CI_PROJECT_DIR}/charts/openstack-cluster - artifacts: - paths: - - "${CI_PROJECT_DIR}/charts/openstack-cluster/openstack-cluster-*.tgz" - -.publish_chart: - extends: .helm_publish_jobs - stage: publish - script: - # NOTE(travis) push to both gitlab helm repo and OCI for now. Since OCI has no search function it might be useful - # to have a place to browse packages. - - > - curl --request POST - --form chart=@${CI_PROJECT_DIR}/charts/openstack-cluster/openstack-cluster-${CHART_VERSION}.tgz - --user gitlab-ci-token:${CI_JOB_TOKEN} - ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/${HELM_CHANNEL}/charts - - > - helm push - ${CI_PROJECT_DIR}/charts/openstack-cluster/openstack-cluster-${CHART_VERSION}.tgz oci://internal.oci-registry.nz-por-1.catalystcloud.nz/v2/openstack-cluster/${HELM_CHANNEL} - dependencies: - - helm_package -# NOTE(travis) Alternately publish chart to "dev" or "stable" channel depending if commit tag is on the default branch. -publish_chart_dev: - extends: .publish_chart - variables: - HELM_CHANNEL: dev - rules: - - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_COMMIT_REF_NAME =~ /^\d+\.\d+\.\d+.*$/ - - -publish_chart_prod: - extends: .publish_chart - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_REF_NAME =~ /^\d+\.\d+\.\d+.*$/ - variables: - HELM_CHANNEL: stable diff --git a/README.md b/README.md index 6efc4006..4de8966f 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,3 @@ -## Catalyst cloud - - -Add dev channel to helm: -``` -helm repo add dev-cc-capi-helm-charts \ - --username \ - --password \ - https://gitlab.int.catalystcloud.nz/api/v4/projects/848/packages/helm/dev -``` - - -Add stable channel: -``` - -helm repo add cc-capi-helm-charts \ - --username \ - --password \ - 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) diff --git a/charts/cluster-addons/values.yaml b/charts/cluster-addons/values.yaml index 2ef1e548..14752319 100644 --- a/charts/cluster-addons/values.yaml +++ b/charts/cluster-addons/values.yaml @@ -203,7 +203,7 @@ monitoring: requests: storage: 10Gi lokiStack: - enabled: true + enabled: false chart: repo: https://grafana.github.io/helm-charts name: loki-stack @@ -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 @@ -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 @@ -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 diff --git a/charts/openstack-cluster/templates/_helpers.tpl b/charts/openstack-cluster/templates/_helpers.tpl index a80ae8bd..e208e18e 100644 --- a/charts/openstack-cluster/templates/_helpers.tpl +++ b/charts/openstack-cluster/templates/_helpers.tpl @@ -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 . }} @@ -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 @@ -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}} 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 14f84f33..2882cf21 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,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 }} diff --git a/charts/openstack-cluster/values.yaml b/charts/openstack-cluster/values.yaml index f639be7d..75015583 100644 --- a/charts/openstack-cluster/values.yaml +++ b/charts/openstack-cluster/values.yaml @@ -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: