From 987af1da6a8b6bb548d3120b2b7a453a3c1102ef Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Thu, 18 Jan 2024 15:52:24 +0100 Subject: [PATCH] Use KUBERNETES_VERSION consistently There were different environment variables in use to transport the current Kubernetes version. Unify that by replacing all KUBE_VERSION usages with KUBERNETES_VERSION. Don't embed the Kuberntes version in the docs helper Docker container. It's not used during build time. It's required during runtime, though. Hence pass this as an -e parameter to the docker run command instead. Let the Docker container build also depend on the embedded-bins Makefile variables, as the Alpine version is defined over there. Signed-off-by: Tom Wieczorek --- .github/workflows/publish-docs.yml | 4 ++-- Makefile | 1 + docs/Dockerfile.serve-dev | 3 --- docs/Makefile | 5 ++--- inttest/Makefile | 2 +- inttest/bootloose-alpine/Dockerfile | 4 ++-- mkdocs.yml | 2 +- 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 9867f50932b3..98b4dc5554f0 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -54,7 +54,7 @@ jobs: - name: mike deploy head if: contains(github.ref, 'refs/heads/main') run: | - KUBE_VERSION="$(./vars.sh kubernetes_version)" mike deploy --push head + KUBERNETES_VERSION="$(./vars.sh kubernetes_version)" mike deploy --push head # If a release has been published, deploy it as a new version - name: mike deploy new version @@ -66,7 +66,7 @@ jobs: env: VERSION: ${{ github.event.release.tag_name }} run: | - KUBE_VERSION="$(./vars.sh kubernetes_version)" mike deploy --push "$VERSION" + KUBERNETES_VERSION="$(./vars.sh kubernetes_version)" mike deploy --push "$VERSION" - name: Update mike version aliases if: github.repository == 'k0sproject/k0s' diff --git a/Makefile b/Makefile index d6a3635d471a..464c495e4e2b 100644 --- a/Makefile +++ b/Makefile @@ -285,6 +285,7 @@ docs-serve-dev: DOCS_DEV_PORT ?= 8000 docs-serve-dev: $(MAKE) -C docs .docker-image.serve-dev.stamp docker run --rm \ + -e KUBERNETES_VERSION='$(kubernetes_version)' \ -v "$(CURDIR):/k0s:ro" \ -p '$(DOCS_DEV_PORT):8000' \ k0sdocs.docker-image.serve-dev diff --git a/docs/Dockerfile.serve-dev b/docs/Dockerfile.serve-dev index 4dc491d8b882..d7ace2dc3c0b 100644 --- a/docs/Dockerfile.serve-dev +++ b/docs/Dockerfile.serve-dev @@ -2,8 +2,6 @@ ARG PYTHON_IMAGE_VERSION FROM python:${PYTHON_IMAGE_VERSION} as builder -ARG KUBE_VERSION - # Prepare Python virtual env ENV PYTHONUNBUFFERED 1 RUN \ @@ -25,6 +23,5 @@ WORKDIR /k0s EXPOSE 8000 # Start development server by default -ENV KUBE_VERSION=${KUBE_VERSION} ENTRYPOINT ["mkdocs"] CMD ["serve", "--dev-addr=0.0.0.0:8000"] diff --git a/docs/Makefile b/docs/Makefile index a72f6fd79b77..db989685f94d 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -18,7 +18,7 @@ TARGET_VERSION ?= latest # gives: "Error: The 'docs_dir' should not be the parent directory of the config file." # even if docs_dir is "." docs: .require-mkdocs cli - cd .. && KUBE_VERSION=$(kubernetes_version) mkdocs build --strict + cd .. && KUBERNETES_VERSION=$(kubernetes_version) mkdocs build --strict .PHONY: .require-mkdocs .require-mkdocs: @@ -75,10 +75,9 @@ cli: sed $(sedopt) '/\[k0s kubectl /d' cli/k0s_kubectl.md ln -s k0s.md cli/README.md -.docker-image.serve-dev.stamp: Dockerfile.serve-dev requirements_pip.txt requirements.txt Makefile.variables +.docker-image.serve-dev.stamp: Dockerfile.serve-dev requirements_pip.txt requirements.txt Makefile.variables ../embedded-bins/Makefile.variables docker build \ --build-arg PYTHON_IMAGE_VERSION=$(python_version)-alpine$(alpine_version) \ - --build-arg KUBE_VERSION=$(kubernetes_version) \ -t 'k0sdocs$(basename $@)' -f '$<' . touch -- '$@' diff --git a/inttest/Makefile b/inttest/Makefile index 721dd835af90..d402533088e2 100644 --- a/inttest/Makefile +++ b/inttest/Makefile @@ -24,7 +24,7 @@ bootloose_alpine_build_cmdline := \ --build-arg ALPINE_VERSION=$(alpine_patch_version) \ --build-arg ETCD_VERSION=$(etcd_version) \ --build-arg HELM_VERSION=$(helm_version) \ - --build-arg KUBE_VERSION=$(kubernetes_version) \ + --build-arg KUBERNETES_VERSION=$(kubernetes_version) \ -t bootloose-alpine \ -f bootloose-alpine/Dockerfile \ bootloose-alpine diff --git a/inttest/bootloose-alpine/Dockerfile b/inttest/bootloose-alpine/Dockerfile index 3df203cc9319..64aaf1934591 100644 --- a/inttest/bootloose-alpine/Dockerfile +++ b/inttest/bootloose-alpine/Dockerfile @@ -6,7 +6,7 @@ FROM docker.io/library/alpine:$ALPINE_VERSION ARG TARGETARCH ARG CRI_DOCKERD_VERSION=0.3.8 ARG ETCD_VERSION -ARG KUBE_VERSION +ARG KUBERNETES_VERSION ARG TROUBLESHOOT_VERSION=v0.78.1 ARG HELM_VERSION @@ -38,7 +38,7 @@ RUN sed -i -e 's/^\(tty[0-9]\)/# \1/' /etc/inittab RUN sed -i -e 's/^root:!:/root::/' /etc/shadow # Put kubectl into place to ease up debugging -RUN curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v$KUBE_VERSION/bin/linux/$TARGETARCH/kubectl \ +RUN curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v$KUBERNETES_VERSION/bin/linux/$TARGETARCH/kubectl \ && chmod +x /usr/local/bin/kubectl ENV KUBECONFIG=/var/lib/k0s/pki/admin.conf diff --git a/mkdocs.yml b/mkdocs.yml index b9a64756f9a6..837bb86c1f0f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -134,7 +134,7 @@ markdown_extensions: - footnotes extra: - k8s_version: !!python/object/apply:os.getenv ["KUBE_VERSION"] + k8s_version: !!python/object/apply:os.getenv ["KUBERNETES_VERSION"] generator: false social: - icon: fontawesome/brands/github