Documentation ¶
Index ¶
- Variables
- func NewGetCmd(pctx *kumactl_cmd.RootContext) *cobra.Command
- func NewGetResourceCmd(pctx *kumactl_cmd.RootContext, desc core_model.ResourceTypeDescriptor) *cobra.Command
- func NewGetResourcesCmd(pctx *kumactl_cmd.RootContext, desc model.ResourceTypeDescriptor) *cobra.Command
- func WithPaginationArgs(cmd *cobra.Command, ctx *get_context.ListContext) *cobra.Command
- type RowPrinter
- type TablePrinter
Constants ¶
This section is empty.
Variables ¶
View Source
var BasicGlobalResourceTablePrinter = RowPrinter{ Headers: []string{"NAME", "AGE"}, RowFn: func(rootTime time.Time, item model.Resource) []string { return []string{ item.GetMeta().GetName(), table.TimeSince(item.GetMeta().GetModificationTime(), rootTime), } }, }
View Source
var BasicResourceTablePrinter = RowPrinter{ Headers: []string{"MESH", "NAME", "AGE"}, RowFn: func(rootTime time.Time, item model.Resource) []string { return []string{ item.GetMeta().GetMesh(), item.GetMeta().GetName(), table.TimeSince(item.GetMeta().GetModificationTime(), rootTime), } }, }
View Source
var CustomTablePrinters = map[model.ResourceType]TablePrinter{ mesh.DataplaneType: RowPrinter{ Headers: []string{"MESH", "NAME", "TAGS", "ADDRESS", "AGE"}, RowFn: func(rootTime time.Time, item model.Resource) []string { dataplane := item.(*mesh.DataplaneResource) address := dataplane.Spec.GetNetworking().GetAdvertisedAddress() if address == "" { address = dataplane.Spec.GetNetworking().GetAddress() } return []string{ dataplane.Meta.GetMesh(), dataplane.Meta.GetName(), dataplane.Spec.TagSet().String(), address, table.TimeSince(dataplane.Meta.GetModificationTime(), rootTime), } }, }, mesh.ExternalServiceType: RowPrinter{ Headers: []string{"MESH", "NAME", "TAGS", "ADDRESS", "AGE"}, RowFn: func(rootTime time.Time, item model.Resource) []string { externalService := item.(*mesh.ExternalServiceResource) return []string{ externalService.Meta.GetMesh(), externalService.Meta.GetName(), externalService.Spec.TagSet().String(), externalService.Spec.Networking.Address, table.TimeSince(externalService.Meta.GetModificationTime(), rootTime), } }, }, model.ScopeMesh: RowPrinter{ Headers: []string{"NAME", "mTLS", "METRICS", "LOGGING", "TRACING", "LOCALITY", "ZONEEGRESS", "AGE"}, RowFn: func(rootTime time.Time, item model.Resource) []string { mesh := item.(*mesh.MeshResource) mtls := "off" if mesh.MTLSEnabled() { backend := mesh.GetEnabledCertificateAuthorityBackend() mtls = fmt.Sprintf("%s/%s", backend.Type, backend.Name) } metrics := "off" if mesh.Spec.GetMetrics().GetEnabledBackend() != "" { backend := mesh.GetEnabledMetricsBackend() metrics = fmt.Sprintf("%s/%s", backend.Type, backend.Name) } logging := "off" if mesh.Spec.GetLogging() != nil { logging = mesh.GetLoggingBackends() if len(logging) == 0 { logging = "off" } } tracing := "off" if mesh.Spec.GetTracing() != nil { tracing = mesh.GetTracingBackends() if len(tracing) == 0 { tracing = "off" } } locality := "off" if mesh.Spec.GetRouting().GetLocalityAwareLoadBalancing() { locality = "on" } zoneEgress := "off" if mesh.Spec.GetRouting().GetZoneEgress() { zoneEgress = "on" } return []string{ mesh.GetMeta().GetName(), mtls, metrics, logging, tracing, locality, zoneEgress, table.TimeSince(mesh.GetMeta().GetModificationTime(), rootTime), } }, }, }
CustomTablePrinters are used to define different ways to print entities in table format.
Functions ¶
func NewGetCmd ¶
func NewGetCmd(pctx *kumactl_cmd.RootContext) *cobra.Command
func NewGetResourceCmd ¶
func NewGetResourceCmd(pctx *kumactl_cmd.RootContext, desc core_model.ResourceTypeDescriptor) *cobra.Command
func NewGetResourcesCmd ¶
func NewGetResourcesCmd(pctx *kumactl_cmd.RootContext, desc model.ResourceTypeDescriptor) *cobra.Command
func WithPaginationArgs ¶
func WithPaginationArgs(cmd *cobra.Command, ctx *get_context.ListContext) *cobra.Command
Types ¶
type RowPrinter ¶ added in v1.8.1
type RowPrinter struct { Headers []string RowFn func(rootTime time.Time, item model.Resource) []string }
func (RowPrinter) Print ¶ added in v1.8.1
func (rp RowPrinter) Print(rootTime time.Time, resources model.ResourceList, out io.Writer) error
type TablePrinter ¶
func ResolvePrinter ¶ added in v1.8.1
func ResolvePrinter(resourceType model.ResourceType, scope model.ResourceScope) TablePrinter
Click to show internal directories.
Click to hide internal directories.