business

package
v1.84.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 65 Imported by: 56

Documentation

Index

Constants

View Source
const (
	IstioDefaultCASecret string = "istio-ca-secret"
	UserProvidedCASecret string = "cacerts"
	CACert               string = "ca-cert.pem"
	CAChainCert          string = "cert-chain.pem"
)
View Source
const (
	IstiodClusterIDEnvKey          = "CLUSTER_ID"
	IstiodExternalEnvKey           = "EXTERNAL_ISTIOD"
	IstiodScopeGatewayEnvKey       = "PILOT_SCOPE_GATEWAY_TO_NAMESPACE"
	IstioInjectionLabel            = "istio-injection"
	IstioRevisionLabel             = "istio.io/rev"
	IstioControlPlaneClustersLabel = "topology.istio.io/controlPlaneClusters"
)
View Source
const (
	MTLSEnabled          = "MTLS_ENABLED"
	MTLSPartiallyEnabled = "MTLS_PARTIALLY_ENABLED"
	MTLSNotEnabled       = "MTLS_NOT_ENABLED"
	MTLSDisabled         = "MTLS_DISABLED"
)
View Source
const (
	AllowAny = "ALLOW_ANY"
)

Variables

View Source
var GrafanaDashboardSupplier = findDashboard

Annotation Filter for Health

View Source
var ValidProxyLogLevels = []string{"off", "trace", "debug", "info", "warning", "error", "critical"}

ValidProxyLogLevels are the application log levels supported by the envoy admin interface.

Functions

func FakeCustomControllerRSSyncedWithPods added in v1.33.0

func FakeCustomControllerRSSyncedWithPods() []apps_v1.ReplicaSet

func FakeDaemonSets added in v1.33.0

func FakeDaemonSets() []apps_v1.DaemonSet

func FakeDepSyncedWithRS

func FakeDepSyncedWithRS() []apps_v1.Deployment

func FakeDeploymentConfigs

func FakeDeploymentConfigs() []osapps_v1.DeploymentConfig

func FakeDeployments

func FakeDeployments(conf config.Config) []apps_v1.Deployment

func FakeDuplicatedDeployments added in v0.9.1

func FakeDuplicatedDeployments() []apps_v1.Deployment

func FakeDuplicatedReplicaSets added in v0.9.1

func FakeDuplicatedReplicaSets() []apps_v1.ReplicaSet

func FakeDuplicatedStatefulSets added in v0.9.1

func FakeDuplicatedStatefulSets() []apps_v1.StatefulSet

func FakePodLogsProxy added in v1.33.0

func FakePodLogsProxy() *kubernetes.PodLogs

func FakePodLogsSyncedWithDeployments added in v0.18.0

func FakePodLogsSyncedWithDeployments() *kubernetes.PodLogs

func FakePodLogsZtunnel added in v1.84.0

func FakePodLogsZtunnel() *kubernetes.PodLogs

func FakePodSyncedWithDeployments added in v0.18.0

func FakePodSyncedWithDeployments() *core_v1.Pod

func FakePodsFromCustomController added in v1.33.0

func FakePodsFromCustomController() []core_v1.Pod

func FakePodsNoController

func FakePodsNoController() []core_v1.Pod

func FakePodsSyncedWithDeployments

func FakePodsSyncedWithDeployments() []core_v1.Pod

func FakePodsSyncedWithDuplicated added in v0.9.1

func FakePodsSyncedWithDuplicated() []core_v1.Pod

func FakeRSSyncedWithPods

func FakeRSSyncedWithPods() []apps_v1.ReplicaSet

func FakeReplicaSets

func FakeReplicaSets(conf config.Config) []apps_v1.ReplicaSet

func FakeReplicationControllers

func FakeReplicationControllers() []core_v1.ReplicationController

func FakeServices

func FakeServices() []core_v1.Service

func FakeStatefulSets

func FakeStatefulSets() []apps_v1.StatefulSet

func FakeZtunnelDaemonSet added in v1.84.0

func FakeZtunnelDaemonSet() []apps_v1.DaemonSet

func FakeZtunnelPods added in v1.84.0

func FakeZtunnelPods() []core_v1.Pod

func FilterUniqueIstioReferences added in v1.42.0

func FilterUniqueIstioReferences(refs []*models.IstioValidationKey) []*models.IstioValidationKey

func FilterWorkloadReferences added in v1.42.0

func FilterWorkloadReferences(wSelector string, istioConfigList models.IstioConfigList) []*models.IstioValidationKey

func FindOrFail added in v1.73.0

func FindOrFail[T any](t *testing.T, s []T, f func(T) bool) T

FindOrFail will find an element in a slice or fail the test.

func GetGrafanaInfo added in v1.29.0

func GetGrafanaInfo(dashboardSupplier dashboardSupplier) (*models.GrafanaInfo, int, error)

GetGrafanaInfo returns the Grafana URL and other info, the HTTP status code (int) and eventually an error

func GetGrafanaLinks(linksSpec []dashboards.MonitoringDashboardExternalLink) ([]models.ExternalLink, int, error)

GetGrafanaLinks returns the links to Grafana dashboards and other info, the HTTP status code (int) and eventually an error

func GetIstioAPI added in v0.9.1

func GetIstioAPI(resourceType string) bool

GetIstioAPI provides the Kubernetes API that manages this Istio resource type or empty string if it's not managed

func GetIstioScaler added in v1.27.0

func GetIstioScaler() func(name string) float64

func GetWorkloadStatus added in v1.33.0

func GetWorkloadStatus(wl models.Workload) string

func IsAccessibleError added in v1.10.0

func IsAccessibleError(err error) bool

func IsValidProxyLogLevel added in v1.41.0

func IsValidProxyLogLevel(level string) bool

IsValidLogLevel determines if the provided string is a valid proxy log level. This can be called before calling SetLogLevel.

func IstioConfigMapName added in v1.73.4

func IstioConfigMapName(conf config.Config, revision string) string

IstioConfigMapName guesses the istio configmap name.

func NewControlPlaneMonitor added in v1.78.0

func NewControlPlaneMonitor(cache cache.KialiCache, clientFactory kubernetes.ClientFactory, conf config.Config, meshService *MeshService) *controlPlaneMonitor

func SetWithBackends

func SetWithBackends(cf kubernetes.ClientFactory, prom prometheus.ClientInterface)

SetWithBackends allows for specifying the ClientFactory and Prometheus clients to be used. Mock friendly. Used only with tests.

func SetupBusinessLayer added in v1.66.0

func SetupBusinessLayer(t *testing.T, k8s kubernetes.ClientInterface, config config.Config) cache.KialiCache

SetupBusinessLayer mocks out some global variables in the business package such as the kiali cache and the prometheus client.

func Start added in v1.46.0

func Start(cf kubernetes.ClientFactory, controlPlaneMonitor ControlPlaneMonitor, cache cache.KialiCache, prom prometheus.ClientInterface, traceClientLoader func() tracing.ClientInterface)

Start sets the globals necessary for the business layer. TODO: Refactor out global vars.

func WithControlPlaneMonitor added in v1.78.0

func WithControlPlaneMonitor(cpm ControlPlaneMonitor)

WithControlPlaneMonitor is a testing func that lets you replace the global cpm var.

func WithKialiCache added in v1.66.0

func WithKialiCache(cache cache.KialiCache)

WithKialiCache is a testing func that lets you replace the global cache var.

func WithProm added in v1.66.0

func WithProm(prom prometheus.ClientInterface)

WithProm is a testing func that lets you replace the global prom client var.

Types

type AccessLogEntry added in v1.33.0

type AccessLogEntry struct {
	Timestamp     string `json:"timestamp,omitempty"`
	TimestampUnix int64  `json:"timestampUnix,omitempty"`
}

AccessLogEntry provides parsed info from a single proxy access log entry

type AccessibleNamespaceError added in v1.10.0

type AccessibleNamespaceError struct {
	// contains filtered or unexported fields
}

func (*AccessibleNamespaceError) Error added in v1.10.0

func (in *AccessibleNamespaceError) Error() string

type AppCriteria added in v1.48.0

type AppCriteria struct {
	Namespace             string
	Cluster               string
	AppName               string
	IncludeIstioResources bool
	IncludeHealth         bool
	RateInterval          string
	QueryTime             time.Time
}

type AppService

type AppService struct {
	// contains filtered or unexported fields
}

AppService deals with fetching Workloads group by "app" label, which will be identified as an "application"

func (*AppService) GetAppDetails added in v1.48.0

func (in *AppService) GetAppDetails(ctx context.Context, criteria AppCriteria) (models.App, error)

GetApp is the API handler to fetch the details for a given namespace and app name

func (*AppService) GetAppList

func (in *AppService) GetAppList(ctx context.Context, criteria AppCriteria) (models.AppList, error)

GetAppList is the API handler to fetch the list of applications in a given namespace

func (*AppService) GetClusterAppList added in v1.82.1

func (in *AppService) GetClusterAppList(ctx context.Context, criteria AppCriteria) (models.ClusterApps, error)

GetClusterAppList is the API handler to fetch the list of applications in a given namespace and cluster

type ControlPlane added in v1.73.0

type ControlPlane struct {
	// Cluster the kube cluster that the controlplane is running on.
	Cluster *kubernetes.Cluster

	// Config
	Config ControlPlaneConfiguration

	// ExternalControlPlane indicates if the controlplane is managing an external cluster.
	ExternalControlPlane bool

	// ID is the control plane ID as known by istiod.
	ID string

	// IstiodName is the control plane name
	IstiodName string

	// IstiodNamespace is the namespace name of the deployed control plane
	IstiodNamespace string

	// ManagedClusters are the clusters that this controlplane manages.
	// This could include the cluster that the controlplane is running on.
	ManagedClusters []*kubernetes.Cluster

	// ManagesExternal indicates if the controlplane manages an external cluster.
	// It could also manage the cluster that it is running on.
	ManagesExternal bool

	// Revision is the revision of the controlplane.
	// Can be empty when it's the default revision.
	Revision string
}

ControlPlane manages the dataPlane for one or more kube clusters. It's expected to manage the cluster that it is deployed in. It has configuration for all the clusters/namespaces associated with it.

type ControlPlaneConfiguration added in v1.73.0

type ControlPlaneConfiguration struct {
	// IsGatewayToNamespace specifies the PILOT_SCOPE_GATEWAY_TO_NAMESPACE environment variable in Control Plane
	// This is not currently used by the frontend so excluding it from the API response.
	IsGatewayToNamespace bool `json:"-"`

	// OutboundTrafficPolicy is the outbound traffic policy for the controlplane.
	OutboundTrafficPolicy models.OutboundPolicy

	// Network is the name of the network that the controlplane is using.
	Network string

	// IstioMeshConfig comes from the istio configmap.
	kubernetes.IstioMeshConfig
}

ControlPlaneConfiguration is the configuration for the controlPlane and any associated dataPlane.

type ControlPlaneMonitor added in v1.78.0

type ControlPlaneMonitor interface {
	PollIstiodForProxyStatus(ctx context.Context)
	CanConnectToIstiod(client kubernetes.ClientInterface) (kubernetes.IstioComponentStatus, error)
	CanConnectToIstiodForRevision(client kubernetes.ClientInterface, revision string) (kubernetes.IstioComponentStatus, error)
	// RefreshIstioCache should update the kiali cache's istio related stores.
	RefreshIstioCache(ctx context.Context) error
}

ControlPlaneMonitor is an interface for the control plane monitor. This is an interface solely for testing purposes since we need to mock out portforwarding and polling.

type DashboardsService added in v0.12.0

type DashboardsService struct {
	CustomEnabled bool
	// contains filtered or unexported fields
}

DashboardsService deals with fetching dashboards from config

func NewDashboardsService added in v0.12.0

func NewDashboardsService(namespace *models.Namespace, workload *models.Workload) *DashboardsService

NewDashboardsService initializes this business service

func (*DashboardsService) BuildIstioDashboard added in v1.27.0

func (in *DashboardsService) BuildIstioDashboard(metrics models.MetricsMap, direction string) *models.MonitoringDashboard

BuildIstioDashboard returns Istio dashboard filled-in with metrics

func (*DashboardsService) GetCustomDashboardRefs added in v0.17.0

func (in *DashboardsService) GetCustomDashboardRefs(namespace, app, version string, pods []*models.Pod) []models.Runtime

GetCustomDashboardRefs finds all dashboard IDs and Titles associated to this app and add them to the model

func (*DashboardsService) GetDashboard added in v0.12.0

func (in *DashboardsService) GetDashboard(params models.DashboardQuery, template string) (*models.MonitoringDashboard, error)

GetDashboard returns a dashboard filled-in with target data

func (*DashboardsService) SearchExplicitDashboards added in v1.27.0

func (in *DashboardsService) SearchExplicitDashboards(pods []models.Pod) []models.Runtime

SearchExplicitDashboards will check annotations of all supplied pods to extract a unique list of dashboards Accepted annotations are "kiali.io/runtimes" and "kiali.io/dashboards"

type FakeControlPlaneMonitor added in v1.78.0

type FakeControlPlaneMonitor struct {
	// contains filtered or unexported fields
}

FakeControlPlaneMonitor is used for testing and implements ControlPlaneMonitor.

func (*FakeControlPlaneMonitor) CanConnectToIstiod added in v1.78.0

func (*FakeControlPlaneMonitor) CanConnectToIstiodForRevision added in v1.78.0

func (f *FakeControlPlaneMonitor) CanConnectToIstiodForRevision(client kubernetes.ClientInterface, revision string) (kubernetes.IstioComponentStatus, error)

func (*FakeControlPlaneMonitor) PollIstiodForProxyStatus added in v1.78.0

func (f *FakeControlPlaneMonitor) PollIstiodForProxyStatus(ctx context.Context)

func (*FakeControlPlaneMonitor) RefreshIstioCache added in v1.78.0

func (f *FakeControlPlaneMonitor) RefreshIstioCache(ctx context.Context) error

type HealthService

type HealthService struct {
	// contains filtered or unexported fields
}

HealthService deals with fetching health from various sources and convert to kiali model

func (*HealthService) GetAppHealth

func (in *HealthService) GetAppHealth(ctx context.Context, namespace, cluster, app, rateInterval string, queryTime time.Time, appD *appDetails) (models.AppHealth, error)

GetAppHealth returns an app health from just Namespace and app name (thus, it fetches data from K8S and Prometheus)

func (*HealthService) GetNamespaceAppHealth

func (in *HealthService) GetNamespaceAppHealth(ctx context.Context, criteria NamespaceHealthCriteria) (models.NamespaceAppHealth, error)

GetNamespaceAppHealth returns a health for all apps in given Namespace (thus, it fetches data from K8S and Prometheus)

func (*HealthService) GetNamespaceServiceHealth

func (in *HealthService) GetNamespaceServiceHealth(ctx context.Context, criteria NamespaceHealthCriteria) (models.NamespaceServiceHealth, error)

GetNamespaceServiceHealth returns a health for all services in given Namespace (thus, it fetches data from K8S and Prometheus)

func (*HealthService) GetNamespaceWorkloadHealth

func (in *HealthService) GetNamespaceWorkloadHealth(ctx context.Context, criteria NamespaceHealthCriteria) (models.NamespaceWorkloadHealth, error)

GetNamespaceWorkloadHealth returns a health for all workloads in given Namespace (thus, it fetches data from K8S and Prometheus)

func (*HealthService) GetServiceHealth

func (in *HealthService) GetServiceHealth(ctx context.Context, namespace, cluster, service, rateInterval string, queryTime time.Time, svc *models.Service) (models.ServiceHealth, error)

GetServiceHealth returns a service health (service request error rate)

func (*HealthService) GetWorkloadHealth

func (in *HealthService) GetWorkloadHealth(ctx context.Context, namespace, cluster, workload, rateInterval string, queryTime time.Time, w *models.Workload) (models.WorkloadHealth, error)

GetWorkloadHealth returns a workload health from just Namespace and workload (thus, it fetches data from K8S and Prometheus)

type IstioCertsService added in v1.40.0

type IstioCertsService struct {
	// contains filtered or unexported fields
}

func (*IstioCertsService) GetCertsInfo added in v1.40.0

func (ics *IstioCertsService) GetCertsInfo() ([]models.CertInfo, error)

func (*IstioCertsService) GetTlsMinVersion added in v1.59.0

func (ics *IstioCertsService) GetTlsMinVersion() (string, error)

type IstioConfigCriteria

type IstioConfigCriteria struct {
	IncludeGateways               bool
	IncludeK8sGateways            bool
	IncludeK8sGRPCRoutes          bool
	IncludeK8sHTTPRoutes          bool
	IncludeK8sReferenceGrants     bool
	IncludeK8sTCPRoutes           bool
	IncludeK8sTLSRoutes           bool
	IncludeVirtualServices        bool
	IncludeDestinationRules       bool
	IncludeServiceEntries         bool
	IncludeSidecars               bool
	IncludeAuthorizationPolicies  bool
	IncludePeerAuthentications    bool
	IncludeWorkloadEntries        bool
	IncludeWorkloadGroups         bool
	IncludeRequestAuthentications bool
	IncludeEnvoyFilters           bool
	IncludeWasmPlugins            bool
	IncludeTelemetry              bool
	LabelSelector                 string
	WorkloadSelector              string
}

func ParseIstioConfigCriteria added in v1.20.0

func ParseIstioConfigCriteria(objects, labelSelector, workloadSelector string) IstioConfigCriteria

func (IstioConfigCriteria) Include added in v1.24.0

func (icc IstioConfigCriteria) Include(resource string) bool

type IstioConfigService

type IstioConfigService struct {
	// contains filtered or unexported fields
}

func (*IstioConfigService) CreateIstioConfigDetail added in v0.14.0

func (in *IstioConfigService) CreateIstioConfigDetail(ctx context.Context, cluster, namespace, resourceType string, body []byte) (models.IstioConfigDetails, error)

func (*IstioConfigService) DeleteIstioConfigDetail added in v0.9.1

func (in *IstioConfigService) DeleteIstioConfigDetail(ctx context.Context, cluster, namespace, resourceType, name string) error

DeleteIstioConfigDetail deletes the given Istio resource

func (*IstioConfigService) GatewayAPIClasses added in v1.74.0

func (in *IstioConfigService) GatewayAPIClasses(cluster string) []config.GatewayAPIClass

func (*IstioConfigService) GetIstioConfigDetails

func (in *IstioConfigService) GetIstioConfigDetails(ctx context.Context, cluster, namespace, objectType, object string) (models.IstioConfigDetails, error)

GetIstioConfigDetails returns a specific Istio configuration object. It uses following parameters: - "namespace": namespace where configuration is stored - "objectType": type of the configuration - "object": name of the configuration

func (*IstioConfigService) GetIstioConfigList added in v0.9.1

func (in *IstioConfigService) GetIstioConfigList(ctx context.Context, cluster string, criteria IstioConfigCriteria) (*models.IstioConfigList, error)

func (*IstioConfigService) GetIstioConfigListForNamespace added in v1.82.0

func (in *IstioConfigService) GetIstioConfigListForNamespace(ctx context.Context, cluster, namespace string, criteria IstioConfigCriteria) (*models.IstioConfigList, error)

func (*IstioConfigService) GetIstioConfigMap added in v1.69.0

func (in *IstioConfigService) GetIstioConfigMap(ctx context.Context, namespace string, criteria IstioConfigCriteria) (models.IstioConfigMap, error)

GetIstioConfigMap returns a map of Istio config objects list per cluster @TODO this method should replace GetIstioConfigList

func (*IstioConfigService) GetIstioConfigPermissions added in v1.29.0

func (in *IstioConfigService) GetIstioConfigPermissions(ctx context.Context, namespaces []string, cluster string) models.IstioConfigPermissions

func (*IstioConfigService) IsAmbientEnabled added in v1.67.0

func (in *IstioConfigService) IsAmbientEnabled(cluster string) bool

func (*IstioConfigService) IsGatewayAPI added in v1.58.0

func (in *IstioConfigService) IsGatewayAPI(cluster string) bool

func (*IstioConfigService) UpdateIstioConfigDetail added in v0.12.0

func (in *IstioConfigService) UpdateIstioConfigDetail(ctx context.Context, cluster, namespace, resourceType, name, jsonPatch string) (models.IstioConfigDetails, error)

type IstioStatusService added in v1.18.0

type IstioStatusService struct {
	// contains filtered or unexported fields
}

SvcService deals with fetching istio/kubernetes services related content and convert to kiali model

func NewIstioStatusService added in v1.78.0

func NewIstioStatusService(userClients map[string]kubernetes.ClientInterface, businessLayer *Layer, cpm ControlPlaneMonitor) IstioStatusService

func (*IstioStatusService) GetStatus added in v1.18.0

type IstioValidationsService

type IstioValidationsService struct {
	// contains filtered or unexported fields
}

func (*IstioValidationsService) GetIstioObjectValidations

func (in *IstioValidationsService) GetIstioObjectValidations(ctx context.Context, cluster, namespace string, objectType string, object string) (models.IstioValidations, models.IstioReferencesMap, error)

GetIstioObjectValidations validates a single Istio object of the given type with the given name found in the given namespace.

func (*IstioValidationsService) GetValidations added in v0.14.0

func (in *IstioValidationsService) GetValidations(ctx context.Context, cluster, namespace, service, workload string) (models.IstioValidations, error)

GetValidations returns an IstioValidations object with all the checks found when running all the enabled checkers. If service is "" then the whole namespace is validated. If service is not empty string, then all of its associated Istio objects are validated.

type Layer

type Layer struct {
	App            AppService
	Health         HealthService
	IstioConfig    IstioConfigService
	IstioStatus    IstioStatusService
	IstioCerts     IstioCertsService
	Tracing        TracingService
	Mesh           MeshService
	Namespace      NamespaceService
	ProxyLogging   ProxyLoggingService
	ProxyStatus    ProxyStatusService
	RegistryStatus RegistryStatusService
	Svc            SvcService
	TLS            TLSService
	Validations    IstioValidationsService
	Workload       WorkloadService
}

Layer is a container for fast access to inner services. A business layer is created per token/user. Any data that needs to be saved across layers is saved in the Kiali Cache.

func Get

func Get(authInfo *api.AuthInfo) (*Layer, error)

Get the business.Layer

func NewLayer added in v1.79.0

NewLayer creates the business layer using the passed k8sClients and prom clients. Note that the client passed here should *not* be the Kiali ServiceAccount client. It should be the user client based on the logged in user's token.

func NewWithBackends added in v0.10.0

func NewWithBackends(userClients map[string]kubernetes.ClientInterface, kialiSAClients map[string]kubernetes.ClientInterface, prom prometheus.ClientInterface, traceClient tracing.ClientInterface) *Layer

NewWithBackends creates the business layer using the passed k8sClients and prom clients. Note that the client passed here should *not* be the Kiali ServiceAccount client. It should be the user client based on the logged in user's token.

type LogEntry added in v1.25.0

type LogEntry struct {
	Message       string            `json:"message,omitempty"`
	Severity      string            `json:"severity,omitempty"`
	OriginalTime  time.Time         `json:"-"`
	Timestamp     string            `json:"timestamp,omitempty"`
	TimestampUnix int64             `json:"timestampUnix,omitempty"`
	AccessLog     *parser.AccessLog `json:"accessLog,omitempty"`
}

LogEntry holds a single log entry

type LogOptions added in v1.26.0

type LogOptions struct {
	Duration *time.Duration
	LogType  models.LogType
	MaxLines *int
	core_v1.PodLogOptions
	// contains filtered or unexported fields
}

LogOptions holds query parameter values

type Mesh added in v1.73.0

type Mesh struct {
	// ControlPlanes that share the same mesh ID.
	ControlPlanes []ControlPlane
}

Mesh is one or more controlplanes (primaries) managing a dataPlane across one or more clusters. There can be multiple primaries on a single cluster when istio revisions are used. A single primary can also manage multiple clusters (primary-remote deployment).

type MeshService added in v1.29.0

type MeshService struct {
	// contains filtered or unexported fields
}

MeshService is a support service for retrieving data about the mesh environment when Istio is installed with multi-cluster enabled. Prefer initializing this type via the NewMeshService function.

func NewMeshService added in v1.29.0

func NewMeshService(kialiSAClients map[string]kubernetes.ClientInterface, cache cache.KialiCache, namespaceService NamespaceService, conf config.Config) MeshService

NewMeshService initializes a new MeshService structure with the given k8s clients.

func (*MeshService) CanaryUpgradeStatus added in v1.60.0

func (in *MeshService) CanaryUpgradeStatus() (*models.CanaryUpgradeStatus, error)

func (*MeshService) GetClusters added in v1.29.0

func (in *MeshService) GetClusters() ([]kubernetes.Cluster, error)

GetClusters resolves the Kubernetes clusters that are hosting the mesh. Resolution is done as best-effort using the resources that are present in the cluster.

func (*MeshService) GetMesh added in v1.73.0

func (in *MeshService) GetMesh(ctx context.Context) (*Mesh, error)

GetMesh gathers information about the mesh and controlplanes running in the mesh from various sources e.g. istio configmap, istiod deployment envvars, etc.

func (*MeshService) IsRemoteCluster added in v1.75.0

func (in *MeshService) IsRemoteCluster(ctx context.Context, cluster string) bool

IsRemoteCluster determines if the cluster has a controlplane or if it's a remote cluster without one. Clusters that do not exist or are not accessible are considered remote clusters.

func (*MeshService) IsValidCluster added in v1.68.0

func (in *MeshService) IsValidCluster(cluster string) bool

Checks if a cluster exist

func (*MeshService) IstiodResourceThresholds added in v1.57.0

func (in *MeshService) IstiodResourceThresholds() (*models.IstiodThresholds, error)

func (*MeshService) OutboundTrafficPolicy added in v1.53.0

func (in *MeshService) OutboundTrafficPolicy() (*models.OutboundPolicy, error)

type MetricsLabelsBuilder added in v1.27.0

type MetricsLabelsBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricsLabelsBuilder added in v1.27.0

func NewMetricsLabelsBuilder(direction string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) Add added in v1.27.0

func (lb *MetricsLabelsBuilder) Add(key, value string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) Aggregate added in v1.27.0

func (lb *MetricsLabelsBuilder) Aggregate(key, value string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) App added in v1.27.0

func (lb *MetricsLabelsBuilder) App(name, namespace string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) Build added in v1.27.0

func (lb *MetricsLabelsBuilder) Build() string

func (*MetricsLabelsBuilder) BuildForErrors added in v1.27.0

func (lb *MetricsLabelsBuilder) BuildForErrors() []string

func (*MetricsLabelsBuilder) Cluster added in v1.68.0

func (lb *MetricsLabelsBuilder) Cluster(cluster string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) Namespace added in v1.27.0

func (lb *MetricsLabelsBuilder) Namespace(namespace string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) PeerApp added in v1.27.0

func (lb *MetricsLabelsBuilder) PeerApp(name, namespace string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) PeerNamespace added in v1.27.0

func (lb *MetricsLabelsBuilder) PeerNamespace(namespace string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) PeerService added in v1.27.0

func (lb *MetricsLabelsBuilder) PeerService(name, namespace string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) PeerWorkload added in v1.27.0

func (lb *MetricsLabelsBuilder) PeerWorkload(name, namespace string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) Protocol added in v1.27.0

func (lb *MetricsLabelsBuilder) Protocol(name string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) QueryScope added in v1.48.0

func (lb *MetricsLabelsBuilder) QueryScope() *MetricsLabelsBuilder

QueryScope adds scope labels, if configured

func (*MetricsLabelsBuilder) Reporter added in v1.27.0

func (lb *MetricsLabelsBuilder) Reporter(name string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) SelfReporter added in v1.27.0

func (lb *MetricsLabelsBuilder) SelfReporter() *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) Service added in v1.27.0

func (lb *MetricsLabelsBuilder) Service(name, namespace string) *MetricsLabelsBuilder

func (*MetricsLabelsBuilder) Workload added in v1.27.0

func (lb *MetricsLabelsBuilder) Workload(name, namespace string) *MetricsLabelsBuilder

type MetricsService added in v1.27.0

type MetricsService struct {
	// contains filtered or unexported fields
}

MetricsService deals with fetching metrics from prometheus

func NewMetricsService added in v1.27.0

func NewMetricsService(prom prometheus.ClientInterface) *MetricsService

NewMetricsService initializes this business service

func (*MetricsService) GetControlPlaneMetrics added in v1.57.0

func (in *MetricsService) GetControlPlaneMetrics(q models.IstioMetricsQuery, scaler func(n string) float64) (models.MetricsMap, error)

func (*MetricsService) GetMetrics added in v1.27.0

func (in *MetricsService) GetMetrics(q models.IstioMetricsQuery, scaler func(n string) float64) (models.MetricsMap, error)

func (*MetricsService) GetStats added in v1.27.0

func (in *MetricsService) GetStats(queries []models.MetricsStatsQuery) (map[string]models.MetricsStats, error)

GetStats computes metrics stats, currently response times, for a set of queries

type NamespaceHealthCriteria added in v1.56.0

type NamespaceHealthCriteria struct {
	IncludeMetrics bool
	Namespace      string
	Cluster        string
	QueryTime      time.Time
	RateInterval   string
}

type NamespaceService

type NamespaceService struct {
	// contains filtered or unexported fields
}

NamespaceService deals with fetching k8sClients namespaces / OpenShift projects and convert to kiali model

func NewNamespaceService

func NewNamespaceService(userClients map[string]kubernetes.ClientInterface, kialiSAClients map[string]kubernetes.ClientInterface, cache cache.KialiCache, conf *config.Config) NamespaceService

func (*NamespaceService) GetClusterList added in v1.72.0

func (in *NamespaceService) GetClusterList() []string

GetClusterList Returns a list of cluster names based on the user clients

func (*NamespaceService) GetClusterNamespace added in v1.72.0

func (in *NamespaceService) GetClusterNamespace(ctx context.Context, namespace string, cluster string) (*models.Namespace, error)

GetClusterNamespace returns the definition of the specified namespace.

func (*NamespaceService) GetClusterNamespaces added in v1.72.0

func (in *NamespaceService) GetClusterNamespaces(ctx context.Context, cluster string) ([]models.Namespace, error)

GetClusterNamespaces is just a convenience routine that filters GetNamespaces for a particular cluster

func (*NamespaceService) GetNamespaceClusters added in v1.71.0

func (in *NamespaceService) GetNamespaceClusters(ctx context.Context, namespace string) ([]models.Namespace, error)

GetNamespaceClusters is a convenience routine that filters GetNamespaces for a particular namespace

func (*NamespaceService) GetNamespaces

func (in *NamespaceService) GetNamespaces(ctx context.Context) ([]models.Namespace, error)

Returns a list of the given namespaces / projects

func (*NamespaceService) UpdateNamespace added in v1.22.1

func (in *NamespaceService) UpdateNamespace(ctx context.Context, namespace string, jsonPatch string, cluster string) (*models.Namespace, error)

type OAuthAuthorizationServer added in v0.16.0

type OAuthAuthorizationServer struct {
	AuthorizationEndpoint string `json:"authorization_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
	Issuer                string `json:"issuer"`
}

Structure that's returned by the openshift oauth authorization server. It defaults to following the snake_case format, so we parse it to something more usable on our side.

type OAuthConfig added in v1.84.0

type OAuthConfig struct {
	TokenAgeInSeconds int
}

OAuthConfig is some configuration for the OAuth service.

type ObjectChecker

type ObjectChecker interface {
	Check() models.IstioValidations
}

type OpenshiftOAuthService added in v0.16.0

type OpenshiftOAuthService struct {
	// contains filtered or unexported fields
}

func NewOpenshiftOAuthService added in v1.84.0

func NewOpenshiftOAuthService(ctx context.Context, conf *config.Config, kialiSAClients map[string]kubernetes.ClientInterface, clientFactory kubernetes.ClientFactory) (*OpenshiftOAuthService, error)

NewOpenshiftOAuthService creates a new OpenshiftOAuthService. It will try to autodiscover the OAuth server configuration from each cluster. It also assumes that you've created an OAuthClient for Kiali in each cluster.

func (*OpenshiftOAuthService) AuthCodeURL added in v1.84.0

func (in *OpenshiftOAuthService) AuthCodeURL(verifier string, cluster string) (string, error)

AuthCodeURL returns the URL to redirect the user to for authentication.

func (*OpenshiftOAuthService) Exchange added in v1.84.0

func (in *OpenshiftOAuthService) Exchange(ctx context.Context, code string, verifier string, cluster string) (*oauth2.Token, error)

Exchange exchanges the code for a token that can be used to talk to the kube API server.

func (*OpenshiftOAuthService) GetUserInfo added in v0.16.0

func (in *OpenshiftOAuthService) GetUserInfo(ctx context.Context, token string) (*user_v1.User, error)

func (*OpenshiftOAuthService) Logout added in v0.20.0

func (in *OpenshiftOAuthService) Logout(ctx context.Context, token string, cluster string) error

Logout deletes the oauth access token from the API server.

func (*OpenshiftOAuthService) OAuthConfig added in v1.84.0

func (in *OpenshiftOAuthService) OAuthConfig(cluster string) (*OAuthConfig, error)

type PodLog added in v1.25.0

type PodLog struct {
	Entries        []LogEntry `json:"entries,omitempty"`
	LinesTruncated bool       `json:"linesTruncated,omitempty"`
}

PodLog reports log entries

type ProxyLoggingService added in v1.41.0

type ProxyLoggingService struct {
	// contains filtered or unexported fields
}

ProxyLoggingService is a thin layer over the kube interface for proxy logging functions.

func (*ProxyLoggingService) SetLogLevel added in v1.41.0

func (in *ProxyLoggingService) SetLogLevel(cluster, namespace, pod, level string) error

SetLogLevel sets the pod's proxy log level.

type ProxyStatusService added in v1.35.0

type ProxyStatusService struct {
	// contains filtered or unexported fields
}

func (*ProxyStatusService) GetConfigDump added in v1.35.0

func (in *ProxyStatusService) GetConfigDump(cluster, namespace, pod string) (models.EnvoyProxyDump, error)

func (*ProxyStatusService) GetConfigDumpResourceEntries added in v1.35.0

func (in *ProxyStatusService) GetConfigDumpResourceEntries(cluster, namespace, pod, resource string) (*models.EnvoyProxyDump, error)

func (*ProxyStatusService) GetPodProxyStatus added in v1.35.0

func (in *ProxyStatusService) GetPodProxyStatus(cluster, ns, pod string) *models.ProxyStatus

type ReferenceChecker added in v1.47.0

type ReferenceChecker interface {
	References() models.IstioReferencesMap
}

type RegistryCriteria added in v1.44.0

type RegistryCriteria struct {
	// When AllNamespaces is true Namespace criteria is ignored
	// Note this flag is only supported in Registry queries
	AllNamespaces   bool
	Cluster         string
	Namespace       string
	ServiceName     string
	ServiceSelector string
}

type RegistryStatusService added in v1.35.0

type RegistryStatusService struct {
	// contains filtered or unexported fields
}

func (*RegistryStatusService) GetRegistryServices added in v1.44.0

func (in *RegistryStatusService) GetRegistryServices(criteria RegistryCriteria) []*kubernetes.RegistryService

type ServiceCriteria added in v1.43.0

type ServiceCriteria struct {
	Cluster                string
	Namespace              string
	IncludeHealth          bool
	IncludeIstioResources  bool
	IncludeOnlyDefinitions bool
	ServiceSelector        string
	RateInterval           string
	QueryTime              time.Time
}

type SpanFilter added in v1.24.0

type SpanFilter = func(span *jaegerModels.Span) bool

type SvcService

type SvcService struct {
	// contains filtered or unexported fields
}

SvcService deals with fetching istio/kubernetes services related content and convert to kiali model

func (*SvcService) GetService

func (in *SvcService) GetService(ctx context.Context, cluster, namespace, service string) (models.Service, error)

func (*SvcService) GetServiceAppName added in v1.24.0

func (in *SvcService) GetServiceAppName(ctx context.Context, cluster, namespace, service string) (string, error)

GetServiceAppName returns the "Application" name (app label) that relates to a service This label is taken from the service selector, which means it is assumed that pods are selected using that label

func (*SvcService) GetServiceDetails added in v1.43.0

func (in *SvcService) GetServiceDetails(ctx context.Context, cluster, namespace, service, interval string, queryTime time.Time) (*models.ServiceDetails, error)

GetService returns a single service and associated data using the interval and queryTime

func (*SvcService) GetServiceList

func (in *SvcService) GetServiceList(ctx context.Context, criteria ServiceCriteria) (*models.ServiceList, error)

GetServiceList returns a list of all services for a given criteria

func (*SvcService) UpdateService added in v1.30.0

func (in *SvcService) UpdateService(ctx context.Context, cluster, namespace, service string, interval string, queryTime time.Time, jsonPatch string, patchType string) (*models.ServiceDetails, error)

type TLSService added in v0.16.0

type TLSService struct {
	// contains filtered or unexported fields
}

func (*TLSService) ClusterWideNSmTLSStatus added in v1.81.0

func (in *TLSService) ClusterWideNSmTLSStatus(ctx context.Context, nss []string, cluster string) ([]models.MTLSStatus, error)

func (*TLSService) MeshWidemTLSStatus added in v0.16.0

func (in *TLSService) MeshWidemTLSStatus(ctx context.Context, namespaces []string, cluster string) (models.MTLSStatus, error)

func (*TLSService) NamespaceWidemTLSStatus added in v0.16.0

func (in *TLSService) NamespaceWidemTLSStatus(ctx context.Context, namespace, cluster string) (models.MTLSStatus, error)

type TracingService added in v1.75.0

type TracingService struct {
	// contains filtered or unexported fields
}

func NewTracingService added in v1.79.0

func NewTracingService(conf *config.Config, tracing tracing.ClientInterface, svcService *SvcService, workloadService *WorkloadService) TracingService

func (*TracingService) GetAppSpans added in v1.75.0

func (in *TracingService) GetAppSpans(ns, app string, query models.TracingQuery) ([]model.TracingSpan, error)

func (*TracingService) GetAppTraces added in v1.75.0

func (in *TracingService) GetAppTraces(ns, app string, query models.TracingQuery) (*model.TracingResponse, error)

func (*TracingService) GetErrorTraces added in v1.75.0

func (in *TracingService) GetErrorTraces(ns, app string, duration time.Duration) (errorTraces int, err error)

func (*TracingService) GetServiceSpans added in v1.75.0

func (in *TracingService) GetServiceSpans(ctx context.Context, ns, service string, query models.TracingQuery) ([]model.TracingSpan, error)

func (*TracingService) GetServiceTraces added in v1.75.0

func (in *TracingService) GetServiceTraces(ctx context.Context, ns, service string, query models.TracingQuery) (*model.TracingResponse, error)

GetServiceTraces returns traces involving the requested service. Note that because the tracing API pulls traces by "App", only a subset of the traces may actually involve the requested service. Callers may need to upwardly adjust TracingQuery.Limit to get back the number of desired traces. It depends on the number of services backing the app. For example, if there are 2 services for the app, if evenly distributed, a query limit of 20 may return only 10 traces. The ratio is typically not as bad as it is with GetWorkloadTraces.

func (*TracingService) GetStatus added in v1.75.0

func (in *TracingService) GetStatus() (accessible bool, err error)

func (*TracingService) GetTraceDetail added in v1.75.0

func (in *TracingService) GetTraceDetail(traceID string) (trace *model.TracingSingleTrace, err error)

func (*TracingService) GetWorkloadSpans added in v1.75.0

func (in *TracingService) GetWorkloadSpans(ctx context.Context, ns, workload string, query models.TracingQuery) ([]model.TracingSpan, error)

func (*TracingService) GetWorkloadTraces added in v1.75.0

func (in *TracingService) GetWorkloadTraces(ctx context.Context, ns, workload string, query models.TracingQuery) (*model.TracingResponse, error)

GetWorkloadTraces returns traces involving the requested workload. Note that because the tracing API pulls traces by "App", only a subset of the traces may actually involve the requested workload. Callers may need to upwardly adjust TracingQuery.Limit to get back the number of desired traces. It depends on the number of workloads backing the app. For example, if there are 5 workloads for the app, if evenly distributed, a query limit of 25 may return only 5 traces.

type WorkloadCriteria added in v1.43.0

type WorkloadCriteria struct {
	Cluster               string
	Namespace             string
	WorkloadName          string
	WorkloadType          string
	IncludeIstioResources bool
	IncludeServices       bool
	IncludeHealth         bool
	RateInterval          string
	QueryTime             time.Time
}

type WorkloadService

type WorkloadService struct {
	// contains filtered or unexported fields
}

WorkloadService deals with fetching istio/kubernetes workloads related content and convert to kiali model

func NewWorkloadService added in v1.62.0

func NewWorkloadService(userClients map[string]kubernetes.ClientInterface, prom prometheus.ClientInterface, cache cache.KialiCache, layer *Layer, config *config.Config) *WorkloadService

func (*WorkloadService) BuildLogOptionsCriteria added in v1.27.0

func (in *WorkloadService) BuildLogOptionsCriteria(container, duration string, logType models.LogType, sinceTime, maxLines string) (*LogOptions, error)

func (*WorkloadService) GetPod added in v0.18.0

func (in *WorkloadService) GetPod(cluster, namespace, name string) (*models.Pod, error)

func (*WorkloadService) GetWorkload

func (in *WorkloadService) GetWorkload(ctx context.Context, criteria WorkloadCriteria) (*models.Workload, error)

GetWorkload is the API handler to fetch details of a specific workload. If includeServices is set true, the Workload will fetch all services related

func (*WorkloadService) GetWorkloadAppName added in v1.24.0

func (in *WorkloadService) GetWorkloadAppName(ctx context.Context, cluster, namespace, workload string) (string, error)

GetWorkloadAppName returns the "Application" name (app label) that relates to a workload

func (*WorkloadService) GetWorkloadList

func (in *WorkloadService) GetWorkloadList(ctx context.Context, criteria WorkloadCriteria) (models.WorkloadList, error)

GetWorkloadList is the API handler to fetch the list of workloads in a given namespace.

func (*WorkloadService) StreamPodLogs added in v1.53.0

func (in *WorkloadService) StreamPodLogs(cluster, namespace, name string, opts *LogOptions, w http.ResponseWriter) error

StreamPodLogs streams pod logs to an HTTP Response given the provided options

func (*WorkloadService) UpdateWorkload added in v1.22.0

func (in *WorkloadService) UpdateWorkload(ctx context.Context, cluster string, namespace string, workloadName string, workloadType string, includeServices bool, jsonPatch string, patchType string) (*models.Workload, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL