From f46e1fa09f22ae8fe49a239167c064239f34a457 Mon Sep 17 00:00:00 2001 From: Matt Pryor Date: Mon, 23 Aug 2021 17:25:57 +0100 Subject: [PATCH] Reinstate utils image with clusterctl also installed --- .github/workflows/publish-artifacts.yaml | 88 +++++++++++++++++++ .github/workflows/publish-helm-charts.yaml | 25 ------ .../openstack-cluster}/.helmignore | 0 .../openstack-cluster}/Chart.yaml | 0 .../openstack-cluster}/templates/_helpers.tpl | 0 .../templates/cluster-openstack.yaml | 0 .../openstack-cluster}/templates/cluster.yaml | 0 .../templates/control-plane-kubeadm.yaml | 0 .../control-plane-machine-template.yaml | 0 .../node-group-kubeadm-config-template.yaml | 0 .../node-group-machine-deployment.yaml | 0 .../node-group-machine-template.yaml | 0 .../templates/secret-cloud-config.yaml | 0 .../openstack-cluster}/values.yaml | 0 scripts/publish-charts.py | 86 ++++++++++-------- utils/Dockerfile | 60 +++++++++++++ utils/kubectl-shim | 10 +++ 17 files changed, 206 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/publish-artifacts.yaml delete mode 100644 .github/workflows/publish-helm-charts.yaml rename {openstack-cluster => charts/openstack-cluster}/.helmignore (100%) rename {openstack-cluster => charts/openstack-cluster}/Chart.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/_helpers.tpl (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/cluster-openstack.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/cluster.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/control-plane-kubeadm.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/control-plane-machine-template.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/node-group-kubeadm-config-template.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/node-group-machine-deployment.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/node-group-machine-template.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/templates/secret-cloud-config.yaml (100%) rename {openstack-cluster => charts/openstack-cluster}/values.yaml (100%) create mode 100644 utils/Dockerfile create mode 100644 utils/kubectl-shim diff --git a/.github/workflows/publish-artifacts.yaml b/.github/workflows/publish-artifacts.yaml new file mode 100644 index 0000000..7f023ac --- /dev/null +++ b/.github/workflows/publish-artifacts.yaml @@ -0,0 +1,88 @@ +name: Publish artifacts +# Run the tasks on every push +on: push +jobs: + build_push_utils_image: + name: Build and push utils image + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: all + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Set up Docker layer caching + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-api-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-api- + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Calculate metadata for image + id: image-meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/stackhpc/k8s-utils + # Produce the branch name or tag and the SHA as tags + tags: | + type=ref,event=branch + type=ref,event=tag + type=sha,prefix= + + - name: Build and push image + uses: docker/build-push-action@v2 + with: + context: ./utils + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.image-meta.outputs.tags }} + labels: ${{ steps.image-meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + # https://github.com/docker/buildx/pull/535 + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + publish_charts: + name: Publish Helm charts to GitHub pages + runs-on: ubuntu-latest + # We need the image to have been built (if required) and tagged before publishing charts + needs: build_push_utils_image + steps: + - name: Check out the repository + uses: actions/checkout@v2 + with: + # This is important for "git rev-list --count" to work correctly when + # determining the number of commits since the last tag + fetch-depth: 0 + + # Use an up-to-date version of Python for the script + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + + # This action packages and pushes the chart + - name: Publish charts + run: ./scripts/publish-charts.py + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish-helm-charts.yaml b/.github/workflows/publish-helm-charts.yaml deleted file mode 100644 index dd7b294..0000000 --- a/.github/workflows/publish-helm-charts.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Publish Helm charts -# Run the tasks on every push -on: push -jobs: - publish_charts: - name: Publish Helm charts to GitHub pages - runs-on: ubuntu-latest - steps: - - name: Check out the repository - uses: actions/checkout@v2 - with: - # This is important for "git rev-list --count" to work correctly when - # determining the number of commits since the last tag - fetch-depth: 0 - - # Use an up-to-date version of Python for the script - - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - # This action packages and pushes the chart - - name: Publish charts - run: ./scripts/publish-charts.py - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/openstack-cluster/.helmignore b/charts/openstack-cluster/.helmignore similarity index 100% rename from openstack-cluster/.helmignore rename to charts/openstack-cluster/.helmignore diff --git a/openstack-cluster/Chart.yaml b/charts/openstack-cluster/Chart.yaml similarity index 100% rename from openstack-cluster/Chart.yaml rename to charts/openstack-cluster/Chart.yaml diff --git a/openstack-cluster/templates/_helpers.tpl b/charts/openstack-cluster/templates/_helpers.tpl similarity index 100% rename from openstack-cluster/templates/_helpers.tpl rename to charts/openstack-cluster/templates/_helpers.tpl diff --git a/openstack-cluster/templates/cluster-openstack.yaml b/charts/openstack-cluster/templates/cluster-openstack.yaml similarity index 100% rename from openstack-cluster/templates/cluster-openstack.yaml rename to charts/openstack-cluster/templates/cluster-openstack.yaml diff --git a/openstack-cluster/templates/cluster.yaml b/charts/openstack-cluster/templates/cluster.yaml similarity index 100% rename from openstack-cluster/templates/cluster.yaml rename to charts/openstack-cluster/templates/cluster.yaml diff --git a/openstack-cluster/templates/control-plane-kubeadm.yaml b/charts/openstack-cluster/templates/control-plane-kubeadm.yaml similarity index 100% rename from openstack-cluster/templates/control-plane-kubeadm.yaml rename to charts/openstack-cluster/templates/control-plane-kubeadm.yaml diff --git a/openstack-cluster/templates/control-plane-machine-template.yaml b/charts/openstack-cluster/templates/control-plane-machine-template.yaml similarity index 100% rename from openstack-cluster/templates/control-plane-machine-template.yaml rename to charts/openstack-cluster/templates/control-plane-machine-template.yaml diff --git a/openstack-cluster/templates/node-group-kubeadm-config-template.yaml b/charts/openstack-cluster/templates/node-group-kubeadm-config-template.yaml similarity index 100% rename from openstack-cluster/templates/node-group-kubeadm-config-template.yaml rename to charts/openstack-cluster/templates/node-group-kubeadm-config-template.yaml diff --git a/openstack-cluster/templates/node-group-machine-deployment.yaml b/charts/openstack-cluster/templates/node-group-machine-deployment.yaml similarity index 100% rename from openstack-cluster/templates/node-group-machine-deployment.yaml rename to charts/openstack-cluster/templates/node-group-machine-deployment.yaml diff --git a/openstack-cluster/templates/node-group-machine-template.yaml b/charts/openstack-cluster/templates/node-group-machine-template.yaml similarity index 100% rename from openstack-cluster/templates/node-group-machine-template.yaml rename to charts/openstack-cluster/templates/node-group-machine-template.yaml diff --git a/openstack-cluster/templates/secret-cloud-config.yaml b/charts/openstack-cluster/templates/secret-cloud-config.yaml similarity index 100% rename from openstack-cluster/templates/secret-cloud-config.yaml rename to charts/openstack-cluster/templates/secret-cloud-config.yaml diff --git a/openstack-cluster/values.yaml b/charts/openstack-cluster/values.yaml similarity index 100% rename from openstack-cluster/values.yaml rename to charts/openstack-cluster/values.yaml diff --git a/scripts/publish-charts.py b/scripts/publish-charts.py index cd3f88f..a6f9113 100755 --- a/scripts/publish-charts.py +++ b/scripts/publish-charts.py @@ -60,12 +60,16 @@ SEMVER_REGEX = r"^v?(?P[0-9]+).(?P[0-9]+).(?P[0-9]+)(-(?P