Skip to content

Commit

Permalink
Fix leader election (#76)
Browse files Browse the repository at this point in the history
Co-authored-by: aalexandru <aalexand@adobe.com>
  • Loading branch information
aalexandru and aalexandru authored Aug 30, 2023
1 parent 0150cca commit 43687cd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
18 changes: 11 additions & 7 deletions cmd/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ package main

import (
"flag"
"k8s.io/client-go/tools/leaderelection/resourcelock"
"os"
"sigs.k8s.io/controller-runtime/pkg/cache"

"github.com/adobe/cluster-registry/pkg/client/controllers"
"github.com/adobe/cluster-registry/pkg/config"
Expand Down Expand Up @@ -86,13 +88,15 @@ func main() {
},
}
options := ctrl.Options{
Scheme: scheme,
Namespace: namespace,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "0c4967d2.registry.ethos.adobe.com",
Scheme: scheme,
Cache: cache.Options{
Namespaces: []string{namespace},
},
MetricsBindAddress: metricsAddr,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "1d5078e3.registry.ethos.adobe.com",
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
}

if configFile != "" {
Expand Down
5 changes: 3 additions & 2 deletions config/manager/controller_manager_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ webhook:
leaderElection:
leaderElect: true
resourceNamespace: cluster-registry
resourceName: 0c4967d2.registry.ethos.adobe.com
resourceName: 1d5078e3.registry.ethos.adobe.com
resourceLock: leases
namespace: cluster-registry
alertmanagerWebhook:
bindAddress: 127.0.0.1:9092
alertMap:
- alertName: ClusterCapacityWarning
onFiring:
onFiring:
onboarding: "off"
onResolved:
onboarding: "on"
3 changes: 2 additions & 1 deletion local/client/client-config-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ data:
leaderElection:
leaderElect: true
resourceNamespace: cluster-registry
resourceName: 0c4967d2.registry.ethos.adobe.com
resourceName: 1d5078e3.registry.ethos.adobe.com
resourceLock: leases
namespace: cluster-registry
alertmanagerWebhook:
bindAddress: 0.0.0.0:9092
Expand Down
3 changes: 2 additions & 1 deletion local/client/client-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ webhook:
leaderElection:
leaderElect: true
resourceNamespace: cluster-registry
resourceName: 0c4967d2.registry.ethos.adobe.com
resourceName: 1d5078e3.registry.ethos.adobe.com
resourceLock: leases
namespace: cluster-registry
alertmanagerWebhook:
bindAddress: 0.0.0.0:9092
Expand Down

0 comments on commit 43687cd

Please sign in to comment.