diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 33b30e3..503ba61 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,7 @@ on: jobs: publish-bundle: name: Build and push bundle image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 permissions: contents: 'read' id-token: 'write' @@ -45,7 +45,7 @@ jobs: username: mjgpluralsh password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: "." file: "./bundle.Dockerfile" @@ -59,7 +59,7 @@ jobs: GIT_COMMIT=${{ github.sha }} publish-cli: name: Build and push CLI image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 permissions: contents: 'read' id-token: 'write' @@ -94,7 +94,7 @@ jobs: username: mjgpluralsh password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: "." file: "./cli.Dockerfile" diff --git a/cli.Dockerfile b/cli.Dockerfile index be4769c..f7428e8 100644 --- a/cli.Dockerfile +++ b/cli.Dockerfile @@ -18,3 +18,5 @@ ARG TARGETARCH COPY --from=build --chmod=755 /plural . COPY --from=build --chmod=755 /linux-${TARGETARCH}/helm . + +ENTRYPOINT [ "/plural" ] \ No newline at end of file diff --git a/osbuilder/plural.yaml b/osbuilder/plural.yaml index a4cfcd2..386adcb 100644 --- a/osbuilder/plural.yaml +++ b/osbuilder/plural.yaml @@ -5,7 +5,7 @@ metadata: stringData: userdata: | #cloud-config - hostname: metal-{{ trunc 4 .MachineID }} + hostname: plural-edge-{{ trunc 10 .MachineID }} users: - name: "kairos" passwd: "kairos" @@ -20,6 +20,9 @@ stringData: - name: "Init" commands: - chmod 755 /etc/rancher/k3s/k3s.yaml + bundles: + - targets: + - run://ghcr.io/pluralsh/kairos-plural-bundle:latest plural: token: "" url: console.plrl-dev-aws.onplural.sh diff --git a/run.sh b/run.sh index bd2f2fc..5fa6cb1 100644 --- a/run.sh +++ b/run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -ex @@ -9,7 +9,7 @@ K3S_MANIFEST_DIR=${K3S_MANIFEST_DIR:-/var/lib/rancher/k3s/server/manifests/} BASE_IMAGE="ghcr.io/pluralsh/plural-cli-cloud:0.11.1" TOKEN="" URL="" -CLUSTER_NAME="plural-edge" +CLUSTER_NAME_PREFIX="plural-edge" PROJECT="default" TAG="plural=edge" @@ -26,7 +26,7 @@ templ() { local file="$3" local value="$2" local sentinel="$1" - sed -i "s/@${sentinel}@/$(sed -e 's/[&\\/]/\\&/g; s/$/\\/' -e '$s/\\$//' <<<"${value}")/g" "${file}" + sed -i "s/@${sentinel}@/$(echo "${value}" | sed -e 's/[&\\/]/\\&/g; s/$/\\/' -e '$s/\\$//')/g" "${file}" } readConfig() { @@ -45,9 +45,9 @@ readConfig() { URL=$_url fi - _clusterName=$(getConfig plural.clusterName) - if [ "$_clusterName" != "" ]; then - CLUSTER_NAME=$_clusterName + _clusterNamePrefix=$(getConfig plural.clusterNamePrefix) + if [ "$_clusterNamePrefix" != "" ]; then + CLUSTER_NAME_PREFIX=$_clusterNamePrefix fi _project=$(getConfig plural.project) @@ -70,7 +70,7 @@ for FILE in assets/*; do templ "BASE_IMAGE" "${BASE_IMAGE}" "${FILE}" templ "TOKEN" "${TOKEN}" "${FILE}" templ "URL" "${URL}" "${FILE}" - templ "CLUSTER_NAME" "${CLUSTER_NAME}" "${FILE}" + templ "CLUSTER_NAME" "${CLUSTER_NAME_PREFIX}-$(cut -c1-10 < /etc/machine-id)" "${FILE}" templ "PROJECT" "${PROJECT}" "${FILE}" templ "TAG" "${TAG}" "${FILE}" done;