cache

package
v1.82.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 42 Imported by: 2

Documentation

Index

Constants

View Source
const K8sExpGatewayAPIMessage = "k8s experimental Gateway API CRD is needed to be installed"
View Source
const K8sGatewayAPIMessage = "k8s Gateway API CRDs are installed, Kiali needs to be restarted to apply"

Variables

This section is empty.

Functions

func NewKubeCache added in v1.64.0

func NewKubeCache(kialiClient kubernetes.ClientInterface, cfg config.Config) (*kubeCache, error)

Starts all informers. These run until context is cancelled.

Types

type KialiCache

type KialiCache interface {
	GetKubeCaches() map[string]KubeCache
	GetKubeCache(cluster string) (KubeCache, error)

	// GetClusters returns the list of clusters that the cache knows about.
	// This gets set by the mesh service.
	GetClusters() []kubernetes.Cluster

	// SetClusters sets the list of clusters that the cache knows about.
	SetClusters([]kubernetes.Cluster)

	RegistryStatusCache
	ProxyStatusCache

	// GetNamespace returns a namespace from the in memory cache if it exists.
	GetNamespace(cluster string, token string, name string) (models.Namespace, bool)

	// GetNamespaces returns all namespaces for the cluster/token from the in memory cache.
	GetNamespaces(cluster string, token string) ([]models.Namespace, bool)

	// RefreshTokenNamespaces clears the in memory cache of namespaces.
	RefreshTokenNamespaces(cluster string)

	// SetNamespaces sets the in memory cache of namespaces.
	// We cache all namespaces for cluster + token.
	SetNamespaces(token string, namespaces []models.Namespace)

	// SetNamespace caches a specific namespace by cluster + token.
	SetNamespace(token string, namespace models.Namespace)

	// Stop stops the cache and all its kube caches.
	Stop()

	// IsAmbientEnabled checks if the istio Ambient profile was enabled
	// by checking if the ztunnel daemonset exists on the cluster.
	IsAmbientEnabled(cluster string) bool
}

KialiCache stores both kube objects and non-kube related data such as pods' proxy status. It is exclusively used by the business layer where it's expected to be a singleton. This business layer cache needs access to all the kiali service account has access to so it uses the kiali service account token instead of a user token. Access to the objects returned by the cache should be filtered/restricted to the user's token access but the cache returns objects without any filtering or restrictions.

func NewKialiCache

func NewKialiCache(clientFactory kubernetes.ClientFactory, cfg config.Config) (KialiCache, error)

func NewTestingCache added in v1.78.0

func NewTestingCache(t *testing.T, k8s kubernetes.ClientInterface, conf config.Config) KialiCache

NewTestingCache will create a cache for you from the kube client and will cleanup the cache when the test ends.

func NewTestingCacheWithFactory added in v1.78.0

func NewTestingCacheWithFactory(t *testing.T, cf kubernetes.ClientFactory, conf config.Config) KialiCache

NewTestingCacheWithFactory allows you to pass in a custom client factory. Good for testing multicluster.

type KubeCache added in v1.64.0

type KubeCache interface {
	// Refresh will recreate the necessary cache. If the cache is cluster-scoped the "namespace" argument
	// is ignored and the whole cache is recreated, otherwise only the namespace-specific cache is updated.
	Refresh(namespace string)

	// Stop all caches
	Stop()

	// Client returns the underlying client for the KubeCache.
	// This is useful for when you want to talk directly to the kube API
	// using the Kiali Service Account client.
	Client() kubernetes.ClientInterface

	GetConfigMap(namespace, name string) (*core_v1.ConfigMap, error)
	GetDaemonSets(namespace string) ([]apps_v1.DaemonSet, error)
	GetDaemonSet(namespace, name string) (*apps_v1.DaemonSet, error)
	GetDaemonSetsWithSelector(namespace string, labelSelector map[string]string) ([]*apps_v1.DaemonSet, error)
	GetDeployments(namespace string) ([]apps_v1.Deployment, error)
	GetDeploymentsWithSelector(namespace string, labelSelector string) ([]apps_v1.Deployment, error)
	GetDeployment(namespace, name string) (*apps_v1.Deployment, error)
	GetEndpoints(namespace, name string) (*core_v1.Endpoints, error)
	GetStatefulSets(namespace string) ([]apps_v1.StatefulSet, error)
	GetStatefulSet(namespace, name string) (*apps_v1.StatefulSet, error)
	GetServicesBySelectorLabels(namespace string, selectorLabels map[string]string) ([]core_v1.Service, error)
	GetServices(namespace string, labelSelector string) ([]core_v1.Service, error)
	GetService(namespace string, name string) (*core_v1.Service, error)
	GetPods(namespace, labelSelector string) ([]core_v1.Pod, error)
	GetReplicaSets(namespace string) ([]apps_v1.ReplicaSet, error)

	GetDestinationRule(namespace, name string) (*networking_v1beta1.DestinationRule, error)
	GetDestinationRules(namespace, labelSelector string) ([]*networking_v1beta1.DestinationRule, error)
	GetEnvoyFilter(namespace, name string) (*networking_v1alpha3.EnvoyFilter, error)
	GetEnvoyFilters(namespace, labelSelector string) ([]*networking_v1alpha3.EnvoyFilter, error)
	GetGateway(namespace, name string) (*networking_v1beta1.Gateway, error)
	GetGateways(namespace, labelSelector string) ([]*networking_v1beta1.Gateway, error)
	GetServiceEntry(namespace, name string) (*networking_v1beta1.ServiceEntry, error)
	GetServiceEntries(namespace, labelSelector string) ([]*networking_v1beta1.ServiceEntry, error)
	GetSidecar(namespace, name string) (*networking_v1beta1.Sidecar, error)
	GetSidecars(namespace, labelSelector string) ([]*networking_v1beta1.Sidecar, error)
	GetVirtualService(namespace, name string) (*networking_v1beta1.VirtualService, error)
	GetVirtualServices(namespace, labelSelector string) ([]*networking_v1beta1.VirtualService, error)
	GetWorkloadEntry(namespace, name string) (*networking_v1beta1.WorkloadEntry, error)
	GetWorkloadEntries(namespace, labelSelector string) ([]*networking_v1beta1.WorkloadEntry, error)
	GetWorkloadGroup(namespace, name string) (*networking_v1beta1.WorkloadGroup, error)
	GetWorkloadGroups(namespace, labelSelector string) ([]*networking_v1beta1.WorkloadGroup, error)
	GetWasmPlugin(namespace, name string) (*extentions_v1alpha1.WasmPlugin, error)
	GetWasmPlugins(namespace, labelSelector string) ([]*extentions_v1alpha1.WasmPlugin, error)
	GetTelemetry(namespace, name string) (*v1alpha1.Telemetry, error)
	GetTelemetries(namespace, labelSelector string) ([]*v1alpha1.Telemetry, error)

	GetK8sGateway(namespace, name string) (*gatewayapi_v1.Gateway, error)
	GetK8sGateways(namespace, labelSelector string) ([]*gatewayapi_v1.Gateway, error)
	GetK8sGRPCRoute(namespace, name string) (*gatewayapi_v1alpha2.GRPCRoute, error)
	GetK8sGRPCRoutes(namespace, labelSelector string) ([]*gatewayapi_v1alpha2.GRPCRoute, error)
	GetK8sHTTPRoute(namespace, name string) (*gatewayapi_v1.HTTPRoute, error)
	GetK8sHTTPRoutes(namespace, labelSelector string) ([]*gatewayapi_v1.HTTPRoute, error)
	GetK8sReferenceGrant(namespace, name string) (*gatewayapi_v1beta1.ReferenceGrant, error)
	GetK8sReferenceGrants(namespace, labelSelector string) ([]*gatewayapi_v1beta1.ReferenceGrant, error)
	GetK8sTCPRoute(namespace, name string) (*gatewayapi_v1alpha2.TCPRoute, error)
	GetK8sTCPRoutes(namespace, labelSelector string) ([]*gatewayapi_v1alpha2.TCPRoute, error)
	GetK8sTLSRoute(namespace, name string) (*gatewayapi_v1alpha2.TLSRoute, error)
	GetK8sTLSRoutes(namespace, labelSelector string) ([]*gatewayapi_v1alpha2.TLSRoute, error)

	GetAuthorizationPolicy(namespace, name string) (*security_v1beta1.AuthorizationPolicy, error)
	GetAuthorizationPolicies(namespace, labelSelector string) ([]*security_v1beta1.AuthorizationPolicy, error)
	GetPeerAuthentication(namespace, name string) (*security_v1beta1.PeerAuthentication, error)
	GetPeerAuthentications(namespace, labelSelector string) ([]*security_v1beta1.PeerAuthentication, error)
	GetRequestAuthentication(namespace, name string) (*security_v1beta1.RequestAuthentication, error)
	GetRequestAuthentications(namespace, labelSelector string) ([]*security_v1beta1.RequestAuthentication, error)
}

type ProxyStatusCache added in v1.25.0

type ProxyStatusCache interface {
	SetPodProxyStatus([]*kubernetes.ProxyStatus)
	GetPodProxyStatus(cluster, namespace, pod string) *kubernetes.ProxyStatus
}

type RegistryStatusCache added in v1.35.0

type RegistryStatusCache interface {
	GetRegistryStatus(cluster string) *kubernetes.RegistryStatus
	SetRegistryStatus(registryStatus map[string]*kubernetes.RegistryStatus)
}

Jump to

Keyboard shortcuts

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