seed

package
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SeedCmd = &cobra.Command{
	Use:          "seed",
	Short:        "Skydive seed",
	Long:         "Skydive seed [probe1] [probe2] ...",
	SilenceUsage: true,
	Run: func(cmd *cobra.Command, args []string) {
		config.Set("logging.id", "seed")
		logging.GetLogger().Noticef("Skydive Seed %s starting...", version.Version)

		memory, err := graph.NewMemoryBackend()
		if err != nil {
			logging.GetLogger().Errorf("Failed to start seed: %s", err)
			os.Exit(1)
		}

		hostID := config.GetString("host_id")
		if hostID == "" {
			logging.GetLogger().Errorf("Failed to determine host id for seed")
			os.Exit(1)
		}

		origin := graph.Origin(hostID, seed.Service)
		g := graph.NewGraph(hostID, memory, origin)

		probeBundle = probe.NewBundle()

		tlsConfig, err := config.GetTLSClientConfig(true)
		if err != nil {
			logging.GetLogger().Errorf("Failed to start seed: %s", err)
			os.Exit(1)
		}

		wsOpts := &websocket.ClientOpts{
			QueueSize:        config.GetInt("http.ws.queue_size"),
			WriteCompression: config.GetBool("http.ws.enable_write_compression"),
			TLSConfig:        tlsConfig,
		}

		seed, err := seed.NewSeed(g, seed.Service, agentAddr, subscriberFilter, *wsOpts, logging.GetLogger())
		if err != nil {
			logging.GetLogger().Errorf("Failed to start seed: %s", err)
			os.Exit(1)
		}

		seed.AddEventHandler(&seedHandler{g: g, probes: args})
		seed.Start()

		logging.GetLogger().Notice("Skydive seed started")
		ch := make(chan os.Signal)
		signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
		<-ch

		probeBundle.Stop()
		seed.Stop()

		logging.GetLogger().Notice("Skydive seed stopped.")
	},
}

SeedCmd describe the skydive seed root command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL