Controllers creating/watching resources in different namespace than their Custom Resource Controllers creating/watching resources in different namespace than their Custom Resource kubernetes kubernetes

Controllers creating/watching resources in different namespace than their Custom Resource


You can specify namespaces in the manager options by passing in a ctrl.Options{} object, while creating it.

namespace := "namespace1,namespace2"options := ctrl.Options{        .        .        .        Namespace: cache.MultiNamespacedCacheBuilder(strings.Split(namespace, ","))    }mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options)