-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically derive defaults versions from checksums (#11906)
* Automatically derive defaults versions from checksums Currently, when updating checksums, we manually update the default versions. However, AFAICT, for all components where we have checksums, we're using the newest version out of those checksums. Codify this in the `_version` defaults variables definition to make the process automatic and reduce manual steps (as well as the diff size during reviews). We assume the versions are sorted, with newest first. This should be guaranteed by the pre-commit hooks. * Validate checksums are ordered by versions, newest first * Generalize render-readme-versions hook for other static files The pre-commit hook introduced a142f40 (Update versions in README.md with pre-commit, 2025-01-21) allow to update our README with new versions. It turns out other "static" files (== which don't interpret Ansible variables) also use the default version (in that case, our Dockefiles, but there might be others) The Dockerfile breaks if the variable they use (`kube_version`) is a Jinja template. For helping with automatic version upgrade, generalize the hook to deal with other static files, and make a template out of the Dockerfile. * Dockerfile: template kube_version with pre-commit instead of runtime * Validate all versions/checksums are strings in pre-commit All the ansible/python tooling for version is for version strings. YAML unhelpfully consider some stuff as number, so enforce this. * Stringify checksums versions
- Loading branch information
Showing
10 changed files
with
264 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Use imutable image tags rather than mutable tags (like ubuntu:22.04) | ||
FROM ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 | ||
|
||
# Some tools like yamllint need this | ||
# Pip needs this as well at the moment to install ansible | ||
# (and potentially other packages) | ||
# See: https://github.com/pypa/pip/issues/10219 | ||
ENV LANG=C.UTF-8 \ | ||
DEBIAN_FRONTEND=noninteractive \ | ||
PYTHONDONTWRITEBYTECODE=1 | ||
|
||
WORKDIR /kubespray | ||
|
||
# hadolint ignore=DL3008 | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
apt-get update -q \ | ||
&& apt-get install -yq --no-install-recommends \ | ||
curl \ | ||
python3 \ | ||
python3-pip \ | ||
sshpass \ | ||
vim \ | ||
rsync \ | ||
openssh-client \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /var/log/* | ||
|
||
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \ | ||
--mount=type=cache,sharing=locked,id=pipcache,mode=0777,target=/root/.cache/pip \ | ||
pip install --no-compile --no-cache-dir -r requirements.txt \ | ||
&& find /usr -type d -name '*__pycache__' -prune -exec rm -rf {} \; | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
RUN OS_ARCHITECTURE=$(dpkg --print-architecture) \ | ||
&& curl -L "https://dl.k8s.io/release/{{ kube_version }}/bin/linux/${OS_ARCHITECTURE}/kubectl" -o /usr/local/bin/kubectl \ | ||
&& echo "$(curl -L "https://dl.k8s.io/release/{{ kube_version }}/bin/linux/${OS_ARCHITECTURE}/kubectl.sha256")" /usr/local/bin/kubectl | sha256sum --check \ | ||
&& chmod a+x /usr/local/bin/kubectl | ||
|
||
COPY *.yml ./ | ||
COPY *.cfg ./ | ||
COPY roles ./roles | ||
COPY contrib ./contrib | ||
COPY inventory ./inventory | ||
COPY library ./library | ||
COPY extra_playbooks ./extra_playbooks | ||
COPY playbooks ./playbooks | ||
COPY plugins ./plugins |
Oops, something went wrong.