kubernetes-sigs / apiserver-builder-alpha

apiserver-builder-alpha implements libraries and tools to quickly and easily build Kubernetes apiservers/controllers to support custom resource types based on APIServer Aggregation
Apache License 2.0
787 stars 235 forks source link

Error when using ConnectorSubResource: (missing method Destroy) #645

Closed AnirudhPokala closed 7 months ago

AnirudhPokala commented 1 year ago

Hi Team I am creating an extension apiserver and using https://github.com/kubernetes-sigs/apiserver-builder-alpha as reference. I have declared a sub resource AWSRegions and in my code snippet have a line which is throwing errors.

var _ resource.ConnectorSubResource = (*AWSRegions)(nil)

Error: cannot use (*AWSRegions)(nil) (value of type *AWSRegions) as "sigs.k8s.io/apiserver-runtime/pkg/builder/resource".ConnectorSubResource value in variable declaration: *AWSRegions does not implement "sigs.k8s.io/apiserver-runtime/pkg/builder/resource".ConnectorSubResource (missing method Destroy) 

I tried adding empty Destroy method, func (c *AWSRegions) Destroy() {} then the error goes away. But when compiling I do get following error:

✗ make build   
test -s /Users/ani/go/src/sample-service/server/bin/controller-gen && /Users/ani/go/src/sample-service/server/bin/controller-gen --version | grep -q v0.11.1 || \
    GOBIN=/Users/ani/go/src/sample-service/server/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.11.1
/Users/ani/go/src/sample-service/server/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
# sigs.k8s.io/apiserver-runtime/pkg/builder/rest
../../../../pkg/mod/sigs.k8s.io/apiserver-runtime@v1.1.1/pkg/builder/rest/provider.go:60:10: cannot use parentPlumbedStorageGetterUpdaterProvider{…} (value of type parentPlumbedStorageGetterUpdaterProvider) as "k8s.io/apiserver/pkg/registry/rest".Storage value in return statement: parentPlumbedStorageGetterUpdaterProvider does not implement "k8s.io/apiserver/pkg/registry/rest".Storage (missing method Destroy)
../../../../pkg/mod/sigs.k8s.io/apiserver-runtime@v1.1.1/pkg/builder/rest/provider.go:66:10: cannot use parentPlumbedStorageGetterProvider{…} (value of type parentPlumbedStorageGetterProvider) as "k8s.io/apiserver/pkg/registry/rest".Storage value in return statement: parentPlumbedStorageGetterProvider does not implement "k8s.io/apiserver/pkg/registry/rest".Storage (missing method Destroy)
make: *** [vet] Error 1

My current go.mod has

require (
    k8s.io/api v0.27.1
    k8s.io/apiextensions-apiserver v0.27.1
    k8s.io/apimachinery v0.27.1
    k8s.io/apiserver v0.27.1
    k8s.io/client-go v0.27.1
    k8s.io/code-generator v0.27.1
    k8s.io/klog v1.0.0
    sigs.k8s.io/apiserver-runtime v1.1.1
    sigs.k8s.io/controller-runtime v0.14.6
)

Tried even downgrading k8s.io/apis version to v0.24.2 but still same issue.

liangyuanpeng commented 1 year ago

cc @yue9944882

Some message at slack https://kubernetes.slack.com/archives/CAR30FCJZ/p1683698525076429

k8s-triage-robot commented 9 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 8 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 7 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 7 months ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-sigs/apiserver-builder-alpha/issues/645#issuecomment-2016738317): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ 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/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.