Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
8 changes: 7 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,13 @@ func main() { // nolint: gocyclo
// Run registry server as a runnable to ensure it stops when the manager stops
if err := mgr.Add(manager.RunnableFunc(func(ctx context.Context) error {
setupLog.Info("starting registry server", "RegistryURL", registryURL)
registryServer := registry.NewServer(setupLog, fmt.Sprintf(":%d", registryPort), mgr.GetClient())
registryServer := registry.NewServer(
setupLog,
fmt.Sprintf(":%d", registryPort),
mgr.GetClient(),
"discovery-token-signing-secret",
managerNamespace,
)
if err := registryServer.Start(ctx); err != nil {
return fmt.Errorf("unable to start registry server: %w", err)
}
Expand Down
12 changes: 11 additions & 1 deletion cmd/metalprobe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ var (
func main() {
var registryURL string
var serverUUID string
var discoveryToken string
var duration time.Duration
var LLDPSyncInterval time.Duration
var LLDPSyncDuration time.Duration

flag.StringVar(&registryURL, "registry-url", "", "Registry URL where the probe will register itself.")
flag.StringVar(&serverUUID, "server-uuid", "", "Agent UUID to register with the registry.")
flag.StringVar(&discoveryToken, "discovery-token", "", "Discovery token for authenticating with the registry.")
flag.DurationVar(&duration, "duration", 5*time.Second, "Duration of time to wait between checks.")
flag.DurationVar(&LLDPSyncInterval, "lldp-sync-interval", 5*time.Second,
"Duration of time to wait between lldpctl runs.")
Expand All @@ -50,10 +52,18 @@ func main() {
os.Exit(1)
}

if discoveryToken == "" {
setupLog.Error(nil, "discovery token is missing")
os.Exit(1)
}

ctx := ctrl.SetupSignalHandler()

setupLog.Info("starting registry agent")
agent := probe.NewAgent(setupLog, serverUUID, registryURL, duration, LLDPSyncInterval, LLDPSyncDuration)
agent := probe.NewAgent(
setupLog, serverUUID, registryURL, discoveryToken,
duration, LLDPSyncInterval, LLDPSyncDuration,
)
if err := agent.Start(ctx); err != nil {
setupLog.Error(err, "problem running probe agent")
os.Exit(1)
Expand Down
Loading
Loading