Skip to content

Commit 7af3a37

Browse files
authored
Merge pull request #3876 from camilamacedo86/allow-leader-election
🐛 fix Invalid leader election ID generated when domain is empty
2 parents cab5b15 + 1ab2a14 commit 7af3a37

File tree

1 file changed

+5
-1
lines changed
  • pkg/plugins/golang/v4/scaffolds/internal/templates

1 file changed

+5
-1
lines changed

pkg/plugins/golang/v4/scaffolds/internal/templates/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,11 @@ func main() {
279279
WebhookServer: webhookServer,
280280
HealthProbeBindAddress: probeAddr,
281281
LeaderElection: enableLeaderElection,
282-
LeaderElectionID: "{{ hashFNV .Repo }}.{{ .Domain }}",
282+
{{- if not .Domain }}
283+
LeaderElectionID: "{{ hashFNV .Repo }}",
284+
{{- else }}
285+
LeaderElectionID: "{{ hashFNV .Repo }}.{{ .Domain }}",
286+
{{- end }}
283287
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
284288
// when the Manager ends. This requires the binary to immediately end when the
285289
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly

0 commit comments

Comments
 (0)