feat: add reusable create-cluster (Kind) composite action #1072
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign juliusvonkohout for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
<details open>
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":["juliusvonkohout"]} -->
1.36 please take a look at the workflow in the community distribution as reference
Actually we will soon upgrade to 1.37 https://github.com/kubernetes-sigs/kind/releases/tag/v0.33.0
Hi @TrueFurina! Checking in to see if you are still working on the PR. There are some pending comments above that needed to be addressed.
Thanks @juliusvonkohout — updated the composite action to Kubernetes 1.37 (kind v0.33.0):
helm/kind-action to v1.15.0.kind-node-image to kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 (the v0.33.0 default node image).version is now the Kind CLI version v0.33.0 (it was previously mistakenly passed the Kubernetes version), and kubectl_version is driven by the kubernetes-version input.kind-config.yaml (single control-plane node) — the action previously pointed at a config file that wasn't committed, which would have failed at runtime.Let me know if you'd prefer a different node-image pin or a multi-node config.
This checkout is an unintended side effect for a reusable composite action: callers of a local action have already checked out the repository, and this step can reset that workspace to the workflow repository/ref, discarding a different checkout or generated files before the caller's next steps. Remove the checkout step and rely on the caller's checkout.
When a job already sets KUBECONFIG, Kind uses that environment variable unless an explicit --kubeconfig is supplied, but this step always exports $HOME/.kube/config. The newly created cluster can therefore be written to one path while subsequent steps read another. Preserve the existing value (or pass and export one explicit path) instead of unconditionally replacing it.
This repository pins third-party Actions to immutable commit SHAs (for example .github/workflows/github-stale.yaml:34), but this mutable tag allows the cluster-creation code to change without a reviewed diff. Pin helm/kind-action to the commit for v1.15.0 and retain the release in a comment.
🟡 Changes recommended
Unresolved findings affect workspace state, kubeconfig handling, Kubernetes-version behavior, and third-party action pinning.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
<details>
<summary>Pull request overview</summary>
Adds a reusable composite action for creating a Kind Kubernetes cluster in CI.
Changes:
KUBECONFIG for subsequent workflow steps.</details>
<details>
<summary>File summaries</summary>
| File | Summary |
|---|---|
| .github/actions/create-cluster/action.yml | Defines the reusable cluster setup action. Review findings cover unintended checkout behavior, KUBECONFIG handling, Kubernetes version/image alignment, and pinning the third-party action. |
| .github/actions/create-cluster/kind-config.yaml | Provides the Kind control-plane configuration. |
</details>
<details>
<summary>Review details</summary>
Suppressed comments (1)
.github/actions/create-cluster/action.yml:10
kubernetes-version is described as controlling both kubectl and the node image, but its only use is kubectl_version at line 31. If a caller overrides this input without also overriding kind-node-image, the action still creates a v1.37.0 cluster, so the requested Kubernetes version is not what the tests run against. Either derive/validate a matching image or rename and document this input as the kubectl version. kubernetes-version:
description: Kubernetes version (drives the kubectl version and the pinned node image below).
required: false
default: v1.37.0
</details>
[!NOTE]
Copilot is running an experiment and ran this review at Lite.
---
💡 <a href="/kubeflow/testing/new/master?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
Addressed all three points from the Copilot review, plus the version bump requested earlier.
1. Removed the self-checkout step. Agreed — a composite action shouldn't reset a workspace it doesn't own. Callers have already checked out the repository, and re-checking could discard a different ref or generated files before the caller's next steps. The action now relies on the caller's checkout.
2. Pinned helm/kind-action to an immutable commit — 06c1ae10762d3b9c1644e7fe69596ae519e015a2, with # v1.15.0 retained as a comment, matching the convention in .github/workflows/github-stale.yaml.
3. KUBECONFIG now preserves the caller's value. The export step was unconditionally writing $HOME/.kube/config, so if a job had already exported KUBECONFIG (and Kind honours it unless an explicit --kubeconfig is passed), the cluster would be written to one path while later steps read another. It now re-exports the existing value when set and only falls back to the default location when unset.
Also carried over from @juliusvonkohout's earlier comments: Kubernetes 1.37 via kind v0.33.0, with kind-config.yaml added (it was referenced but missing, which would have failed at runtime).
Head is 022c861f. Happy to adjust the KUBECONFIG handling if you'd rather pass one explicit path through to Kind instead.
Please check the failing dco
🟢 Approval recommended
The implementation is sound, with only a minor input-description clarification identified.
<details>
<summary>Review details</summary>
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
.github/actions/create-cluster/action.yml:8
kubectl_version; the independently defaulted kind-node-image still determines the cluster's Kubernetes version. A caller overriding only this input could therefore unknowingly create a different server version. Document that this controls the client and that kind-node-image must be changed separately.</details>
DCO fix: the branch had 5 commits, none carrying Signed-off-by. Squashed into a single DCO-signed commit on top of current master (tree content unchanged). DCO check should go green now.
Please rebase to master
Removing this option breaks the existing public verify-boilerplate action: .github/actions/verify-boilerplate/action.yml:51-61 still exposes exclude, and lines 123-140 still pass each entry as --exclude. Any caller setting that input now fails immediately with argparse's “unrecognized arguments” error instead of running verification. Please restore the parser and exclusion handling (including invalid-pattern validation and stale-pattern warnings), or update the action and documentation atomically if this is an intentional breaking change.
This new YAML file is missing the mandatory repository boilerplate. YAML/YML files are explicitly checked with the sh template (hack/boilerplate/boilerplate.py:44-60), and README.md:14-16 requires every source file to carry it, so this file will fail the shared verifier. Add the standard header before the action metadata.
This new YAML file also lacks the required boilerplate header. The checker maps .yaml files to boilerplate.sh.txt (hack/boilerplate/boilerplate.py:44-60), so checking this new config reports a header mismatch. Prepend the standard repository header.
<!-- ccr-overview-v2 -->
🟡 Changes recommended
The new YAML files lack required headers, and removing exclusion support breaks the existing verification action.
<details open>
<summary><strong>3 open findings</strong></summary>
</details>
🧠 Review effort: Balanced
Rebased and re-scoped — the branch is now a single DCO-signed commit on top of current master (da72697), +45/−0 across 2 files: .github/actions/create-cluster/action.yml and kind-config.yaml.
While redoing the squash I found something that shouldn't have been in this PR at all. The previous revision also reverted hack/boilerplate/boilerplate.py, removing the --exclude option that landed via #1090. Nothing in a Kind-cluster action relates to boilerplate — and since .github/actions/verify-boilerplate/action.yml passes --exclude, merging that revert would have made the boilerplate check fail with an unrecognized-argument error. That revert is dropped; boilerplate.py is now untouched by this PR.
Contents of the action, for review:
helm/kind-action pinned to an immutable SHA (06c1ae1, # v1.15.0 kept as a comment)v0.33.0, Kubernetes default v1.37.0, node image pinned by digestKUBECONFIG is re-exported when the caller already set it, falling back to $HOME/.kube/config only when unset — so later steps never read a different file than Kind wrotekind-config.yaml (single control-plane) is committed; the action referenced it but the file was missing beforeHappy to adjust the node-image pin, add a multi-node config, or pass an explicit --kubeconfig through to Kind instead — whichever you prefer. Ready for /lgtm whenever convenient.
[P2] Keep Kubernetes version selection aligned with the node image
This input is passed only as kubectl_version, while kind-node-image defaults independently to v1.37.0. Overriding only kubernetes-version therefore leaves the API server on v1.37.0, so a Kubernetes version matrix can test the wrong server release. The community-distribution Kind setup used by GitHub Actions derives the default kubectl version from the selected node image. Could we align the two values and verify the resulting server version, or rename this input to kubectl-version and explicitly document the independent image selection?
[P2] Add the required license headers to both new YAML files
Both this file and .github/actions/create-cluster/kind-config.yaml lack the mandatory repository boilerplate. Running the current verifier against these exact files reports a header mismatch for the action and a file shorter than the expected header for the cluster configuration. Could we add the standard year-less Apache 2.0 header (Copyright The Kubeflow Authors.) to both files?
AI-assisted review by GitHub Copilot.
Two concerns remain: Kubernetes version selection and the missing license headers. The unrelated boilerplate-verifier change has been removed. YAML parsing and four kubeconfig-export scenarios passed; real cluster creation was not tested because Docker is unavailable.
Kind reference: the community-distribution Kind setup used by GitHub Actions.
Thanks @juliusvonkohout — both points are addressed in df25a71, now a single
DCO-signed commit rebased on current master (+65/−0 and +18/−0, two files).
1. Kubernetes version selection. You were right that the version input was decorative:kubernetes-version only fed kubectl_version, while the cluster's server version was decided
by the kind-node-image default. Overriding the version alone still produced a v1.37.0 cluster —
the exact failure mode this action is meant to prevent.
The image now follows the version unless it is pinned explicitly:
kind-node-image:
default: "" # was: kindest/node:v1.37.0@sha256:...
node_image: ${{ inputs.kind-node-image || format('kindest/node:{0}', inputs.kubernetes-version) }}
kubernetes-version: v1.36.0 → kindest/node:v1.36.0 and kubectl v1.36.0, one input, one version;kind-node-image to tag@sha256:... and it wins, so digest pinning is still available for supply-chain reasons.Both input descriptions now say which one takes precedence.
2. License headers. Both new YAML files start with the year-less Apache-2.0 header copied
verbatim from hack/boilerplate/boilerplate.sh.txt. The sh template is the right one here:boilerplate.py maps yaml/yml to the sh stem in EXTENSION_TEMPLATES.
What I did not verify. YAML parses and the headers match the template byte-for-byte, but I
could not exercise real cluster creation — no Docker on my side either. So this is not evidence
that the Kind bootstrap works end to end, only that the two review points are gone. If you want
that covered, a smoke job that creates a cluster with kubernetes-version: v1.36.0 and assertskubectl version would close the gap.
juliusvonkohout
TrueFurina
Summary
Adds a reusable composite action (
.github/actions/create-cluster) that spins up a local Kubernetes cluster (Kind) so CI jobs can run against a real cluster instead of each workflow re-implementing the setup inline. This mirrors the pattern already used bysdkandtrainere2e workflows.Requirements met
KUBECONFIG(via$GITHUB_ENV) so subsequent steps can talk to the cluster directlyChanges
.github/actions/create-cluster/action.ymlVerification
runs.using: composite)