Skip to content

feat: add reusable create-cluster (Kind) composite action - #1072

Open
TrueFurina wants to merge 4 commits into
kubeflow:masterfrom
TrueFurina:feat/create-cluster-composite-action
Open

feat: add reusable create-cluster (Kind) composite action#1072
TrueFurina wants to merge 4 commits into
kubeflow:masterfrom
TrueFurina:feat/create-cluster-composite-action

Conversation

@TrueFurina

Copy link
Copy Markdown

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 by sdk and trainer e2e workflows.

Requirements met

  • Composite action with inputs for Kubernetes version and Kind node image (both with sensible defaults)
  • Exports KUBECONFIG (via $GITHUB_ENV) so subsequent steps can talk to the cluster directly
  • Optional cluster name input

Changes

  • New file: .github/actions/create-cluster/action.yml

Verification

  • YAML follows the composite-action spec (runs.using: composite)
  • Inputs match the issue requirements

@google-oss-prow

Copy link
Copy Markdown

[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 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

kubernetes-version:
description: Kubernetes version for the cluster.
required: false
default: v1.31.0

@juliusvonkohout juliusvonkohout Aug 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.36 please take a look at the workflow in the community distribution as reference

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we will soon upgrade to 1.37 https://github.com/kubernetes-sigs/kind/releases/tag/v0.33.0

@tariq-hasan

Copy link
Copy Markdown
Member

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.

@TrueFurina

Copy link
Copy Markdown
Author

Thanks @juliusvonkohout — updated the composite action to Kubernetes 1.37 (kind v0.33.0):

  • Bumped helm/kind-action to v1.15.0.
  • Pinned kind-node-image to kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 (the v0.33.0 default node image).
  • Fixed the version mapping: 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.
  • Added the referenced 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Pull request overview

Adds a reusable composite action for creating a Kind Kubernetes cluster in CI.

Changes:

  • Adds configurable Kubernetes version, node image, and cluster name inputs.
  • Creates a single-control-plane Kind cluster.
  • Exports KUBECONFIG for subsequent workflow steps.
  • Adds Kind cluster configuration.
File summaries
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.
Review details

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
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +22 to +23
- name: Checkout repository
uses: actions/checkout@v4
Comment on lines +34 to +37
- name: Export KUBECONFIG
shell: bash
run: |
echo "KUBECONFIG=$HOME/.kube/config" >> "$GITHUB_ENV"
uses: actions/checkout@v4

- name: Create Kind cluster
uses: helm/kind-action@v1.15.0
@TrueFurina

Copy link
Copy Markdown
Author

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 commit06c1ae10762d3b9c1644e7fe69596ae519e015a2, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants