Skip to content

Unable to use Kubebuilder as go module and Version Injection Broken After PR #4481 with solution to allow it #4575

Closed
@camilamacedo86

Description

@camilamacedo86

The solution implemented in PR #4481 aimed to allow Kubebuilder to be used as a Golang module, but it inadvertently broke the injection of version-related values during the build process.


What Broke? What's Expected?

Before (Expected Output)

Running kubebuilder version before the change correctly injected version information:

$ kubebuilder version  
Version: main.version{KubeBuilderVersion:"4.5.0", KubernetesVendor:"1.31.0", GitCommit:"7153119ca900994b70507edbde59771ac824f2d9", BuildDate:"2025-01-21T08:46:54Z", GoOs:"darwin", GoArch:"arm64"}

After (Broken Output)

After applying the changes in PR #4481 and creating a pre-release, the version information is missing, showing default values instead:

$ kubebuilder version  
Version: cmd.version{KubeBuilderVersion:"(devel)", KubernetesVendor:"unknown", GitCommit:"$Format:%H$", BuildDate:"1970-01-01T00:00:00Z", GoOs:"unknown", GoArch:"unknown"}

This indicates that ldflags are no longer injecting the expected values.

Reproducing the Issue

  • Get the PR changes PR #4481
  • Use go releaser to build the bin locally
  • Check the binary

Next Steps

To move forward, we will revert PR #4481 for the 4.5.1 patch release to restore version injection. After that, we can revisit the issue, properly test it, and ensure the solution works before the next release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions