diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 978932e..659ef31 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -8,7 +8,6 @@ env: KUBECONFORM_VERSION: v0.7.0 KUBECTL_VERSION: v1.36.3 METALLB_VERSION: v0.16.0 - METALLB_MANIFEST_SHA256: b0b9be2802f10aa32d45308b4457d06cde0c70544712c8d0cf5511657ffd2b69 KUBERNETES_API: https://host.containers.internal:6443 KUBERNETES_TLS_SERVER_NAME: 192.168.0.2 NAMESPACE: metallb-system @@ -29,9 +28,8 @@ jobs: curl --fail --silent --show-error --location \ --output "${RUNNER_TEMP}/metallb-native.yaml" \ "https://raw.githubusercontent.com/metallb/metallb/${METALLB_VERSION}/config/manifests/metallb-native.yaml" - printf '%s %s\n' "${METALLB_MANIFEST_SHA256}" "${RUNNER_TEMP}/metallb-native.yaml" | sha256sum --check docker run --rm --interactive \ - "ghcr.io/yannh/kubeconform:${KUBECONFORM_VERSION}@sha256:85dbef6b4b312b99133decc9c6fc9495e9fc5f92293d4ff3b7e1b30f5611823c" \ + "ghcr.io/yannh/kubeconform:${KUBECONFORM_VERSION}" \ -strict -ignore-missing-schemas -summary < "${RUNNER_TEMP}/metallb-native.yaml" deploy: @@ -48,10 +46,6 @@ jobs: curl --fail --silent --show-error --location \ --output "${RUNNER_TEMP}/kubectl" \ "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" - curl --fail --silent --show-error --location \ - --output "${RUNNER_TEMP}/kubectl.sha256" \ - "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256" - printf '%s %s\n' "$(cat "${RUNNER_TEMP}/kubectl.sha256")" "${RUNNER_TEMP}/kubectl" | sha256sum --check chmod 0700 "${RUNNER_TEMP}/kubectl" - name: Configure Kubernetes access diff --git a/README.md b/README.md index e0a9e15..ffa4ce9 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ The files contain no credentials. The private LAN address range is infrastructure information, so decide whether that disclosure is acceptable before publishing the repository. -The installer verifies the upstream manifest against the committed SHA-256 -checksum before applying it, waits for the controller and all speakers, and +The installer downloads the manifest for its pinned upstream version, applies +it, waits for the controller and all speakers, and then applies `metallb.yaml`. ## Gitea Actions CI/CD Every push and pull request validates the scripts, the site-specific resources, -and the downloaded upstream manifest against its pinned checksum. A successful +and the downloaded upstream manifest. A successful push to `main` applies `metallb.yaml` and verifies that both the controller and all speaker pods are ready. diff --git a/install.sh b/install.sh index 5af373e..e59e238 100755 --- a/install.sh +++ b/install.sh @@ -4,11 +4,10 @@ set -eu METALLB_VERSION=v0.16.0 METALLB_MANIFEST_URL="https://raw.githubusercontent.com/metallb/metallb/$METALLB_VERSION/config/manifests/metallb-native.yaml" -METALLB_MANIFEST_SHA256=b0b9be2802f10aa32d45308b4457d06cde0c70544712c8d0cf5511657ffd2b69 NAMESPACE=metallb-system SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) -for command in curl kubectl sha256sum; do +for command in curl kubectl; do if ! command -v "$command" >/dev/null 2>&1; then echo "Required command not found: $command" >&2 exit 1 @@ -20,8 +19,6 @@ trap 'rm -f "$UPSTREAM_MANIFEST"' EXIT HUP INT TERM curl --fail --silent --show-error --location \ --output "$UPSTREAM_MANIFEST" "$METALLB_MANIFEST_URL" -printf '%s %s\n' "$METALLB_MANIFEST_SHA256" "$UPSTREAM_MANIFEST" \ - | sha256sum --check kubectl apply --dry-run=server --validate=false \ --filename "$UPSTREAM_MANIFEST" diff --git a/test.sh b/test.sh index fcdc820..0cd3077 100755 --- a/test.sh +++ b/test.sh @@ -3,15 +3,13 @@ set -euo pipefail project_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) -kubeconform_image=ghcr.io/yannh/kubeconform:v0.7.0@sha256:85dbef6b4b312b99133decc9c6fc9495e9fc5f92293d4ff3b7e1b30f5611823c +kubeconform_image=ghcr.io/yannh/kubeconform:v0.7.0 sh -n "${project_dir}/install.sh" bash -n "${project_dir}/create-ci-kubeconfig.sh" bash -n "${project_dir}/test.sh" grep -Fq 'METALLB_VERSION=v0.16.0' "${project_dir}/install.sh" -grep -Fq 'METALLB_MANIFEST_SHA256=b0b9be2802f10aa32d45308b4457d06cde0c70544712c8d0cf5511657ffd2b69' \ - "${project_dir}/install.sh" validate_file() { local manifest=$1