business

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: Apache-2.0 Imports: 44 Imported by: 56

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	VirtualServices        = "virtualservices"
	DestinationRules       = "destinationrules"
	ServiceEntries         = "serviceentries"
	Gateways               = "gateways"
	Rules                  = "rules"
	Adapters               = "adapters"
	Templates              = "templates"
	QuotaSpecs             = "quotaspecs"
	QuotaSpecBindings      = "quotaspecbindings"
	Policies               = "policies"
	MeshPolicies           = "meshpolicies"
	ClusterRbacConfigs     = "clusterrbacconfigs"
	RbacConfigs            = "rbacconfigs"
	ServiceRoles           = "serviceroles"
	ServiceRoleBindings    = "servicerolebindings"
	Sidecars               = "sidecars"
	ServiceMeshPolicies    = "servicemeshpolicies"
	ServiceMeshRbacConfigs = "servicemeshrbacconfigs"
	AuthorizationPolicies  = "authorizationpolicies"
)
View Source
const (
	MTLSEnabled          = "MTLS_ENABLED"
	MTLSPartiallyEnabled = "MTLS_PARTIALLY_ENABLED"
	MTLSNotEnabled       = "MTLS_NOT_ENABLED"
	MTLSDisabled         = "MTLS_DISABLED"
)

Variables ¶

This section is empty.

Functions ¶

func DashboardsConfig ¶ added in v1.1.0

func DashboardsConfig() (kconf.Config, klog.LogAdapter)

func FakeDepSyncedWithRS ¶

func FakeDepSyncedWithRS() []apps_v1.Deployment

func FakeDeploymentConfigs ¶

func FakeDeploymentConfigs() []osapps_v1.DeploymentConfig

func FakeDeployments ¶

func FakeDeployments() []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 FakePodLogsSyncedWithDeployments ¶ added in v0.18.0

func FakePodLogsSyncedWithDeployments() *kubernetes.PodLogs

func FakePodSyncedWithDeployments ¶ added in v0.18.0

func FakePodSyncedWithDeployments() *core_v1.Pod

func FakePodsFromDaemonSet ¶

func FakePodsFromDaemonSet() []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() []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 GetIstioAPI ¶ added in v0.9.1

func GetIstioAPI(resourceType string) string

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

func IsAccessibleError ¶ added in v1.10.0

func IsAccessibleError(err error) bool

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 Stop ¶ added in v1.9.0

func Stop()

Types ¶

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 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) GetApp ¶

func (in *AppService) GetApp(namespace string, appName string) (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(namespace string) (models.AppList, error)

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

type DashboardsService ¶ added in v0.12.0

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

DashboardsService deals with fetching dashboards from k8s client

func NewDashboardsService ¶ added in v0.12.0

func NewDashboardsService(prom prometheus.ClientInterface) DashboardsService

NewDashboardsService initializes this business service

func (*DashboardsService) GetCustomDashboardRefs ¶ added in v0.17.0

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

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

func (*DashboardsService) GetIstioDashboard ¶ added in v0.12.0

GetIstioDashboard returns Istio dashboard (currently hard-coded) filled-in with metrics

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(namespace, app, rateInterval string, queryTime time.Time) (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(namespace, rateInterval string, queryTime time.Time) (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(namespace, rateInterval string, queryTime time.Time) (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(namespace, rateInterval string, queryTime time.Time) (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(namespace, service, rateInterval string, queryTime time.Time) (models.ServiceHealth, error)

GetServiceHealth returns a service health (service request error rate)

func (*HealthService) GetWorkloadHealth ¶

func (in *HealthService) GetWorkloadHealth(namespace, workload, rateInterval string, queryTime time.Time) (models.WorkloadHealth, error)

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

type IstioConfigCriteria ¶

type IstioConfigCriteria struct {
	Namespace                     string
	IncludeGateways               bool
	IncludeVirtualServices        bool
	IncludeDestinationRules       bool
	IncludeServiceEntries         bool
	IncludeRules                  bool
	IncludeAdapters               bool
	IncludeTemplates              bool
	IncludeQuotaSpecs             bool
	IncludeQuotaSpecBindings      bool
	IncludePolicies               bool
	IncludeMeshPolicies           bool
	IncludeServiceMeshPolicies    bool
	IncludeClusterRbacConfigs     bool
	IncludeRbacConfigs            bool
	IncludeServiceMeshRbacConfigs bool
	IncludeServiceRoles           bool
	IncludeServiceRoleBindings    bool
	IncludeSidecars               bool
	IncludeAuthorizationPolicies  bool
}

type IstioConfigService ¶

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

func (*IstioConfigService) CreateIstioConfigDetail ¶ added in v0.14.0

func (in *IstioConfigService) CreateIstioConfigDetail(api, namespace, resourceType, resourceSubtype string, body []byte) (models.IstioConfigDetails, error)

func (*IstioConfigService) DeleteIstioConfigDetail ¶ added in v0.9.1

func (in *IstioConfigService) DeleteIstioConfigDetail(api, namespace, resourceType, resourceSubtype, name string) (err error)

DeleteIstioConfigDetail deletes the given Istio resource

func (*IstioConfigService) GeIstioConfigPermissions ¶ added in v1.13.0

func (in *IstioConfigService) GeIstioConfigPermissions(namespaces []string) models.IstioConfigPermissions

func (*IstioConfigService) GetIstioConfigDetails ¶

func (in *IstioConfigService) GetIstioConfigDetails(namespace, objectType, objectSubtype, 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 - "objectSubtype": subtype of the configuration, used when objectType == "adapters" or "templates", empty/not used otherwise - "object": name of the configuration

func (*IstioConfigService) GetIstioConfigList ¶ added in v0.9.1

func (in *IstioConfigService) GetIstioConfigList(criteria IstioConfigCriteria) (models.IstioConfigList, error)

GetIstioConfigList returns a list of Istio routing objects, Mixer Rules, (etc.) per a given Namespace.

func (*IstioConfigService) ParseJsonForCreate ¶ added in v0.14.0

func (in *IstioConfigService) ParseJsonForCreate(resourceType, subresourceType string, body []byte) (string, error)

ParseJsonForCreate checks if a json is well formed according resourceType/subresourceType. It returns a json validated to be used in the Create operation, or an error to report in the handler layer.

func (*IstioConfigService) UpdateIstioConfigDetail ¶ added in v0.12.0

func (in *IstioConfigService) UpdateIstioConfigDetail(api, namespace, resourceType, resourceSubtype, name, jsonPatch string) (models.IstioConfigDetails, error)

type IstioValidationsService ¶

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

func (*IstioValidationsService) GetIstioObjectValidations ¶

func (in *IstioValidationsService) GetIstioObjectValidations(namespace string, objectType string, object string) (models.IstioValidations, error)

func (*IstioValidationsService) GetValidations ¶ added in v0.14.0

func (in *IstioValidationsService) GetValidations(namespace, service 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.

type JaegerLoader ¶ added in v1.11.0

type JaegerLoader = func() (jaeger.ClientInterface, error)

type JaegerService ¶ added in v1.11.0

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

func (*JaegerService) GetErrorTraces ¶ added in v1.11.0

func (in *JaegerService) GetErrorTraces(ns string, srv string, interval string) (errorTraces int, err error)

func (*JaegerService) GetJaegerInfo ¶ added in v1.12.1

func (in *JaegerService) GetJaegerInfo() (info *jaeger.JaegerInfo, code int, err error)

func (*JaegerService) GetJaegerServices ¶ added in v1.11.0

func (in *JaegerService) GetJaegerServices() (services []string, code int, err error)

func (*JaegerService) GetJaegerSpans ¶ added in v1.12.0

func (in *JaegerService) GetJaegerSpans(namespace, service, startMicros, endMicros string) ([]jaeger.Span, error)

func (*JaegerService) GetJaegerTraceDetail ¶ added in v1.11.0

func (in *JaegerService) GetJaegerTraceDetail(traceID string) (trace *jaeger.JaegerResponse, code int, err error)

func (*JaegerService) GetJaegerTraces ¶ added in v1.11.0

func (in *JaegerService) GetJaegerTraces(ns string, srv string, query string) (traces *jaeger.JaegerResponse, code int, err error)

type Layer ¶

type Layer struct {
	Svc         SvcService
	Health      HealthService
	Validations IstioValidationsService
	IstioConfig IstioConfigService
	Workload    WorkloadService
	App         AppService
	Namespace   NamespaceService
	Jaeger      JaegerService

	OpenshiftOAuth OpenshiftOAuthService
	TLS            TLSService
	ThreeScale     ThreeScaleService
	// contains filtered or unexported fields
}

Layer is a container for fast access to inner services

func Get ¶

func Get(token string) (*Layer, error)

Get the business.Layer

func GetUnauthenticated ¶ added in v0.16.0

func GetUnauthenticated() (*Layer, error)

func NewWithBackends ¶ added in v0.10.0

func NewWithBackends(k8s kubernetes.IstioClientInterface, prom prometheus.ClientInterface, jaegerClient JaegerLoader) *Layer

NewWithBackends creates the business layer using the passed k8s and prom clients

type NamespaceService ¶

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

Namespace deals with fetching k8s namespaces / OpenShift projects and convert to kiali model

func (*NamespaceService) GetNamespace ¶ added in v0.9.1

func (in *NamespaceService) GetNamespace(namespace string) (*models.Namespace, error)

GetNamespace returns the definition of the specified namespace.

func (*NamespaceService) GetNamespaces ¶

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

Returns a list of the given namespaces / projects

type OAuthAuthorizationServer ¶ added in v0.16.0

type OAuthAuthorizationServer struct {
	AuthorizationEndpoint string `json:"authorization_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 OAuthMetadata ¶ added in v0.16.0

type OAuthMetadata struct {
	AuthorizationEndpoint string `json:"authorizationEndpoint"`
	LogoutEndpoint        string `json:"logoutEndpoint"`
	LogoutRedirect        string `json:"logoutRedirect"`
}

type OAuthRoute ¶ added in v0.16.0

type OAuthRoute struct {
	Spec OAuthRouteSpec `json:"spec"`
}

type OAuthRouteSpec ¶ added in v0.16.0

type OAuthRouteSpec struct {
	Host string             `json:"host"`
	TLS  *OAuthRouteTLSSpec `json:"tls,omitempty"`
}

type OAuthRouteTLSSpec ¶ added in v0.16.0

type OAuthRouteTLSSpec struct {
	Termination string `json:"termination"`
}

type OAuthUser ¶ added in v0.16.0

type OAuthUser struct {
	Metadata OAuthUserMetadata `json:"metadata"`
}

type OAuthUserMetadata ¶ added in v0.16.0

type OAuthUserMetadata struct {
	Name string `json:"name"`
}

type ObjectChecker ¶

type ObjectChecker interface {
	Check() models.IstioValidations
}

type OpenshiftOAuthService ¶ added in v0.16.0

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

func (*OpenshiftOAuthService) GetUserInfo ¶ added in v0.16.0

func (in *OpenshiftOAuthService) GetUserInfo(token string) (*OAuthUser, error)

func (*OpenshiftOAuthService) Logout ¶ added in v0.20.0

func (in *OpenshiftOAuthService) Logout(token string) error

func (*OpenshiftOAuthService) Metadata ¶ added in v0.16.0

func (in *OpenshiftOAuthService) Metadata() (metadata *OAuthMetadata, err error)

func (*OpenshiftOAuthService) ValidateToken ¶ added in v0.16.0

func (in *OpenshiftOAuthService) ValidateToken(token string) error

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(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) GetServiceApiDocumentation ¶ added in v1.3.0

func (in *SvcService) GetServiceApiDocumentation(namespace, service string) (string, error)

GetServiceApiDocumentation returns the api documentation fetched from a service

func (*SvcService) GetServiceDefinition ¶ added in v0.11.0

func (in *SvcService) GetServiceDefinition(namespace, service string) (*models.ServiceDetails, error)

GetServiceDefinition returns a single service definition (the service object and endpoints), no istio or runtime information

func (*SvcService) GetServiceDefinitionList ¶ added in v1.5.0

func (in *SvcService) GetServiceDefinitionList(namespace string) (*models.ServiceDefinitionList, error)

GetServiceDefinitionList returns service definitions for the namespace (the service object only), no istio or runtime information

func (*SvcService) GetServiceList ¶

func (in *SvcService) GetServiceList(namespace string) (*models.ServiceList, error)

GetServiceList returns a list of all services for a given Namespace

type TLSService ¶ added in v0.16.0

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

func (*TLSService) MeshWidemTLSStatus ¶ added in v0.16.0

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

func (TLSService) NamespaceWidemTLSStatus ¶ added in v0.16.0

func (in TLSService) NamespaceWidemTLSStatus(namespace string) (models.MTLSStatus, error)

type ThreeScaleService ¶ added in v0.20.0

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

ThreeScaleService is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) CreateThreeScaleHandler ¶ added in v0.20.0

func (in *ThreeScaleService) CreateThreeScaleHandler(body []byte) (models.ThreeScaleHandlers, error)

CreateThreeScaleHandler is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) CreateThreeScaleRule ¶ added in v0.20.0

func (in *ThreeScaleService) CreateThreeScaleRule(namespace string, body []byte) (models.ThreeScaleServiceRule, error)

CreateThreeScaleRule is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) DeleteThreeScaleHandler ¶ added in v0.20.0

func (in *ThreeScaleService) DeleteThreeScaleHandler(handlerName string) (models.ThreeScaleHandlers, error)

DeleteThreeScaleHandler is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) DeleteThreeScaleRule ¶ added in v0.20.0

func (in *ThreeScaleService) DeleteThreeScaleRule(namespace, service string) error

DeleteThreeScaleHandler is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) GetThreeScaleHandlers ¶ added in v0.20.0

func (in *ThreeScaleService) GetThreeScaleHandlers() (models.ThreeScaleHandlers, error)

GetThreeScaleHandlers is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) GetThreeScaleInfo ¶ added in v0.20.0

func (in *ThreeScaleService) GetThreeScaleInfo() (models.ThreeScaleInfo, error)

GetThreeScaleInfo is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) GetThreeScaleRule ¶ added in v0.20.0

func (in *ThreeScaleService) GetThreeScaleRule(namespace, service string) (models.ThreeScaleServiceRule, error)

GetThreeScaleRule is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) UpdateThreeScaleHandler ¶ added in v0.20.0

func (in *ThreeScaleService) UpdateThreeScaleHandler(handlerName string, body []byte) (models.ThreeScaleHandlers, error)

UpdateThreeScaleHandler is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

func (*ThreeScaleService) UpdateThreeScaleRule ¶ added in v0.20.0

func (in *ThreeScaleService) UpdateThreeScaleRule(namespace, service string, body []byte) (models.ThreeScaleServiceRule, error)

UpdateThreeScaleHandler is Maistra-Only. Maistra does not allow Istio multi-namespace deployment, use the single Istio namespace.

type WorkloadService ¶

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

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

func (*WorkloadService) GetPod ¶ added in v0.18.0

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

func (*WorkloadService) GetPodLogs ¶ added in v0.18.0

func (in *WorkloadService) GetPodLogs(namespace, name string, opts *core_v1.PodLogOptions) (*kubernetes.PodLogs, error)

func (*WorkloadService) GetPods ¶

func (in *WorkloadService) GetPods(namespace string, labelSelector string) (models.Pods, error)

func (*WorkloadService) GetWorkload ¶

func (in *WorkloadService) GetWorkload(namespace string, workloadName string, includeServices bool) (*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) GetWorkloadList ¶

func (in *WorkloadService) GetWorkloadList(namespace string) (models.WorkloadList, error)

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

Jump to

Keyboard shortcuts

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