kcp: APIExport consumer can't wildcard list/watch its schemas until the first APIBinding is created

Describe the bug A controller using APIExports can’t successfully start up and wildcard list/watch the APIs it’s exporting until the first APIBinding is created.

To Reproduce Steps to reproduce the behavior:

  1. Create an APIResourceSchema
  2. Create an APIExport that exports the APIResourceSchema
  3. Try to do a wildcard list/watch through the APIExport virtual workspace, such as
https://$server/services/apiexport/root:default:andy/controller-runtime-example-data.my.domain/clusters/*/apis/data.my.domain/v1alpha1/widgets
  1. Get a 404

In a controller-runtime app, you’d see something like this:

1.6541008964721239e+09  ERROR   controller-runtime.source       if kind is a CRD, it should be installed before calling Start   {"kind": "Widget.data.my.domain", "error": "no matches for kind \"Widget\" in version \"data.my.domain/v1alpha1\""}

Expected behavior The controller should be able to start listing/watching its APIs even without any APIBindings for it

Additional context None

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 25 (25 by maintainers)

Most upvoted comments

also creating APIExports could create a storm of storage creations and list/watches. Doing that on demand when a binding shows up is much much better.

is this due to some performance issue? having a single CRD object per shard doesn’t sound too heavy.

There can be many. And there is just no need to tell controllers to list/watch shards without bindings.

I think the same issue applies to the kcp server, not only to the vw server.

Yes, this is for APIExports in general, so it’s not specific to the vw server.

is this due to some performance issue? having a single CRD object per shard doesn’t sound too heavy.

It’s 1 CRD per APIResourceSchema. An APIExport can export 1…n APIResourceSchemas.

btw: do we want to change the reply from the server to something like 404: you need to create an APIBinding first to use this api (if the export exists, otherwise we would return plain 404) ?

Maybe?

I was responding to:

They should probably (must?) terminate when the list is empty (restarting would being the waiting process again)

We likely want some user-facing way to expose this waiting state, ultimately.

I don’t think we want a copy of every schema in every cluster.

I’m working on a fix