disable the agent console (#976)

This commit is contained in:
Michael Quigley 2025-06-05 14:46:35 -04:00
parent c161e68c68
commit bb506cf01a
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
3 changed files with 14 additions and 8 deletions

View File

@ -2,6 +2,10 @@ package agent
import ( import (
"context" "context"
"net"
"net/http"
"os"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/agent/agentGrpc"
"github.com/openziti/zrok/agent/agentUi" "github.com/openziti/zrok/agent/agentUi"
@ -13,9 +17,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"net"
"net/http"
"os"
) )
type Agent struct { type Agent struct {
@ -66,7 +67,9 @@ func (a *Agent) Run() error {
a.agentSocket = agentSocket a.agentSocket = agentSocket
go a.manager() go a.manager()
if a.cfg.ConsoleEnabled {
go a.gateway() go a.gateway()
}
go a.remoteAgent() go a.remoteAgent()
a.persistRegistry = false a.persistRegistry = false

View File

@ -4,6 +4,7 @@ type AgentConfig struct {
ConsoleAddress string ConsoleAddress string
ConsoleStartPort uint16 ConsoleStartPort uint16
ConsoleEndPort uint16 ConsoleEndPort uint16
ConsoleEnabled bool
} }
func DefaultConfig() *AgentConfig { func DefaultConfig() *AgentConfig {
@ -11,5 +12,6 @@ func DefaultConfig() *AgentConfig {
ConsoleAddress: "127.0.0.1", ConsoleAddress: "127.0.0.1",
ConsoleStartPort: 8080, ConsoleStartPort: 8080,
ConsoleEndPort: 8181, ConsoleEndPort: 8181,
ConsoleEnabled: true,
} }
} }

View File

@ -1,13 +1,14 @@
package main package main
import ( import (
"os"
"os/signal"
"syscall"
"github.com/openziti/zrok/agent" "github.com/openziti/zrok/agent"
"github.com/openziti/zrok/environment" "github.com/openziti/zrok/environment"
"github.com/openziti/zrok/tui" "github.com/openziti/zrok/tui"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"os"
"os/signal"
"syscall"
) )
func init() { func init() {
@ -54,7 +55,7 @@ func (cmd *agentStartCommand) run(_ *cobra.Command, _ []string) {
tui.Error("error creating agent", err) tui.Error("error creating agent", err)
} }
c := make(chan os.Signal) c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM) signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() { go func() {
<-c <-c