From 76b4af6a918bf542ef307c2e28180c5b3e5ef040 Mon Sep 17 00:00:00 2001 From: Eirik A Date: Mon, 23 Dec 2024 07:41:05 +0000 Subject: [PATCH] Bump `k8s-openapi` for Kubernetes `v1_32` support and MSRV (#1671) * Bump k8s-openapi for Kubernetes v1_32 support Signed-off-by: clux * Make just bump-k8s more reliable and parametrise k3s versions in CI Technically expands our testing range a little bit, but it simplifies our gunk here. Signed-off-by: clux * ci debug Signed-off-by: clux * unparametrise, github does not support it ..nor does it support yaml anchors so back to hacks. Signed-off-by: clux * Use a better replace due to gh not supporting env in params Signed-off-by: clux * leftover env Signed-off-by: clux * leftover env addition Signed-off-by: clux * Bump MSRV to fix CI brought in by home dep, but it's within our policy. Signed-off-by: clux * should be consistent and use earliest in cargo.tomls Signed-off-by: clux * remove ci check for specific e2e/cargo.toml openapi feature given change to floating 'earliest' tag. Signed-off-by: clux --------- Signed-off-by: clux --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 10 ++++------ .github/workflows/coverage.yml | 2 +- Cargo.toml | 4 ++-- README.md | 4 ++-- e2e/Cargo.toml | 2 +- justfile | 18 ++++++++++-------- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 61585a9a7..64abcf7e9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/rust:1.77.2-bullseye +FROM docker.io/rust:1.81.0-bullseye ENV DEBIAN_FRONTEND=noninteractive RUN apt update && apt upgrade -y diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb4e728fd..98569bab4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,7 +132,9 @@ jobs: fail-fast: false matrix: # Run these tests against older clusters as well - k8s: [v1.26, v1.30] + k8s: + - "v1.28" # MK8SV + - "latest" steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -184,10 +186,6 @@ jobs: echo "mk8sv not set correctly in tests" exit 1 fi - if ! grep "${{ steps.mk8sv.outputs.mk8svdash }}" e2e/Cargo.toml | grep mk8sv; then - echo "mk8sv not set correctly in e2e features" - exit 1 - fi - uses: dtolnay/rust-toolchain@stable # Smart caching for Rust projects. @@ -198,7 +196,7 @@ jobs: - uses: nolar/setup-k3d-k3s@v1 with: - version: v1.26 + version: "v1.28" # MK8SV # k3d-kube k3d-name: kube # Used to avoid rate limits when fetching the releases from k3s repo. diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 89d29ba61..b55775f99 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -26,7 +26,7 @@ jobs: tool: cargo-tarpaulin@0.28.0 - uses: nolar/setup-k3d-k3s@v1 with: - version: v1.26 + version: "v1.28" # MK8SV # k3d-kube k3d-name: kube # Used to avoid rate limits when fetching the releases from k3s repo. diff --git a/Cargo.toml b/Cargo.toml index ed419bfd5..1c48bf682 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ repository = "https://github.com/kube-rs/kube" readme = "README.md" license = "Apache-2.0" edition = "2021" -rust-version = "1.77.2" +rust-version = "1.81.0" [workspace.lints.rust] unsafe_code = "forbid" @@ -61,7 +61,7 @@ hyper-util = "0.1.9" json-patch = "3" jsonpath-rust = "0.7.3" jsonptr = "0.6" -k8s-openapi = { version = "0.23.0", default-features = false } +k8s-openapi = { version = "0.24.0", default-features = false } openssl = "0.10.36" parking_lot = "0.12.0" pem = "3.0.1" diff --git a/README.md b/README.md index 54b7c0fea..591331e03 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # kube-rs [![Crates.io](https://img.shields.io/crates/v/kube.svg)](https://crates.io/crates/kube) -[![Rust 1.77](https://img.shields.io/badge/MSRV-1.77-dea584.svg)](https://github.com/rust-lang/rust/releases/tag/1.77.2) -[![Tested against Kubernetes v1_26 and above](https://img.shields.io/badge/MK8SV-v1_26-326ce5.svg)](https://kube.rs/kubernetes-version) +[![Rust 1.81](https://img.shields.io/badge/MSRV-1.81-dea584.svg)](https://github.com/rust-lang/rust/releases/tag/1.81.0) +[![Tested against Kubernetes v1.28 and above](https://img.shields.io/badge/MK8SV-v1.28-326ce5.svg)](https://kube.rs/kubernetes-version) [![Best Practices](https://bestpractices.coreinfrastructure.org/projects/5413/badge)](https://bestpractices.coreinfrastructure.org/projects/5413) [![Discord chat](https://img.shields.io/discord/500028886025895936.svg?logo=discord&style=plastic)](https://discord.gg/tokio) diff --git a/e2e/Cargo.toml b/e2e/Cargo.toml index a37539cd6..1e048f18c 100644 --- a/e2e/Cargo.toml +++ b/e2e/Cargo.toml @@ -19,7 +19,7 @@ path = "boot.rs" [features] latest = ["k8s-openapi/latest"] -mk8sv = ["k8s-openapi/v1_26"] +mk8sv = ["k8s-openapi/earliest"] rustls = ["kube/rustls-tls"] openssl = ["kube/openssl-tls"] diff --git a/justfile b/justfile index 9fe9a393b..7210b80a3 100644 --- a/justfile +++ b/justfile @@ -113,16 +113,18 @@ bump-msrv msrv: sd "^.+badge/MSRV.+$" "${badge}" README.md sd "rust:.*-bullseye" "rust:{{msrv}}-bullseye" .devcontainer/Dockerfile -# Increment the Kubernetes feature version from k8s-openapi for tests; "just bump-k8s" +# Sets the Kubernetes feature version from latest k8s-openapi. bump-k8s: #!/usr/bin/env bash - latest=$(cargo tree --format "{f}" -i k8s-openapi | head -n 1 | choose -f ',' 1) - # bumping supported version also bumps our mk8sv - mk8svnew=${latest::-2}$((${latest:3} - 5)) - mk8svold=${latest::-2}$((${latest:3} - 6)) - fastmod -m -d e2e -e toml "$mk8svold" "$mk8svnew" - fastmod -m -d .github/workflows -e yml "${mk8svold/_/\.}" "${mk8svnew/_/.}" + earliest=$(cargo info k8s-openapi --color=never 2> /dev/null |grep earliest | awk -F'[][]' '{print $2}') + latest=$(cargo info k8s-openapi --color=never 2> /dev/null |grep latest | awk -F'[][]' '{print $2}') + # pin mk8sv to k8s-openapi earliest + min_feat="${earliest::-2}${earliest:3}" + min_dots="${min_feat/_/.}" + echo "Setting MK8SV to $min_dots using feature $min_feat" + # workflow pins for k3s (any line with key/array suffixed by # MK8SV) + sd "(.*)([\:\-]{1}) .* # MK8SV$" "\$1\$2 \"${min_dots}\" # MK8SV" .github/workflows/*.yml # bump mk8sv badge - badge="[![Tested against Kubernetes ${mk8svnew} and above](https://img.shields.io/badge/MK8SV-${mk8svnew}-326ce5.svg)](https://kube.rs/kubernetes-version)" + badge="[![Tested against Kubernetes ${min_dots} and above](https://img.shields.io/badge/MK8SV-${min_dots}-326ce5.svg)](https://kube.rs/kubernetes-version)" sd "^.+badge/MK8SV.+$" "${badge}" README.md echo "remember to bump kubernetes-version.md in kube-rs/website"