package multitenant import ( "context" "go.uber.org/zap" "k8s.io/client-go/kubernetes" fv1 "github.com/fission/fission/pkg/apis/core/v1" "github.com/fission/fission/pkg/executor/executortype" "github.com/fission/fission/pkg/utils" "github.com/fission/fission/pkg/utils/manager" ) func NewNamespaceSubscriber( logger *zap.Logger, kubernetesClient kubernetes.Interface, executorTypes map[fv1.ExecutorType]executortype.ExecutorType, mgr manager.Interface, ) utils.NamespaceSubscriber { return utils.NamespaceSubscriberFuncs{ SubscriberName: "executor", AddFunc: func(ctx context.Context, record utils.NamespaceRecord) error { return registerNamespace(ctx, logger, kubernetesClient, record.Name, executorTypes, mgr) }, RemoveFunc: func(ctx context.Context, record utils.NamespaceRecord) error { return deregisterNamespace(ctx, logger, record.Name, executorTypes) }, ResyncFunc: func(ctx context.Context, record utils.NamespaceRecord) error { // Reconciler calls this for namespaces in NamespacePhaseFailed. // registerNamespace is idempotent: SA creation is a no-op if SA exists, // executor type AddNamespace guards against duplicate informer creation. return registerNamespace(ctx, logger, kubernetesClient, record.Name, executorTypes, mgr) }, } }