Skip to content

Commit

Permalink
fix multi-namespace watches
Browse files Browse the repository at this point in the history
the existing implementation didn't wire up the caches correctly. this
also adds a test of the namespace watch modes.
  • Loading branch information
ecordell committed Nov 8, 2024
1 parent 24d60c6 commit e8990bf
Show file tree
Hide file tree
Showing 4 changed files with 445 additions and 174 deletions.
3 changes: 2 additions & 1 deletion pkg/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ func (o *Options) Run(ctx context.Context, f cmdutil.Factory) error {

// register with metrics collector
spiceDBClusterMetrics := ctrlmetrics.NewConditionStatusCollector[*v1alpha1.SpiceDBCluster](o.MetricNamespace, "clusters", v1alpha1.SpiceDBClusterResourceName)
lister := typed.ListerFor[*v1alpha1.SpiceDBCluster](registry, typed.NewRegistryKey(controller.OwnedFactoryKey, v1alpha1ClusterGVR))
// TODO: metrics correct?
lister := typed.MustListerForKey[*v1alpha1.SpiceDBCluster](registry, typed.NewRegistryKey(controller.OwnedFactoryKey(""), v1alpha1ClusterGVR))
spiceDBClusterMetrics.AddListerBuilder(func() ([]*v1alpha1.SpiceDBCluster, error) {
return lister.List(labels.Everything())
})
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
var (
QueueOps = queue.NewQueueOperationsCtx()
CtxOperatorConfig = typedctx.WithDefault[*config.OperatorConfig](nil)
CtxCacheNamespace = typedctx.WithDefault("")
CtxClusterNN = typedctx.WithDefault(types.NamespacedName{})
CtxSecretNN = typedctx.WithDefault(types.NamespacedName{})
CtxSecret = typedctx.WithDefault[*corev1.Secret](nil)
Expand Down
Loading

0 comments on commit e8990bf

Please sign in to comment.