|
|
|
|
@ -6,6 +6,8 @@ import ( |
|
|
|
|
"net/http/pprof" |
|
|
|
|
"reflect" |
|
|
|
|
|
|
|
|
|
openshiftconfigv1 "github.com/openshift/api/config/v1" |
|
|
|
|
"github.com/openshift/library-go/pkg/config/leaderelection" |
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
|
|
|
|
"k8s.io/apimachinery/pkg/runtime" |
|
|
|
|
ctrl "sigs.k8s.io/controller-runtime" |
|
|
|
|
@ -19,6 +21,7 @@ import ( |
|
|
|
|
// from a provided configuration file.
|
|
|
|
|
func LoadConfig(scheme *runtime.Scheme, configFile string) (*configv1.ProjectConfig, *TokenCCOAuthConfig, ctrl.Options, error) { |
|
|
|
|
options := ctrl.Options{Scheme: scheme} |
|
|
|
|
leaderElection := leaderelection.LeaderElectionDefaulting(openshiftconfigv1.LeaderElection{}, "", "") |
|
|
|
|
if configFile == "" { |
|
|
|
|
return &configv1.ProjectConfig{}, nil, options, nil |
|
|
|
|
} |
|
|
|
|
@ -34,6 +37,15 @@ func LoadConfig(scheme *runtime.Scheme, configFile string) (*configv1.ProjectCon |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
options = mergeOptionsFromFile(options, ctrlCfg) |
|
|
|
|
if options.LeaseDuration == nil { |
|
|
|
|
options.LeaseDuration = &leaderElection.LeaseDuration.Duration |
|
|
|
|
} |
|
|
|
|
if options.RenewDeadline == nil { |
|
|
|
|
options.RenewDeadline = &leaderElection.RenewDeadline.Duration |
|
|
|
|
} |
|
|
|
|
if options.RetryPeriod == nil { |
|
|
|
|
options.RetryPeriod = &leaderElection.RetryPeriod.Duration |
|
|
|
|
} |
|
|
|
|
return ctrlCfg, tokenCCOAuth, options, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|