dbg

package
v1.15.11 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = func() *cobra.Command {
	var host string

	cmd := &cobra.Command{
		Use:   "kvstoremesh-dbg",
		Short: "CLI for interacting with KVStoreMesh",

		PersistentPreRun: func(cmd *cobra.Command, args []string) {
			ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt)
			cmd.SetContext(ctx)

			cfg := clientapi.DefaultTransportConfig().WithHost(host)
			client = clientapi.NewHTTPClientWithConfig(strfmt.Default, cfg)
		},
	}

	flags := cmd.PersistentFlags()
	flags.StringVarP(&host, "host", "H", kvstoremesh.DefaultAPIServeAddr, "URI to server-side API")

	return cmd
}()
View Source
var Status = func() *cobra.Command {
	var verbose bool

	cmd := &cobra.Command{
		Use:   "status",
		Short: "Display status of remote clusters",
		Run:   func(cmd *cobra.Command, args []string) { status(cmd.Context(), cmd.OutOrStdout(), verbose) },
	}

	RootCmd.AddCommand(cmd)
	command.AddOutputOption(cmd)

	cmd.Flags().BoolVar(&verbose, "verbose", false, "Output verbose status information for ready clusters as well")

	return cmd
}()
View Source
var Troubleshoot = func() *cobra.Command {
	var etcdcfg, cmcfg string
	var timeout time.Duration
	var local bool

	cmd := &cobra.Command{
		Use:   "troubleshoot [clusters...]",
		Short: "Troubleshoot connectivity towards the local etcd kvstore and remote clusters",
		Run: func(cmd *cobra.Command, args []string) {

			dialer := kvstore.DefaultEtcdDbgDialer{}
			stdout := cmd.OutOrStdout()

			if local {
				fmt.Fprintf(stdout, "Local etcd kvstore:\n")
				cctx, cancel := context.WithTimeout(cmd.Context(), timeout)
				kvstore.EtcdDbg(cctx, etcdcfg, dialer, stdout)
				fmt.Fprintf(stdout, "\n\n")
				cancel()
			}

			localClusterName, _ := os.LookupEnv("CLUSTER_NAME")

			ciliumdbg.TroubleshootClusterMesh(cmd.Context(), stdout, dialer, cmcfg, timeout, localClusterName, args...)
		},
	}

	RootCmd.AddCommand(cmd)

	flags := cmd.Flags()
	flags.StringVar(&etcdcfg, "etcd-config", "/var/lib/cilium/etcd-config.yaml", "Path to the etcd configuration")
	flags.StringVar(&cmcfg, "clustermesh-config", "/var/lib/cilium/clustermesh/", "Path to the ClusterMesh configuration directory")
	flags.BoolVar(&local, "include-local", false, "Additionally troubleshoot connectivity to the local etcd instance")
	flags.DurationVar(&timeout, "timeout", 5*time.Second, "Timeout when checking connectivity to a given etcd kvstore")

	return cmd
}()

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