Skip to content

Commit

Permalink
Pin Kind node image used in EphemeralCluster
Browse files Browse the repository at this point in the history
By default, `kind` would install a node image for Kubernetes 1.24, which
is a couple minor versions past what we deploy to cloud environments and
which runs afoul of some Terraform bugs[1]. Pin the Kind node image we
use to a Kubernetes 1.22 image, to match the Kind we use in other CI
contexts. We also make sure to install the `kind` CLI ourselves in the
CI workflow, to guarantee that the node image we pin comes from the same
release.

[1]: hashicorp/terraform-provider-kubernetes#1724
  • Loading branch information
tgeoghegan committed Jul 20, 2022
1 parent b941855 commit 76bef9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install latest version of Kind
# We should always make sure that the `kind` CLI we install is from the
# same release as the node image version used by
# `janus_core::test_util::kubernetes::EphemeralCluster`
run: go install sigs.k8s.io/[email protected]
- name: lint
run: cargo fmt --message-format human -- --check
- name: clippy
Expand All @@ -35,7 +40,8 @@ jobs:
- name: test
env:
RUST_LOG: trace
run: cargo test --verbose
# set PATH to ensure we use go binaries installed above
run: PATH=$(go env GOPATH)/bin:$PATH cargo test --verbose
- name: document
env:
CARGO_TARGET_DIR: "target/doc-deny"
Expand Down
8 changes: 7 additions & 1 deletion janus_core/src/test_util/kubernetes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ impl EphemeralCluster {
thread_rng().fill(&mut randomness);
let cluster_name = format!("janus-ephemeral-{}", hex::encode(&randomness));

// Use kind to start the cluster.
// Use kind to start the cluster, with the node image from kind v0.14.0 for Kubernetes 1.22,
// matching current regular GKE release channel. This image version should be bumped in
// lockstep with the version of kind installed by the ci-build workflow.
// https://github.com/kubernetes-sigs/kind/releases/tag/v0.14.0
// https://cloud.google.com/kubernetes-engine/docs/release-notes#regular-channel
assert!(Command::new("kind")
.args([
"create",
Expand All @@ -32,6 +36,8 @@ impl EphemeralCluster {
&kubeconfig_path.to_string_lossy(),
"--name",
&cluster_name,
"--image",
"kindest/node:v1.22.9@sha256:8135260b959dfe320206eb36b3aeda9cffcb262f4b44cda6b33f7bb73f453105",
])
.stdin(Stdio::null())
.stdout(Stdio::null())
Expand Down

0 comments on commit 76bef9e

Please sign in to comment.