Created
January 20, 2025 10:35
-
-
Save sttts/0653d296cdec50b7240f3565f4a9e57a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pkg/reconciler/tenancy/initialization/apibinder_initializer_controller.go b/pkg/reconciler/tenancy/initialization/apibinder_initializer_controller.go | |
index 89bc580cc..e7df15dd8 100644 | |
--- a/pkg/reconciler/tenancy/initialization/apibinder_initializer_controller.go | |
+++ b/pkg/reconciler/tenancy/initialization/apibinder_initializer_controller.go | |
@@ -57,8 +57,8 @@ const ( | |
// NewAPIBinder returns a new controller which instantiates APIBindings and waits for them to be fully bound | |
// in new Workspaces. | |
func NewAPIBinder( | |
- kcpClusterClient kcpclientset.ClusterInterface, | |
- logicalClusterInformer corev1alpha1informers.LogicalClusterClusterInformer, | |
+ initializingWorkspacesKcpClusterClient kcpclientset.ClusterInterface, | |
+ initializingWorkspacesLogicalClusterInformer corev1alpha1informers.LogicalClusterClusterInformer, | |
workspaceTypeInformer, globalWorkspaceTypeInformer tenancyv1alpha1informers.WorkspaceTypeClusterInformer, | |
apiBindingsInformer apisv1alpha1informers.APIBindingClusterInformer, | |
apiExportsInformer, globalAPIExportsInformer apisv1alpha1informers.APIExportClusterInformer, | |
@@ -72,13 +72,13 @@ func NewAPIBinder( | |
), | |
getLogicalCluster: func(clusterName logicalcluster.Name) (*corev1alpha1.LogicalCluster, error) { | |
- return logicalClusterInformer.Lister().Cluster(clusterName).Get(corev1alpha1.LogicalClusterName) | |
+ return initializingWorkspacesLogicalClusterInformer.Lister().Cluster(clusterName).Get(corev1alpha1.LogicalClusterName) | |
}, | |
getWorkspaceType: func(path logicalcluster.Path, name string) (*tenancyv1alpha1.WorkspaceType, error) { | |
return indexers.ByPathAndNameWithFallback[*tenancyv1alpha1.WorkspaceType](tenancyv1alpha1.Resource("workspacetypes"), workspaceTypeInformer.Informer().GetIndexer(), globalWorkspaceTypeInformer.Informer().GetIndexer(), path, name) | |
}, | |
- listLogicalClusters: func() ([]*corev1alpha1.LogicalCluster, error) { | |
- return logicalClusterInformer.Lister().List(labels.Everything()) | |
+ listInitializingLogicalClusters: func() ([]*corev1alpha1.LogicalCluster, error) { | |
+ return initializingWorkspacesLogicalClusterInformer.Lister().List(labels.Everything()) | |
}, | |
listAPIBindings: func(clusterName logicalcluster.Name) ([]*apisv1alpha1.APIBinding, error) { | |
@@ -88,21 +88,21 @@ func NewAPIBinder( | |
return apiBindingsInformer.Lister().Cluster(clusterName).Get(name) | |
}, | |
createAPIBinding: func(ctx context.Context, clusterName logicalcluster.Path, binding *apisv1alpha1.APIBinding) (*apisv1alpha1.APIBinding, error) { | |
- return kcpClusterClient.Cluster(clusterName).ApisV1alpha1().APIBindings().Create(ctx, binding, metav1.CreateOptions{}) | |
+ return initializingWorkspacesKcpClusterClient.Cluster(clusterName).ApisV1alpha1().APIBindings().Create(ctx, binding, metav1.CreateOptions{}) | |
}, | |
getAPIExport: func(path logicalcluster.Path, name string) (*apisv1alpha1.APIExport, error) { | |
return indexers.ByPathAndNameWithFallback[*apisv1alpha1.APIExport](apisv1alpha1.Resource("apiexports"), apiExportsInformer.Informer().GetIndexer(), globalAPIExportsInformer.Informer().GetIndexer(), path, name) | |
}, | |
- commit: committer.NewCommitter[*corev1alpha1.LogicalCluster, corev1alpha1client.LogicalClusterInterface, *corev1alpha1.LogicalClusterSpec, *corev1alpha1.LogicalClusterStatus](kcpClusterClient.CoreV1alpha1().LogicalClusters()), | |
+ commit: committer.NewCommitter[*corev1alpha1.LogicalCluster, corev1alpha1client.LogicalClusterInterface, *corev1alpha1.LogicalClusterSpec, *corev1alpha1.LogicalClusterStatus](initializingWorkspacesKcpClusterClient.CoreV1alpha1().LogicalClusters()), | |
} | |
c.transitiveTypeResolver = admission.NewTransitiveTypeResolver(c.getWorkspaceType) | |
logger := logging.WithReconciler(klog.Background(), ControllerName) | |
- _, _ = logicalClusterInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ | |
+ _, _ = initializingWorkspacesLogicalClusterInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ | |
AddFunc: func(obj interface{}) { | |
c.enqueueLogicalCluster(obj, logger) | |
}, | |
@@ -148,9 +148,9 @@ type logicalClusterResource = committer.Resource[*corev1alpha1.LogicalClusterSpe | |
type APIBinder struct { | |
queue workqueue.TypedRateLimitingInterface[string] | |
- getLogicalCluster func(clusterName logicalcluster.Name) (*corev1alpha1.LogicalCluster, error) | |
- getWorkspaceType func(clusterName logicalcluster.Path, name string) (*tenancyv1alpha1.WorkspaceType, error) | |
- listLogicalClusters func() ([]*corev1alpha1.LogicalCluster, error) | |
+ getLogicalCluster func(clusterName logicalcluster.Name) (*corev1alpha1.LogicalCluster, error) | |
+ getWorkspaceType func(clusterName logicalcluster.Path, name string) (*tenancyv1alpha1.WorkspaceType, error) | |
+ listInitializingLogicalClusters func() ([]*corev1alpha1.LogicalCluster, error) | |
listAPIBindings func(clusterName logicalcluster.Name) ([]*apisv1alpha1.APIBinding, error) | |
getAPIBinding func(clusterName logicalcluster.Name, name string) (*apisv1alpha1.APIBinding, error) | |
@@ -218,7 +218,7 @@ func (b *APIBinder) enqueueWorkspaceTypes(obj interface{}, logger logr.Logger) { | |
return | |
} | |
- list, err := b.listLogicalClusters() | |
+ list, err := b.listInitializingLogicalClusters() | |
if err != nil { | |
runtime.HandleError(fmt.Errorf("error listing workspaces: %w", err)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment