Skip to content

Commit

Permalink
feat(KFLUXBUGS-1162): support override of election leaderId (#54)
Browse files Browse the repository at this point in the history
- allows us to have multiple controllers pointing to
  different Konflux instances.
- update test command

Signed-off-by: Scott Hebert <scoheb@gmail.com>
  • Loading branch information
scoheb authored Mar 26, 2024
1 parent 0b31d94 commit aadd837
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240317073005-bd9ea79e8d18

.PHONY: bundle
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ func init() {
func main() {
var metricsAddr string
var enableLeaderElection bool
var enableLeaderElectionId string
var probeAddr string
var remoteClusterConfigFile string
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&enableLeaderElectionId, "leader-election-id",
"b548bb9d.redhat.com",
"Enable overriding leader election ID for controller manager. ")
flag.StringVar(&remoteClusterConfigFile, "remote-cluster-config-file", "",
"The remote client will load its initial configuration from this file. "+
"Omit this flag to use the default configuration values. "+
Expand All @@ -89,7 +93,7 @@ func main() {
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "b548bb9d.redhat.com",
LeaderElectionID: enableLeaderElectionId,
NewCache: cache.BuilderWithOptions(cache.Options{
SelectorsByObject: cache.SelectorsByObject{
&tektonv1beta1.PipelineRun{}: {
Expand Down

0 comments on commit aadd837

Please sign in to comment.