Skip to content

update-codegen.sh broken with go1.25 on release-0.11 and release-0.12 #2742

@lentzi90

Description

@lentzi90

Presubmit tests are broken on release-0.11 and release-0.12.
We are not really supporting release-0.11 anymore so that is less of an issue, but release-0.12 should definitely be fixed.

I am quite confident that they broken when the kubekins-e2e image was bumped to one with go1.25. The image is set in https://github.com/kubernetes/test-infra/blob/master/config/jobs/kubernetes-sigs/cluster-api-provider-openstack/cluster-api-provider-openstack-presubmits.yaml.

The error happens when running make generate-codegen, which calls hack/update-codegen.sh and looks like this:

 + go install k8s.io/kube-openapi/cmd/openapi-gen
go: downloading k8s.io/klog/v2 v2.120.1
go: downloading golang.org/x/tools v0.21.0
go: downloading github.com/emicklei/go-restful/v3 v3.11.0
go: downloading google.golang.org/protobuf v1.33.0
go: downloading github.com/go-logr/logr v1.4.1
go: downloading golang.org/x/sync v0.7.0
go: downloading golang.org/x/mod v0.17.0
# golang.org/x/tools/internal/tokeninternal
../../golang.org/x/[email protected]/internal/tokeninternal/tokeninternal.go:64:9: invalid array length -delta * delta (constant -256 of type int64)
make[1]: *** [Makefile:64: generate-codegen] Error 1
make[1]: Leaving directory '/home/prow/go/src/sigs.k8s.io/cluster-api-provider-openstack/orc'
make: *** [Makefile:319: generate-orc] Error 2 

The issue (as far as I understand) is that the script uses a script (kube_codegen.sh) in the upstream package that builds openapi-gen outside of CAPO. This means that we have no control over the dependencies there and thus cannot fix them to work with go1.25. If I do the same go install k8s.io/kube-openapi/cmd/openapi-gen in CAPO, it works.

CAPI has a totally different way of doing this. I wonder if we should try to change to that way. See:
https://github.com/kubernetes-sigs/cluster-api/blob/a0bb17c9c2647c5aaa80acc3385bb1adfceeea36/Makefile#L1441-L1445
https://github.com/kubernetes-sigs/cluster-api/blob/a0bb17c9c2647c5aaa80acc3385bb1adfceeea36/Makefile#L456-L465

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions