Skip to content

Commit

Permalink
Restore code
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti committed Mar 20, 2024
1 parent 352c068 commit a7a58da
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions cmd/operator/operator/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ import (
"k8s.io/klog/v2"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
runtimeconfig "sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/healthz"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

elementalv1 "github.com/rancher/elemental-operator/api/v1beta1"
"github.com/rancher/elemental-operator/controllers"
Expand Down Expand Up @@ -185,20 +189,30 @@ func operatorRun(config *rootConfig) {

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
// MetricsBindAddress: config.metricsBindAddr,
Metrics: metricsserver.Options{
BindAddress: config.metricsBindAddr,
},
LeaderElection: config.enableLeaderElection,
LeaderElectionID: "controller-leader-election-elemental-operator",
LeaseDuration: &config.leaderElectionLeaseDuration,
RenewDeadline: &config.leaderElectionRenewDeadline,
RetryPeriod: &config.leaderElectionRetryPeriod,
// SyncPeriod: &config.syncPeriod,
// ClientDisableCacheFor: []client.Object{
// &corev1.ConfigMap{},
// &corev1.Secret{},
// &elementalv1.ManagedOSVersion{},
// },
// Port: config.webhookPort,
// CertDir: config.webhookCertDir,
Cache: cache.Options{
SyncPeriod: &config.syncPeriod,
},
WebhookServer: webhook.NewServer(webhook.Options{
Port: config.webhookPort,
CertDir: config.webhookCertDir,
}),
Client: client.Options{
Cache: &client.CacheOptions{
DisableFor: []client.Object{
&corev1.ConfigMap{},
&corev1.Secret{},
&elementalv1.ManagedOSVersion{},
},
},
},
HealthProbeBindAddress: config.healthAddr,
})
if err != nil {
Expand Down

0 comments on commit a7a58da

Please sign in to comment.