diff --git a/cli/cmd/alpha.go b/cli/cmd/alpha.go index 2ca4cd44d..db8d867cb 100644 --- a/cli/cmd/alpha.go +++ b/cli/cmd/alpha.go @@ -4,6 +4,7 @@ import ( "github.com/spf13/cobra" ) +// newCmdAlpha creates a new cobra command `alpha` which contains experimental subcommands for linkerd func newCmdAlpha() *cobra.Command { alphaCmd := &cobra.Command{ Use: "alpha", diff --git a/cli/cmd/alpha_clients.go b/cli/cmd/alpha_clients.go index 5be4943f9..9c35ec918 100644 --- a/cli/cmd/alpha_clients.go +++ b/cli/cmd/alpha_clients.go @@ -12,10 +12,15 @@ import ( corev1 "k8s.io/api/core/v1" ) +// alphaClientsOptions holds values for command line flags that apply to the alpha +// clients command. All fields in this struct should have corresponding flags added in +// the newCmdAlphaClients func later in this file. type alphaClientsOptions struct { namespace string } +// newCmdAlphaClients creates a new cobra command for the `alpha clients` subcommand which +// display client-side traffic stats to a resource. [Experimental] func newCmdAlphaClients() *cobra.Command { options := alphaClientsOptions{ namespace: corev1.NamespaceDefault, diff --git a/cli/cmd/alpha_stat.go b/cli/cmd/alpha_stat.go index 01ad6074e..66eaec0c8 100644 --- a/cli/cmd/alpha_stat.go +++ b/cli/cmd/alpha_stat.go @@ -30,12 +30,17 @@ var allowedKinds = map[string]struct{}{ k8s.StatefulSet: struct{}{}, } +// alphaStatOptions holds values for command line flags that apply to the alpha +// stat command. All fields in this struct should have corresponding flags added in +// the newCmdAlphaStat func later in this file. type alphaStatOptions struct { namespace string toResource string allNamespaces bool } +// newCmdAlphaStat creates a new cobra command for the `alpha stat` subcommand which +// display traffic stats about one or many resources. [Experimental] func newCmdAlphaStat() *cobra.Command { options := alphaStatOptions{ namespace: "default", @@ -45,7 +50,7 @@ func newCmdAlphaStat() *cobra.Command { Use: "stat [flags] (RESOURCE)", Short: "Display traffic stats about one or many resources", Long: `Display traffic stats about one or many resources - + (RESOURCE) can be a resource kind; one of: * cronjobs * daemonsets @@ -176,6 +181,8 @@ func renderTrafficMetricsList(metrics *v1alpha1.TrafficMetricsList, allNamespace t.Render(w) } +// renderTrafficMetricsEdgesList will render a table to the given Writer. +// Rows will be filtered to make sure that only traffic directed to the resource requested by the `--to` flag is shown func renderTrafficMetricsEdgesList(metrics *v1alpha1.TrafficMetricsList, w io.Writer, toResource *public.Resource, direction string) { t := buildTable(true, false) t.Data = []table.Row{} diff --git a/cli/cmd/profile.go b/cli/cmd/profile.go index a89ef87a2..718c6c25e 100644 --- a/cli/cmd/profile.go +++ b/cli/cmd/profile.go @@ -80,7 +80,7 @@ func newCmdProfile() *cobra.Command { Short: "Output service profile config for Kubernetes", Long: "Output service profile config for Kubernetes.", Example: ` # Output a basic template to apply after modification. - linkerd profile -n emoijvoto --template web-svc + linkerd profile -n emojivoto --template web-svc # Generate a profile from an OpenAPI specification. linkerd profile -n emojivoto --open-api web-svc.swagger web-svc