Documentation ¶
Overview ¶
Mesh package provides support for the mesh graph handlers such as supported path variables and query params, as well as types for mesh graph processing.
Index ¶
- Constants
- Variables
- func BadRequest(message string)
- func CheckError(err error)
- func CheckUnavailable(err error)
- func Error(message string)
- func Forbidden(message string)
- func Id(cluster, namespace, name, infraType, version string, isExternal bool) (id string, err error)
- func IsOK(telemetryVal string) bool
- type AccessibleNamespace
- type AccessibleNamespaces
- type Appender
- type AppenderGlobalInfo
- type AppenderNamespaceInfo
- type AppenderVendorInfo
- type ClusterSensitiveKey
- type CommonOptions
- type ConfigOptions
- type ConfigVendor
- type Edge
- type IstioStatusGetter
- type MeshMap
- type Metadata
- type MetadataKey
- type NamespaceInfo
- type NamespaceInfoMap
- type Node
- type Options
- type RequestedAppenders
- type Response
Constants ¶
const ( BoxByCluster string = "cluster" BoxByNamespace string = "namespace" )
const ( BoxTypeCluster string = "cluster" BoxTypeNamespace string = "namespace" External string = "_external_" // Special cluster name for external deployment InfraTypeCluster string = "cluster" // cluster node (not box) with no other infra (very rare) InfraTypeDataPlane string = "dataplane" // single node representing 1 or more dataPlane namespaces InfraTypeGrafana string = "grafana" InfraTypeIstiod string = "istiod" InfraTypeKiali string = "kiali" InfraTypeMetricStore string = "metricStore" InfraTypeNamespace string = "namespace" InfraTypeTraceStore string = "traceStore" NodeTypeBox string = "box" // The special "box" node. isBox will be set to a BoxType NodeTypeInfra string = "infra" // Any non-box node of interest TF string = "2006-01-02 15:04:05" // TF is the TimeFormat for timestamps )
const (
VendorCytoscape string = "cytoscape"
)
The supported vendors
Variables ¶
var StatusGetter func(context.Context, *config.Config, kubernetes.ClientFactory, cache.KialiCache, *grafana.Service) status.StatusInfo = status.Get
StatusGetter var allows test code to mock out this function with a mock
Functions ¶
func BadRequest ¶
func BadRequest(message string)
BadRequest panics with BadRequest and the provided message
func CheckError ¶
func CheckError(err error)
CheckError panics with the supplied error if it is non-nil
func CheckUnavailable ¶
func CheckUnavailable(err error)
CheckUnavailable panics with StatusServiceUnavailable (503) and the supplied error if it is non-nil
func Error ¶
func Error(message string)
Error panics with InternalServerError (500) and the provided message
func Forbidden ¶
func Forbidden(message string)
Forbidden panics with Forbidden and the provided message
Types ¶
type AccessibleNamespace ¶
type AccessibleNamespaces ¶
type AccessibleNamespaces map[ClusterSensitiveKey]*AccessibleNamespace
AccessibleNamepaces is a map with Key: ClusterSensitive namespace Key, Value: *AccessibleNamespace
type Appender ¶
type Appender interface { // AppendGraph performs the appender work on the provided traffic map. The map may be initially empty. // An appender is allowed to add or remove map entries. namespaceInfo will be nil for Finalizer appenders. AppendGraph(meshMap MeshMap, globalInfo *AppenderGlobalInfo, namespaceInfo *AppenderNamespaceInfo) // IsFinalizer returns true if the appender should run only on the final TrafficMap, or false if the appender should // run against every requested namespace. IsFinalizer() bool // Name returns a unique appender name and which is the name used to identify the appender (e.g in 'appenders' query param) Name() string }
Appender is implemented by any code offering to append a service graph with supplemental information. On error the appender should panic and it will be handled as an error response.
type AppenderGlobalInfo ¶
type AppenderGlobalInfo struct { Business *business.Layer ClientFactory kubernetes.ClientFactory Config *config.Config Grafana *grafana.Service IstioStatusGetter IstioStatusGetter KialiCache cache.KialiCache PromClient *prometheus.Client Vendor AppenderVendorInfo // telemetry vendor's global info }
AppenderGlobalInfo caches information relevant to a single graph. It allows an appender to populate the cache and then it, or another appender can re-use the information. A new instance is generated for graph and is initially empty.
func NewAppenderGlobalInfo ¶
func NewAppenderGlobalInfo() *AppenderGlobalInfo
type AppenderNamespaceInfo ¶
type AppenderNamespaceInfo struct { Namespace string // always provided Vendor AppenderVendorInfo // telemetry vendor's namespace info }
AppenderNamespaceInfo caches information relevant to a single namespace. It allows one appender to populate the cache and another to then re-use the information. A new instance is generated for each namespace of a single graph and is initially seeded with only Namespace.
func NewAppenderNamespaceInfo ¶
func NewAppenderNamespaceInfo(namespace string) *AppenderNamespaceInfo
type AppenderVendorInfo ¶
type AppenderVendorInfo map[string]interface{}
func NewAppenderVendorInfo ¶
func NewAppenderVendorInfo() AppenderVendorInfo
type ClusterSensitiveKey ¶
type ClusterSensitiveKey = string
ClusterSensitiveKey is the recommended [string] type for maps keying on a cluster-sensitive name
func GetClusterSensitiveKey ¶
func GetClusterSensitiveKey(cluster, name string) ClusterSensitiveKey
GetClusterSensitiveKey returns a valid key for maps using a ClusterSensitiveKey
type CommonOptions ¶
type CommonOptions struct { Params url.Values // make available the raw query params for vendor-specific handling QueryTime int64 // unix time in seconds }
CommonOptions are those supplied to Vendors
type ConfigOptions ¶
type ConfigOptions struct { BoxBy string CommonOptions MeshName string }
ConfigOptions are those supplied to Config Vendors
type ConfigVendor ¶
type ConfigVendor interface { // NewConfig is required by the ConfigVendor interface. It must produce a valid // Config for the provided TrafficMap, It is recommended to use the graph/util.go // definitions for error handling. Refer to the Cytoscape implementation as an example. NewConfig(meshMap MeshMap, o ConfigOptions) interface{} }
ConfigVendor is an interface that must be satisfied for each config vendor implementation.
type IstioStatusGetter ¶ added in v1.86.0
type IstioStatusGetter interface {
GetStatus(ctx context.Context, cluster string) (kubernetes.IstioComponentStatus, error)
}
IstioStatusGetter gets the status of the mesh graph components
type MeshMap ¶
MeshMap is a map of app Nodes, each optionally holding Edge data. Metadata is a general purpose map for holding any desired node or edge information.
type Metadata ¶
type Metadata map[MetadataKey]interface{}
Metadata is a map for storing node and edge metadata values reported by the vendors
type MetadataKey ¶
type MetadataKey string
MetadataKey is a mnemonic type name for string
const ( HealthData MetadataKey = "healthData" InfraData MetadataKey = "infraData" IsCanary MetadataKey = "isCanary" IsExternal MetadataKey = "isExternal" IsInaccessible MetadataKey = "isInaccessible" IsMTLS MetadataKey = "isMTLS" Version MetadataKey = "version" )
Metadata keys to be used instead of literal strings
type NamespaceInfoMap ¶
type NamespaceInfoMap map[string]NamespaceInfo
func NewNamespaceInfoMap ¶
func NewNamespaceInfoMap() NamespaceInfoMap
type Node ¶
type Node struct { Cluster string // cluster name Edges []*Edge // child nodes ID string // unique identifier for the node InfraName string // infra name InfraType string // set to appropriate InfraType Metadata Metadata // app-specific data Namespace string // namespace name NodeType string // Node type }
type Options ¶
type Options struct { AccessibleNamespaces AccessibleNamespaces Appenders RequestedAppenders // requested appenders, nil if param not supplied ConfigVendor string Namespaces NamespaceInfoMap ConfigOptions }
Options comprises all available options