list

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NamespacesKey       = "namespaces"
	NamespacesShorthand = "n"
)

Variables

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List intents discovered by the network mapper",
	Args:  cobra.NoArgs,
	RunE: func(cmd *cobra.Command, args []string) error {
		return mapperclient.WithClient(func(c *mapperclient.Client) error {
			namespacesFilter := viper.GetStringSlice(NamespacesKey)
			servicesIntents, err := c.ServiceIntents(context.Background(), namespacesFilter)
			if err != nil {
				return err
			}
			for _, service := range servicesIntents {
				output.PrintStdout("%s in namespace %s calls:", service.Client.Name, service.Client.Namespace)
				for _, intent := range service.Intents {
					if len(intent.Namespace) != 0 {
						output.PrintStdout("  - %s in namespace %s", intent.Name, intent.Namespace)
						continue
					}

					output.PrintStdout("  - %s", intent.Name)
				}

			}

			if len(servicesIntents) == 0 {
				output.PrintStderr("No connections found. The network mapper detects (1) connections that are currently open and (2) DNS lookups while a connection is being initiated, for connections between pods on this cluster.")
			}
			return nil
		})
	},
}

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