Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Pilot executes cassandra directly, bypassing the container image entry point #347

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
10 changes: 6 additions & 4 deletions pkg/pilot/genericpilot/genericpilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ func (g *GenericPilot) runController(stopCh <-chan struct{}) <-chan error {

func (g *GenericPilot) runElector(stopCh <-chan struct{}) <-chan error {
out := make(chan error, 1)
go func() {
defer close(out)
out <- g.elector.Run()
}()
if g.Options.LeaderElect {
go func() {
defer close(out)
out <- g.elector.Run()
}()
}
return out
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/pilot/genericpilot/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Options struct {
PilotName string
// PilotNamespace is the namespace the corresponding Pilot exists within
PilotNamespace string
LeaderElect bool
LeaderElectionConfigMap string

// CmdFunc returns an *exec.Cmd for a given Pilot resource for the pilot
Expand Down Expand Up @@ -179,5 +180,7 @@ func (o *Options) Pilot() (*GenericPilot, error) {
func (o *Options) AddFlags(flags *pflag.FlagSet) {
flags.StringVar(&o.PilotName, "pilot-name", "", "The name of this Pilot. If not specified, an auto-detected name will be used.")
flags.StringVar(&o.PilotNamespace, "pilot-namespace", "", "The namespace the corresponding Pilot resource for this Pilot exists within.")
flags.BoolVar(&o.LeaderElect, "leader-elect", true, ""+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty nervous exposing this option to users - it should be defined by the Pilot (e.g. elasticsearch-pilot etc) whether leader election needs to be performed.
Disabling this could cause fundamental breakages to how the Pilot operates, so I don't think it should be a user exposed option.

Is this because you don't use the leader election primitives in the cassandra pilot? If so, can you change this to only be configurable by the Pilot code (i.e. not a user facing option)?

"If true, navigator will perform leader election between pilots.")
flags.StringVar(&o.LeaderElectionConfigMap, "leader-election-config-map", "", "The name of the ConfigMap to use for leader election")
}