You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/04 08:02:56 UTC

[GitHub] [camel-k] squakez commented on a diff in pull request #3163: operator: allow to configure the lock name

squakez commented on code in PR #3163:
URL: https://github.com/apache/camel-k/pull/3163#discussion_r841464986


##########
pkg/cmd/operator.go:
##########
@@ -40,16 +41,18 @@ func newCmdOperator() (*cobra.Command, *operatorCmdOptions) {
 	cmd.Flags().Int32("health-port", 8081, "The port of the health endpoint")
 	cmd.Flags().Int32("monitoring-port", 8080, "The port of the metrics endpoint")
 	cmd.Flags().Bool("leader-election", true, "Use leader election")
+	cmd.Flags().String("leader-election-id", platform.OperatorLockName, "Use the given id as leader election discriminator")
 
 	return &cmd, &options
 }
 
 type operatorCmdOptions struct {
-	HealthPort     int32 `mapstructure:"health-port"`
-	MonitoringPort int32 `mapstructure:"monitoring-port"`
-	LeaderElection bool  `mapstructure:"leader-election"`
+	HealthPort       int32  `mapstructure:"health-port"`
+	MonitoringPort   int32  `mapstructure:"monitoring-port"`
+	LeaderElection   bool   `mapstructure:"leader-election"`
+	LeaderElectionID string `mapstructure:"leader-election-id"`
 }
 
 func (o *operatorCmdOptions) run(_ *cobra.Command, _ []string) {
-	operator.Run(o.HealthPort, o.MonitoringPort, o.LeaderElection)
+	operator.Run(o.HealthPort, o.MonitoringPort, o.LeaderElection, o.LeaderElectionID)

Review Comment:
   We need to check if that parameter exists, and, if not, fallback to `platform.OperatorLockName` (which I'd call at this stage as `platform.OperatorDefaultLockName`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org