Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to use the new remote join feature #2551

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions ziti/cmd/edge/quickstart.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type QuickstartOpts struct {
TrustDomain string
isHA bool
InstanceID string
MemberPID int
ClusterMember string
joinCommand bool
verbose bool
nonVoter bool
Expand Down Expand Up @@ -159,7 +159,7 @@ func NewQuickStartJoinClusterCmd(out io.Writer, errOut io.Writer, context contex
}
addCommonQuickstartFlags(cmd, options)
addQuickstartHaFlags(cmd, options)
cmd.Flags().IntVarP(&options.MemberPID, "member-pid", "m", 0, "the pid of a cluster member. required")
cmd.Flags().StringVarP(&options.ClusterMember, "cluster-member", "m", "", "address of a cluster member. required. example tls:localhost:1280")
cmd.Flags().BoolVar(&options.nonVoter, "non-voting", false, "used with ha mode. specifies the member is a non-voting member")
cmd.Hidden = true
return cmd
Expand All @@ -182,9 +182,10 @@ func (o *QuickstartOpts) join(ctx context.Context) {
logrus.Fatalf("the home directory must be specified when joining an existing cluster. the root-ca is used to create the server's pki")
}

if o.MemberPID == 0 {
logrus.Fatalf("--member-pid is required")
if o.ClusterMember == "" {
logrus.Fatalf("--cluster-member is required")
}

o.isHA = true
o.joinCommand = true
o.run(ctx)
Expand Down Expand Up @@ -353,8 +354,8 @@ func (o *QuickstartOpts) run(ctx context.Context) {
agentJoinCmd := agentcli.NewAgentClusterAdd(p)

args := []string{
fmt.Sprintf("tls:%s:%s", helpers.GetCtrlAdvertisedAddress(), helpers.GetCtrlAdvertisedPort()),
fmt.Sprintf("--pid=%d", o.MemberPID),
o.ClusterMember,
fmt.Sprintf("--pid=%d", os.Getpid()),
fmt.Sprintf("--voter=%t", !o.nonVoter),
}
agentJoinCmd.SetArgs(args)
Expand Down Expand Up @@ -419,7 +420,7 @@ func (o *QuickstartOpts) run(ctx context.Context) {
fmt.Printf(" --router-port %d \\\n", o.RouterPort+1)
fmt.Printf(" --home \"%s\" \\\n", o.Home)
fmt.Printf(" --trust-domain=\"%s\" \\\n", o.TrustDomain)
fmt.Printf(" --member-pid %d\\ \n", os.Getpid())
fmt.Printf(" --cluster-member tls:%s:%s\\ \n", ctrlAddy, ctrlPort)
fmt.Printf(" --instance-id \"%s\"\n", nextInstId)
fmt.Println("=======================================================================================")
fmt.Println()
Expand Down
Loading