Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creating a kind cluster from a custom K8s branch #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion demo/clusters/kind/scripts/build-kind-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cleanup() {
trap cleanup EXIT

# Set some build variables
KIND_K8S_REPO="https://github.com/kubernetes/kubernetes.git "
KIND_K8S_DIR="${TMP_DIR}/kubernetes-${KIND_K8S_TAG}"

# Checkout the version of kubernetes we want to build our kind image from
Expand Down
1 change: 1 addition & 0 deletions demo/clusters/kind/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DRIVER_IMAGE_VERSION=$(from_versions_mk "VERSION")
# The kubernetes tag to build the kind cluster from
# From https://github.com/kubernetes/kubernetes/tags
# See also https://hub.docker.com/r/kindest/node/tags
: ${KIND_K8S_REPO:="https://github.com/kubernetes/kubernetes.git"}
Copy link
Member

Choose a reason for hiding this comment

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

When I tried this locally, there were issues with extracting the version as below since we're doing a shallow-clone. Were you able to get around this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean exactly by "issues with extracting the version as below"?

I didn't have any issues. The only place this variable is even used is in build-kind-image.sh, so now this just allows what used to be hard-coded there to be overwritten.

Copy link
Member

Choose a reason for hiding this comment

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

Let's say that you want to check out a branch:

KIND_K8S_REPO=https://github.com/pohly/kubernetes \
KIND_K8S_TAG=dra-structured-parameters \
    ./demo/clusters/kind/create-cluster.sh

Since we do a shallow clone of the repo and this does not contain tag information the kubernets build fails.

I was able to get around this locally in initial testing by setting KUBE_GIT_VERSION=v1.30.0 in addition to the envvars above. This could also be addressed by:

  1. Building a full repo clone that's already checked out instead.
  2. "unshallowing" the clone so that git describe --tags returns some sane version string in the repo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am also setting KUBE_GIT_VERSION=v1.30.0 (because this is what you told me to do in slack). I never tried without it (nor really attempted to understand why it was necessary, apparently).

: ${KIND_K8S_TAG:="v1.29.1"}

# The name of the kind cluster to create
Expand Down