resouce_cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GroupToTypeMap = []struct {
	K string
	V []string
}{
	{
		K: "Workloads",
		V: []string{
			"Deployment.v1.apps",
			"StatefulSet.v1.apps",
			"DaemonSet.v1.apps",
			"Job.v1.batch",
			"CronJob.v1beta1.batch",
			"CronJob.v1.batch",
			"Pod.v1.",
		},
	},
	{
		K: "Networks",
		V: []string{
			"Service.v1.",
			"Endpoints.v1.",
			"Ingress.v1.networking.k8s.io",
			"NetworkPolicy.v1.networking.k8s.io",
		},
	},
	{
		K: "Configurations",
		V: []string{
			"ConfigMap.v1.",
			"Secret.v1.",
			"HorizontalPodAutoscaler.v1.autoscaling",
			"ResourceQuota.v1.",
			"PodDisruptionBudget.v1.policy",
		},
	},
	{
		K: "Storages",
		V: []string{
			"PersistentVolume.v1.",
			"PersistentVolumeClaim.v1.",
			"StorageClass.v1.storage.k8s.io",
		},
	},
}

GroupToTypeMap K: Workloads/Networks/Configurations V: deployments/statefulset

Functions

func AddSearcherByKubeconfig

func AddSearcherByKubeconfig(kubeconfigBytes []byte, namespace string) error

AddSearcherByKubeconfig init informer in advance

func GetAllAppNameByNamespace

func GetAllAppNameByNamespace(kubeconfigBytes []byte, ns string) sets.String

func GetApiGroupResources

func GetApiGroupResources(kubeBytes []byte, ns string) ([]*restmapper.APIGroupResources, error)

func RemoveSearcherByKubeconfig

func RemoveSearcherByKubeconfig(kubeconfigBytes []byte, namespace string) error

RemoveSearcherByKubeconfig remove informer from cache

Types

type GvkGvrWithAlias

type GvkGvrWithAlias struct {
	Gvr schema.GroupVersionResource
	Gvk schema.GroupVersionKind

	// namespaced indicates if a resource is namespaced or not.
	Namespaced bool
	// contains filtered or unexported fields
}

func (*GvkGvrWithAlias) GetFullName

func (g *GvkGvrWithAlias) GetFullName() string

type ResourceEventHandlerFuncs

type ResourceEventHandlerFuncs struct {
	cache.ResourceEventHandler

	Gvr schema.GroupVersionResource
	// contains filtered or unexported fields
}

func NewResourceEventHandlerFuncs

func NewResourceEventHandlerFuncs(resource informers.GenericInformer, kubeconfigBytes []byte, gvr schema.GroupVersionResource) *ResourceEventHandlerFuncs

func (*ResourceEventHandlerFuncs) OnAdd

func (r *ResourceEventHandlerFuncs) OnAdd(interface{})

func (*ResourceEventHandlerFuncs) OnDelete

func (r *ResourceEventHandlerFuncs) OnDelete(obj interface{})

func (*ResourceEventHandlerFuncs) OnUpdate

func (r *ResourceEventHandlerFuncs) OnUpdate(_, _ interface{})

type Searcher

type Searcher struct {
	SupportSchemaList []GvkGvrWithAlias
	// contains filtered or unexported fields
}

func GetSearcherWithLRU

func GetSearcherWithLRU(kubeconfigBytes []byte, namespace string) (search *Searcher, err error)

GetSearcherWithLRU GetSearchWithLRU will cache kubeconfig with LRU

func (*Searcher) Criteria

func (s *Searcher) Criteria() *criteria

func (*Searcher) GetKubeconfigBytes

func (s *Searcher) GetKubeconfigBytes() []byte

func (*Searcher) GetResourceInfo

func (s *Searcher) GetResourceInfo(resourceType string) (GvkGvrWithAlias, error)

func (*Searcher) GetSupportSchema

func (s *Searcher) GetSupportSchema() *sync.Map

func (*Searcher) Start

func (s *Searcher) Start()

Start wait searcher to close

func (*Searcher) Stop

func (s *Searcher) Stop()

Stop to stop the searcher

Jump to

Keyboard shortcuts

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