cache

package
v1.63.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 37 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingClient added in v1.62.0

type CachingClient struct {
	kubernetes.ClientInterface
	// contains filtered or unexported fields
}

CachingClient is a wrapper around a ClientInterface that adds caching. If the object is cached then it is read from the cache. Not all object types are cached. When an object is created, updated, or deleted, then the cache is refreshed and updated.

func NewCachingClient added in v1.62.0

func NewCachingClient(cache KialiCache, client kubernetes.ClientInterface) *CachingClient

NewCachingClient creates a new CachingClient out of a cache and a client.

func (*CachingClient) GetConfigMap added in v1.62.0

func (cc *CachingClient) GetConfigMap(namespace, name string) (*core_v1.ConfigMap, error)

func (*CachingClient) GetDaemonSet added in v1.62.0

func (cc *CachingClient) GetDaemonSet(namespace string, name string) (*apps_v1.DaemonSet, error)

func (*CachingClient) GetDaemonSets added in v1.62.0

func (cc *CachingClient) GetDaemonSets(namespace string) ([]apps_v1.DaemonSet, error)

func (*CachingClient) GetDeployment added in v1.62.0

func (cc *CachingClient) GetDeployment(namespace string, name string) (*apps_v1.Deployment, error)

func (*CachingClient) GetDeployments added in v1.62.0

func (cc *CachingClient) GetDeployments(namespace string) ([]apps_v1.Deployment, error)

func (*CachingClient) GetEndpoints added in v1.62.0

func (cc *CachingClient) GetEndpoints(namespace string, name string) (*core_v1.Endpoints, error)

func (*CachingClient) GetPods added in v1.62.0

func (cc *CachingClient) GetPods(namespace, labelSelector string) ([]core_v1.Pod, error)

func (*CachingClient) GetReplicaSets added in v1.62.0

func (cc *CachingClient) GetReplicaSets(namespace string) ([]apps_v1.ReplicaSet, error)

func (*CachingClient) GetService added in v1.62.0

func (cc *CachingClient) GetService(namespace string, name string) (*core_v1.Service, error)

func (*CachingClient) GetServices added in v1.62.0

func (cc *CachingClient) GetServices(namespace string, selectorLabels map[string]string) ([]core_v1.Service, error)

func (*CachingClient) GetStatefulSet added in v1.62.0

func (cc *CachingClient) GetStatefulSet(namespace string, name string) (*apps_v1.StatefulSet, error)

func (*CachingClient) GetStatefulSets added in v1.62.0

func (cc *CachingClient) GetStatefulSets(namespace string) ([]apps_v1.StatefulSet, error)

type IstioCache

type IstioCache interface {
	CheckIstioResource(resourceType string) bool

	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.Gateway, error)
	GetK8sGateways(namespace, labelSelector string) ([]*gatewayapi.Gateway, error)
	GetK8sHTTPRoute(namespace, name string) (*gatewayapi.HTTPRoute, error)
	GetK8sHTTPRoutes(namespace, labelSelector string) ([]*gatewayapi.HTTPRoute, 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 KialiCache

type KialiCache interface {
	// Control methods
	// Check if a namespace is listed to be cached; if yes, creates a cache for that namespace
	CheckNamespace(namespace string) bool

	// 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()

	// Kubernetes Client used for cache
	GetClient() *kubernetes.K8SClient

	KubernetesCache
	IstioCache
	NamespacesCache
	RegistryStatusCache
	ProxyStatusCache
}

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 FakeGatewaysKialiCache added in v1.45.0

func FakeGatewaysKialiCache(gws []*networking_v1beta1.Gateway) KialiCache

Fake KialiCache used for Gateway Scenarios It populates the Namespaces, Informers and Gateway information needed

func FakeServicesKialiCache added in v1.46.0

Fake KialiCache used for RegistryServices and All IstioConfigs Scenarios It populates the Namespaces, Informers and Registry information needed

func FakeTlsKialiCache added in v1.45.0

func FakeTlsKialiCache(token string, namespaces []string, pa []*security_v1beta1.PeerAuthentication, dr []*networking_v1beta1.DestinationRule) KialiCache

Fake KialiCache used for TLS Scenarios It populates the Namespaces, Informers and Registry information needed

func NewKialiCache

func NewKialiCache(namespaceSeedList ...string) (KialiCache, error)

type KubernetesCache

type KubernetesCache interface {
	GetConfigMap(namespace, name string) (*core_v1.ConfigMap, error)
	GetDaemonSets(namespace string) ([]apps_v1.DaemonSet, error)
	GetDaemonSet(namespace, name string) (*apps_v1.DaemonSet, error)
	GetDeployments(namespace 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)
	GetServices(namespace string, selectorLabels map[string]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)
}

type NamespacesCache

type NamespacesCache interface {
	SetNamespaces(token string, namespaces []models.Namespace)
	GetNamespaces(token string) []models.Namespace
	GetNamespace(token string, namespace string) *models.Namespace
	RefreshTokenNamespaces()
}

type ProxyStatusCache added in v1.25.0

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

type RegistryRefreshHandler added in v1.44.0

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

func NewRegistryHandler added in v1.44.0

func NewRegistryHandler(refresh func()) RegistryRefreshHandler

func (RegistryRefreshHandler) OnAdd added in v1.44.0

func (sh RegistryRefreshHandler) OnAdd(obj interface{})

func (RegistryRefreshHandler) OnDelete added in v1.44.0

func (sh RegistryRefreshHandler) OnDelete(obj interface{})

func (RegistryRefreshHandler) OnUpdate added in v1.44.0

func (sh RegistryRefreshHandler) OnUpdate(oldObj, newObj interface{})

type RegistryStatusCache added in v1.35.0

type RegistryStatusCache interface {
	CheckRegistryStatus() bool
	GetRegistryStatus() *kubernetes.RegistryStatus
	SetRegistryStatus(registryStatus *kubernetes.RegistryStatus)
	RefreshRegistryStatus()
}

Jump to

Keyboard shortcuts

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