func NewHandler(dexClient *dex.Client, namespace string, clusterRoleName string) (sdk.Handler, error) {
	config, err := getOperatorConfigFromSecret(namespace)
	if err != nil {
		logrus.Info("unable to fetch existing cookie key: " + err.Error())
		logrus.Info("operator generating the cookie key")
		ssoCookieKey, err := proxy.GenerateCookieKey()
		if err != nil {
			return nil, errors.Wrap(err, "generating the sso cookie key")
		}
		config = &operatorConfig{
			ssoCookieKey: ssoCookieKey,
		}
		err = storeOperatorConfigInSecret(namespace, config)
		if err != nil {
			return nil, errors.Wrap(err, "storing the operator config in a secret")
		}
	} else {
		logrus.Info("operator using existing cookie key")
	}
	return &Handler{
		dexClient:       dexClient,
		clusterRoleName: clusterRoleName,
		operatorConfig:  *config,
	}, nil
}
NewHandler returns a new SSO operator event handler
package operator
import (
	"context"
	"fmt"
	v1 "github.com/jenkins-x/sso-operator/pkg/apis/jenkins.io/v1"
	"github.com/jenkins-x/sso-operator/pkg/dex"
	"github.com/jenkins-x/sso-operator/pkg/kubernetes"
	"github.com/jenkins-x/sso-operator/pkg/proxy"
	"github.com/operator-framework/operator-sdk/pkg/sdk"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)