func New(config operatorconfig.Config, kubeConfig *rest.Config) (*Operator, error) {
	operatorManager, err := manager.New(kubeConfig, manager.Options{
		Scheme:    operatorclient.GetScheme(),
		Namespace: "openshift-dns",
		NewCache: cache.MultiNamespacedCacheBuilder([]string{
			config.OperatorNamespace,
			operatorcontroller.DefaultOperandNamespace}),
		NewClient: func(_ cache.Cache, config *rest.Config, options client.Options, uncachedObjects ...client.Object) (client.Client, error) {
			return client.New(config, options)
		},
	})
	if err != nil {
		return nil, fmt.Errorf("failed to create operator manager: %v", err)
	}
	cfg := operatorconfig.Config{
		OperatorNamespace:      config.OperatorNamespace,
		CoreDNSImage:           config.CoreDNSImage,
		OpenshiftCLIImage:      config.OpenshiftCLIImage,
		KubeRBACProxyImage:     config.KubeRBACProxyImage,
		OperatorReleaseVersion: config.OperatorReleaseVersion,
	}
	if _, err := operatorcontroller.New(operatorManager, cfg); err != nil {
		return nil, fmt.Errorf("failed to create operator controller: %v", err)
	}
	if _, err := statuscontroller.New(operatorManager, cfg); err != nil {
		return nil, fmt.Errorf("failed to create status controller: %v", err)
	}
	return &Operator{
		manager: operatorManager,
		client: operatorManager.GetClient(),
	}, nil
}
New creates (but does not start) a new operator from configuration.
package operator
import (
	"context"
	"fmt"
	"time"
	operatorv1 "github.com/openshift/api/operator/v1"
	operatorclient "github.com/openshift/cluster-dns-operator/pkg/operator/client"
	operatorconfig "github.com/openshift/cluster-dns-operator/pkg/operator/config"
	operatorcontroller "github.com/openshift/cluster-dns-operator/pkg/operator/controller"
	statuscontroller "github.com/openshift/cluster-dns-operator/pkg/operator/controller/status"
	"github.com/sirupsen/logrus"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/util/wait"
	"k8s.io/client-go/rest"
	"sigs.k8s.io/controller-runtime/pkg/cache"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/manager"
)
type Operator struct {
	manager manager.Manager
	caches  []cache.Cache
	client  client.Client
}