Skip to content

make: dynamically set Kubernetes and Gateway API versions for tests #11519

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MayorFaj
Copy link
Contributor

@MayorFaj MayorFaj commented Jun 28, 2025

This pull request introduces changes to improve dependency management and ensure dynamic synchronization with external dependencies in the project's workflows and Makefile. The most important changes focus on automating version detection for tools and dependencies, enhancing maintainability, and reducing manual updates.

Dependency Management Improvements:

  • .github/workflows/pr-unit-tests.yaml: Added a step to install setup-envtest in the unit test workflow, ensuring the necessary tool is available for testing Kubernetes environments.

  • Makefile: Updated ENVTEST_K8S_VERSION to dynamically determine the Kubernetes version based on the client-go dependency, and modified the ENVTEST variable to reference the installed setup-envtest binary path. This eliminates hardcoded versions and ensures compatibility with the project's dependencies.

Synchronization with External Dependencies:

  • Makefile: Updated CONFORMANCE_VERSION to dynamically determine the Gateway API version from go.mod. This ensures that conformance tests automatically stay in sync with the project's Gateway API dependency, reducing the need for manual updates.

Change Type

/kind  feature

Changelog

NONE

closed #11500

@Copilot Copilot AI review requested due to automatic review settings June 28, 2025 00:47
@github-actions github-actions bot added kind/feature Categorizes issue or PR as related to a new feature. release-note-none labels Jun 28, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Makefile by replacing hardcoded Kubernetes and Gateway API versions with dynamic lookups, reducing manual maintenance.

  • Extracts the Kubernetes version for envtest from the client-go module.
  • Pulls the Gateway API version for conformance tests directly from the sigs.k8s.io/gateway-api module.

@MayorFaj MayorFaj closed this Jun 28, 2025
@MayorFaj MayorFaj reopened this Jun 28, 2025
Copy link
Member

@timflannagan timflannagan left a comment

Choose a reason for hiding this comment

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

Thanks for opening this. A couple of quick comments.

Comment on lines 31 to 32
- name: Install setup-envtest
run: go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be necessary - we already register the setup-envtest tool as a Go tool dependency: https://github.com/kgateway-dev/kgateway/blob/main/go.mod#L637.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I ran into this error earlier

make envtest-path
unable to fetch checksum for requested version: unable fetch metadata for kubebuilder-tools-1.33.0-darwin-amd64.tar.gz -- got status "404 Not Found" from GCS

go tool setup-envtest list --os linux --arch amd64
(available) v1.30.0 linux/amd64
(available) v1.29.3 linux/amd64
(available) v1.29.1 linux/amd64

What I found, The setup-envtest tool is missing binaries for recent Kubernetes versions:

❌ 1.31.0 - Missing
❌ 1.32.0 - Missing
❌ 1.33.0 - Missing
✅ 1.30.0 - Available (latest working)

We probably need to add the latest tag?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, yep that makes more sense. Looking at our go.mod, we can see the version of that tool is very stale:

	sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20231019135941-15d792835235 // indirect

We'll need to bump that tool to something more recent. You can do that by running the following command:

go get -u sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

Copy link
Contributor Author

@MayorFaj MayorFaj Jun 28, 2025

Choose a reason for hiding this comment

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

there are dependency versions mismatch that are incompatible with each other, after running the - go get. the lint test is failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid hardcoding ENVTEST_K8S_VERSION Makefile variable
2 participants