client

package
v0.0.0-...-71c9d12 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExist    = errors.New("集群不存在。 ")
	ErrMaintaining = errors.New("集群正在维护,请稍后再试。 ")
)

Functions

func BuildApiserverClient

func BuildApiserverClient()

func Client

func Client(cluster string) (*kubernetes.Clientset, error)

func Cluster

func Cluster(cluster string) (*models.Cluster, error)

func Managers

func Managers() *sync.Map

Types

type CacheFactory

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

func (*CacheFactory) DeploymentLister

func (c *CacheFactory) DeploymentLister() appsv1.DeploymentLister

func (*CacheFactory) EndpointLister

func (c *CacheFactory) EndpointLister() corev1.EndpointsLister

func (*CacheFactory) EventLister

func (c *CacheFactory) EventLister() corev1.EventLister

func (*CacheFactory) HPALister

func (*CacheFactory) NodeLister

func (c *CacheFactory) NodeLister() corev1.NodeLister

func (*CacheFactory) PodLister

func (c *CacheFactory) PodLister() corev1.PodLister

type ClusterManager

type ClusterManager struct {
	Cluster       *models.Cluster
	Client        *kubernetes.Clientset
	Config        *rest.Config
	CacheFactory  *CacheFactory
	KubeClient    ResourceHandler
	DynamicClient *dynamic.DynamicClient
	CrdClient     *apiextensionsclientset.Clientset
}

func Manager

func Manager(cluster string) (*ClusterManager, error)

func (ClusterManager) Close

func (c ClusterManager) Close()

type ResourceHandler

type ResourceHandler interface {
	Create(kind string, namespace string, object *runtime.Unknown) (*runtime.Unknown, error)
	Update(kind string, namespace string, name string, object *runtime.Unknown) (*runtime.Unknown, error)
	Get(kind string, namespace string, name string) (runtime.Object, error)
	List(kind string, namespace string, labelSelector string) ([]runtime.Object, error)
	Delete(kind string, namespace string, name string, options *metav1.DeleteOptions) error
	GVRK(resourceName string) (api.ResourceMap, error)
}

定义了资源操作的标准方法,包括 Create、Update、Get、List 和 Delete 支持处理命名空间资源和全局资源。

func KubeClient

func KubeClient(cluster string) (ResourceHandler, error)

func NewResourceHandler

func NewResourceHandler(kubeClient *kubernetes.Clientset, dynamicClient *dynamic.DynamicClient, cacheFactory *CacheFactory) ResourceHandler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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