Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apibinding controller with root shard informers #1598

Conversation

p0lyn0mial
Copy link
Contributor

Summary

it enables non-root shards to read APIExports and APISchemas from the root shard so that they can create the root APIs for:
"shards.tenancy.kcp.dev", "tenancy.kcp.dev", "scheduling.kcp.dev", "workload.kcp.dev", "apiresource.kcp.dev"

Related issue(s)

Fixes #

@p0lyn0mial p0lyn0mial requested a review from sttts July 22, 2022 08:48
apiExportsIndexer cache.Indexer
getAPIExport func(clusterName logicalcluster.Name, name string) (*apisv1alpha1.APIExport, error)
apiExportsIndexer cache.Indexer
rootShardApiExportsIndexer cache.Indexer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporary

@@ -67,6 +67,8 @@ func NewController(
apiBindingInformer apisinformers.APIBindingInformer,
apiExportInformer apisinformers.APIExportInformer,
apiResourceSchemaInformer apisinformers.APIResourceSchemaInformer,
temporaryRootShardApiExportInformer apisinformers.APIExportInformer, /*TODO(p0lyn0mial): replace with multi-shard informers*/
temporaryRootShardApiResourceSchemaInformer apisinformers.APIResourceSchemaInformer, /*TODO(p0lyn0mial): replace with multi-shard informers*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in all this wiring. Shouldn't we go with temporaryOtherShard....Informer? The same code will run on the root shard, and it must watch the second shard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could rename to temporaryLocalShard...Informer, wdyt?

@p0lyn0mial p0lyn0mial force-pushed the apibinding-controller-with-rootshard-informers branch from 8ac944b to e943674 Compare July 25, 2022 13:36
@stevekuznetsov
Copy link
Contributor

How is this different from #1572 ? #1572 (comment) applies here as well?

@p0lyn0mial
Copy link
Contributor Author

How is this different from #1572 ? #1572 (comment) applies here as well?

I'm splitting 1572 into smaller chunks. Yes, the comment applies here as well.


getAPIResourceSchema: func(clusterName logicalcluster.Name, name string) (*apisv1alpha1.APIResourceSchema, error) {
return apiResourceSchemaInformer.Lister().Get(clusters.ToClusterAwareKey(clusterName, name))
apiResourceSchema, err := temporaryLocalApiResourceSchemaInformer.Lister().Get(clusters.ToClusterAwareKey(clusterName, name))
if errors.IsNotFound(err) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stevekuznetsov 43 minutes ago
What's the expected sequencing here? I'm not sure we want to have this structure around in the code for a long time, it seems easy to do incorrectly from the dev side.

first, we check against a local shard and then the remote one (in that case the root shard). This is temporary until we have multi-shard informers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing it this way is easier and:

  • give us a starting point
  • allows us to find all places (controllers) that need to be aware of multiple shards.
  • allows us to make some progress into multi-shard env

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevekuznetsov ^, does it make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is definitely not the last words, it just gets us going.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we starting with the informer plumbing instead of a "temporary" hack that the user has to know how to use the two halves of individually?

Copy link
Member

@sttts sttts Jul 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will come to that. We won't augment more than 2 or 3 controllers with these temporary informers. Just to get it working in CI. Then we can iterate.

apiExportInformer apisinformers.APIExportInformer,
apiResourceSchemaInformer apisinformers.APIResourceSchemaInformer,
temporaryLocalApiExportInformer apisinformers.APIExportInformer, /*TODO(p0lyn0mial): replace with multi-shard informers*/
temporaryLocalApiResourceSchemaInformer apisinformers.APIResourceSchemaInformer, /*TODO(p0lyn0mial): replace with multi-shard informers*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop temporaryLocal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@p0lyn0mial p0lyn0mial force-pushed the apibinding-controller-with-rootshard-informers branch from e943674 to ff2edc8 Compare July 25, 2022 16:32
apiExportInformer apisinformers.APIExportInformer,
apiResourceSchemaInformer apisinformers.APIResourceSchemaInformer,
apiExportInformer apisinformers.APIExportInformer, /*TODO(p0lyn0mial): replace with multi-shard informers*/
apiResourceSchemaInformer apisinformers.APIResourceSchemaInformer, /*TODO(p0lyn0mial): replace with multi-shard informers*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no TODOs either here for these two.

@sttts
Copy link
Member

sttts commented Jul 25, 2022

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 25, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 25, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 25, 2022
@p0lyn0mial p0lyn0mial force-pushed the apibinding-controller-with-rootshard-informers branch from ff2edc8 to d769889 Compare July 25, 2022 18:29
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 25, 2022
@p0lyn0mial
Copy link
Contributor Author

p0lyn0mial commented Jul 25, 2022

I had to gofmt the file

@sttts
Copy link
Member

sttts commented Jul 25, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 25, 2022
@openshift-merge-robot openshift-merge-robot merged commit 8c5c72d into kcp-dev:main Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants