Skip to content

Commit

Permalink
Fix leaderElectionID issue: different controllers get same id which l…
Browse files Browse the repository at this point in the history
…eads to the error

Signed-off-by: Alexey Makhov <amakhov@mirantis.com>
  • Loading branch information
makhov committed Apr 25, 2024
1 parent 3f984af commit 5e09ec4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ limitations under the License.
package main

import (
"crypto/md5"
"flag"
"fmt"
"os"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
Expand Down Expand Up @@ -110,7 +112,7 @@ func main() {
},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "639dd9c3.k0smotron.io",
LeaderElectionID: fmt.Sprintf("%x.k0smotron.io", md5.Sum([]byte(enabledController))),
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
// when the Manager ends. This requires the binary to immediately end when the
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
Expand Down

0 comments on commit 5e09ec4

Please sign in to comment.