kubernetes-sigs / controller-tools

Tools to use with the controller-runtime libraries
Apache License 2.0
721 stars 416 forks source link

Controller-gen cannot generate CRD with k8s.io/api@v0.31.0 in dependency #1064

Closed raptorsun closed 1 week ago

raptorsun commented 1 week ago

After upgrading the dependency k8s.io/api from v0.30.0 to v0.31.1, controller-gen cannot generate CRD from kubebuilder annotated codes. Is there any way to fix this issue in from my code? or there should be a fix in controller-gen or k8s.io/api package? controller-gen reports the error below:

controller-gen rbac:roleName=manager-role crd  paths="./..." output:crd:artifacts:config=config/crd/bases 
../../go/pkg/mod/k8s.io/apimachinery@v0.31.0/pkg/runtime/serializer/cbor/internal/modes/custom.go:27:2: missing go.sum entry for module providing package github.com/fxamacker/cbor/v2 (imported by k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes); to add:
    go get k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes@v0.31.0
../../go/pkg/mod/k8s.io/apimachinery@v0.31.0/pkg/util/validation/validation.go:27:2: missing go.sum entry for module providing package k8s.io/utils/net (imported by k8s.io/client-go/util/cert); to add:
    go get k8s.io/client-go/util/cert@v0.30.0
../../go/pkg/mod/k8s.io/apimachinery@v0.31.0/pkg/labels/selector.go:29:2: missing go.sum entry for module providing package k8s.io/klog/v2 (imported by k8s.io/apimachinery/pkg/util/intstr); to add:
    go get k8s.io/apimachinery/pkg/util/intstr@v0.31.0
../../go/pkg/mod/k8s.io/apimachinery@v0.31.0/pkg/labels/selector.go:30:2: missing go.sum entry for module providing package k8s.io/utils/strings/slices (imported by k8s.io/apimachinery/pkg/labels); to add:
    go get k8s.io/apimachinery/pkg/labels@v0.31.0
../../go/pkg/mod/k8s.io/apimachinery@v0.31.0/pkg/util/net/http.go:39:2: missing go.sum entry for module providing package golang.org/x/net/http2 (imported by k8s.io/client-go/rest); to add:
    go get k8s.io/client-go/rest@v0.30.0
../../go/pkg/mod/k8s.io/apimachinery@v0.31.0/pkg/apis/meta/v1/controller_ref.go:21:2: missing go.sum entry for module providing package k8s.io/utils/ptr (imported by k8s.io/apimachinery/pkg/apis/meta/v1); to add:
    go get k8s.io/apimachinery/pkg/apis/meta/v1@v0.31.0
/home/hasun/go/pkg/mod/k8s.io/api@v0.31.0/core/v1/doc.go:21:1: missing argument "" (at <input>)
/home/hasun/go/pkg/mod/k8s.io/api@v0.31.0/core/v1/doc.go:21:1: missing argument "" (at <input>)
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".LocalObjectReference
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ResourceRequirements
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".Toleration
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ResourceRequirements
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ResourceRequirements
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".Toleration
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".LocalObjectReference
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ResourceRequirements
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ResourceRequirements
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".Toleration
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".ResourceRequirements
k8s.io/api/core/v1:-: unknown type "k8s.io/api/core/v1".Toleration
github.com/openshift/lightspeed-operator/api/v1alpha1:-: unable to locate schema for type "k8s.io/api/core/v1".LocalObjectReference
github.com/openshift/lightspeed-operator/api/v1alpha1:-: unable to locate schema for type "k8s.io/api/core/v1".ResourceRequirements
github.com/openshift/lightspeed-operator/api/v1alpha1:-: unable to locate schema for type "k8s.io/api/core/v1".ResourceRequirements
github.com/openshift/lightspeed-operator/api/v1alpha1:-: unable to locate schema for type "k8s.io/api/core/v1".Toleration
github.com/openshift/lightspeed-operator/api/v1alpha1:-: unable to locate schema for type "k8s.io/api/core/v1".ResourceRequirements
github.com/openshift/lightspeed-operator/api/v1alpha1:-: unable to locate schema for type "k8s.io/api/core/v1".Toleration
../../go/pkg/mod/k8s.io/apimachinery@v0.31.0/pkg/util/wait/backoff.go:26:2: missing go.sum entry for module providing package k8s.io/utils/clock (imported by k8s.io/apimachinery/pkg/util/wait); to add:
    go get k8s.io/apimachinery/pkg/util/wait@v0.31.0
../../go/pkg/mod/k8s.io/client-go@v0.30.0/plugin/pkg/client/auth/exec/exec.go:35:2: missing go.sum entry for module providing package golang.org/x/term (imported by k8s.io/client-go/tools/clientcmd); to add:
    go get k8s.io/client-go/tools/clientcmd@v0.30.0
../../go/pkg/mod/k8s.io/client-go@v0.30.0/util/flowcontrol/backoff.go:25:2: missing go.sum entry for module providing package k8s.io/utils/clock/testing (imported by k8s.io/client-go/util/flowcontrol); to add:
    go get k8s.io/client-go/util/flowcontrol@v0.30.0
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/buffer.go:11:2: missing go.sum entry for module providing package google.golang.org/protobuf/encoding/prototext (imported by github.com/prometheus/common/expfmt); to add:
    go get github.com/prometheus/common/expfmt@v0.45.0
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/buffer.go:12:2: missing go.sum entry for module providing package google.golang.org/protobuf/encoding/protowire (imported by github.com/golang/protobuf/proto); to add:
    go get github.com/golang/protobuf/proto@v1.5.4
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/deprecated.go:13:2: missing go.sum entry for module providing package google.golang.org/protobuf/proto (imported by github.com/prometheus/client_golang/prometheus); to add:
    go get github.com/prometheus/client_golang/prometheus@v1.18.0
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/registry.go:16:2: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protodesc (imported by github.com/golang/protobuf/proto); to add:
    go get github.com/golang/protobuf/proto@v1.5.4
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/defaults.go:8:2: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protoreflect (imported by github.com/prometheus/client_model/go); to add:
    go get github.com/prometheus/client_model/go@v0.5.0
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/extensions.go:15:2: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protoregistry (imported by github.com/golang/protobuf/proto); to add:
    go get github.com/golang/protobuf/proto@v1.5.4
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/extensions.go:16:2: missing go.sum entry for module providing package google.golang.org/protobuf/runtime/protoiface (imported by github.com/golang/protobuf/proto); to add:
    go get github.com/golang/protobuf/proto@v1.5.4
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/proto/buffer.go:13:2: missing go.sum entry for module providing package google.golang.org/protobuf/runtime/protoimpl (imported by github.com/prometheus/client_model/go); to add:
    go get github.com/prometheus/client_model/go@v0.5.0
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/ptypes/any/any.pb.go:9:2: missing go.sum entry for module providing package google.golang.org/protobuf/types/known/anypb (imported by github.com/google/gnostic-models/openapiv2); to add:
    go get github.com/google/gnostic-models/openapiv2@v0.6.8
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/ptypes/duration/duration.pb.go:9:2: missing go.sum entry for module providing package google.golang.org/protobuf/types/known/durationpb (imported by github.com/golang/protobuf/ptypes/duration); to add:
    go get github.com/golang/protobuf/ptypes/duration@v1.5.4
../../go/pkg/mod/github.com/golang/protobuf@v1.5.4/ptypes/timestamp/timestamp.pb.go:9:2: missing go.sum entry for module providing package google.golang.org/protobuf/types/known/timestamppb (imported by github.com/prometheus/client_golang/prometheus); to add:
    go get github.com/prometheus/client_golang/prometheus@v1.18.0
../../go/pkg/mod/github.com/go-openapi/jsonpointer@v0.19.6/pointer.go:35:2: missing go.sum entry for module providing package github.com/go-openapi/swag (imported by k8s.io/kube-openapi/pkg/validation/spec); to add:
    go get k8s.io/kube-openapi/pkg/validation/spec@v0.0.0-20240228011516-70dd3763d340
../../go/pkg/mod/k8s.io/client-go@v0.30.0/kubernetes/scheme/register.go:66:2: no required module provides package k8s.io/api/resource/v1alpha2; to add it:
    go get k8s.io/api/resource/v1alpha2
../../go/pkg/mod/k8s.io/kube-openapi@v0.0.0-20240228011516-70dd3763d340/pkg/handler3/handler.go:34:2: missing go.sum entry for module providing package github.com/google/uuid (imported by k8s.io/apimachinery/pkg/util/uuid); to add:
    go get k8s.io/apimachinery/pkg/util/uuid@v0.31.0
../../go/pkg/mod/github.com/prometheus/procfs@v0.12.0/proc_maps.go:27:2: missing go.sum entry for module providing package golang.org/x/sys/unix (imported by github.com/fsnotify/fsnotify); to add:
    go get github.com/fsnotify/fsnotify@v1.7.0
../../go/pkg/mod/k8s.io/client-go@v0.30.0/tools/cache/shared_informer.go:30:2: missing go.sum entry for module providing package k8s.io/utils/buffer (imported by k8s.io/client-go/tools/cache); to add:
    go get k8s.io/client-go/tools/cache@v0.30.0
../../go/pkg/mod/k8s.io/client-go@v0.30.0/tools/cache/reflector.go:45:2: missing go.sum entry for module providing package k8s.io/utils/pointer (imported by k8s.io/client-go/tools/cache); to add:
    go get k8s.io/client-go/tools/cache@v0.30.0
../../go/pkg/mod/k8s.io/client-go@v0.30.0/tools/cache/delta_fifo.go:28:2: missing go.sum entry for module providing package k8s.io/utils/trace (imported by k8s.io/client-go/tools/cache); to add:
    go get k8s.io/client-go/tools/cache@v0.30.0
Error: not all generators ran successfully
sbueringer commented 1 week ago

Please see: https://github.com/kubernetes-sigs/controller-tools/issues/1017

Using the latest controller-tools/controller-gen release should fix it

raptorsun commented 1 week ago

Member

Thank you very much! that resolves the problem :D

sbueringer commented 1 week ago

/close

k8s-ci-robot commented 1 week ago

@sbueringer: Closing this issue.

In response to [this](https://github.com/kubernetes-sigs/controller-tools/issues/1064#issuecomment-2365153324): >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.