Skip to content

Commit

Permalink
Use KUBERNETES_VERSION consistently
Browse files Browse the repository at this point in the history
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 <twieczorek@mirantis.com>
  • Loading branch information
twz123 committed Jan 18, 2024
1 parent 9cee4a9 commit 987af1d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions docs/Dockerfile.serve-dev
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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"]
5 changes: 2 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 -- '$@'

Expand Down
2 changes: 1 addition & 1 deletion inttest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions inttest/bootloose-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 987af1d

Please sign in to comment.