Documentation
¶
Index ¶
- Constants
- func NewIntStr(v int) *intstr.IntOrString
- type Client
- func (c *Client) Admin() *admin.Client
- func (c *Client) Config() *config.Client
- func (c *Client) CurrentCluster() *clientcmdapi.Cluster
- func (c *Client) CurrentContext() *clientcmdapi.Context
- func (c *Client) DeploymentWatcher(namespaces ...string) *K8sWatcher[*appsv1.Deployment]
- func (c *Client) Event() *event.Client
- func (c *Client) Gateway() *gateway.Client
- func (c *Client) GetContexts() map[string]*clientcmdapi.Context
- func (c *Client) K8sClientSet() *kubernetes.Clientset
- func (c *Client) Network() *network.Client
- func (c *Client) PodWatcher(namespaces ...string) *K8sWatcher[*corev1.Pod]
- func (c *Client) ServerResources() *meta.ApiResourceList
- func (c *Client) ServerVersion() (string, error)
- func (c *Client) ServiceWatcher(namespaces ...string) *K8sWatcher[*corev1.Service]
- func (c *Client) Storage() *storage.Client
- func (c *Client) WorkLoad() *workload.Client
- type K8sWatcher
- func (w *K8sWatcher[T]) GetName() string
- func (w *K8sWatcher[T]) GetNamespaces() []string
- func (w *K8sWatcher[T]) IsConfigUpdate(configHash string) bool
- func (w *K8sWatcher[T]) OnError(fn func(error))
- func (w *K8sWatcher[T]) RegisterHandler(handler ResourceHandler[T])
- func (w *K8sWatcher[T]) Run() error
- func (w *K8sWatcher[T]) SetConfigHash(configHash string) *K8sWatcher[T]
- func (w *K8sWatcher[T]) SetName(name string) *K8sWatcher[T]
- func (w *K8sWatcher[T]) Stop()
- func (w *K8sWatcher[T]) WithAnnotations(key, value string) *K8sWatcher[T]
- type RESOURCE
- type ResourceHandler
- type ResourceHandlerFunc
Constants ¶
View Source
const (
DEFAULT_NAMESPACE_NAME = "default"
)
Variables ¶
This section is empty.
Functions ¶
func NewIntStr ¶
func NewIntStr(v int) *intstr.IntOrString
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientFromFile ¶
func NewClientFromRestConfig ¶ added in v0.0.8
func (*Client) CurrentCluster ¶
func (c *Client) CurrentCluster() *clientcmdapi.Cluster
func (*Client) CurrentContext ¶
func (c *Client) CurrentContext() *clientcmdapi.Context
func (*Client) DeploymentWatcher ¶ added in v0.0.8
func (c *Client) DeploymentWatcher(namespaces ...string) *K8sWatcher[*appsv1.Deployment]
func (*Client) GetContexts ¶
func (c *Client) GetContexts() map[string]*clientcmdapi.Context
func (*Client) K8sClientSet ¶ added in v0.0.2
func (c *Client) K8sClientSet() *kubernetes.Clientset
func (*Client) PodWatcher ¶ added in v0.0.8
func (c *Client) PodWatcher(namespaces ...string) *K8sWatcher[*corev1.Pod]
func (*Client) ServerResources ¶
func (c *Client) ServerResources() *meta.ApiResourceList
func (*Client) ServerVersion ¶
func (*Client) ServiceWatcher ¶ added in v0.0.8
func (c *Client) ServiceWatcher(namespaces ...string) *K8sWatcher[*corev1.Service]
type K8sWatcher ¶ added in v0.0.8
K8sWatcher 泛型Watcher,监听指定类型的资源
func NewK8sWatcher ¶ added in v0.0.8
func NewK8sWatcher[T runtime.Object]( clientset kubernetes.Interface, namespaces []string, listFunc func(kubernetes.Interface, string, metav1.ListOptions) (runtime.Object, error), watchFunc func(kubernetes.Interface, string, metav1.ListOptions) (watch.Interface, error), ) *K8sWatcher[T]
NewK8sWatcher 创建泛型Watcher
func (*K8sWatcher[T]) GetName ¶ added in v0.0.8
func (w *K8sWatcher[T]) GetName() string
func (*K8sWatcher[T]) GetNamespaces ¶ added in v0.0.8
func (w *K8sWatcher[T]) GetNamespaces() []string
func (*K8sWatcher[T]) IsConfigUpdate ¶ added in v0.0.8
func (w *K8sWatcher[T]) IsConfigUpdate(configHash string) bool
func (*K8sWatcher[T]) OnError ¶ added in v0.0.8
func (w *K8sWatcher[T]) OnError(fn func(error))
func (*K8sWatcher[T]) RegisterHandler ¶ added in v0.0.8
func (w *K8sWatcher[T]) RegisterHandler(handler ResourceHandler[T])
RegisterHandler 注册泛型事件处理器
func (*K8sWatcher[T]) SetConfigHash ¶ added in v0.0.8
func (w *K8sWatcher[T]) SetConfigHash(configHash string) *K8sWatcher[T]
func (*K8sWatcher[T]) SetName ¶ added in v0.0.8
func (w *K8sWatcher[T]) SetName(name string) *K8sWatcher[T]
func (*K8sWatcher[T]) WithAnnotations ¶ added in v0.0.8
func (w *K8sWatcher[T]) WithAnnotations(key, value string) *K8sWatcher[T]
动态为对象补充集群信息, 方便后续处理
type ResourceHandler ¶ added in v0.0.8
type ResourceHandler[T runtime.Object] interface { OnAdd(obj T) OnUpdate(oldObj, newObj T) OnDelete(obj T) }
ResourceHandler 定义泛型资源事件处理接口
type ResourceHandlerFunc ¶ added in v0.0.8
type ResourceHandlerFunc[T runtime.Object] struct { OnAddFunc func(obj T) OnUpdateFunc func(oldObj, newObj T) OnDeleteFunc func(obj T) }
ResourceHandlerFunc 是一个函数类型,直接实现 ResourceHandler 接口
func NewResourceHandlerFunc ¶ added in v0.0.8
func NewResourceHandlerFunc[T runtime.Object]( onAddFunc func(obj T), onUpdateFunc func(oldObj, newObj T), onDeleteFunc func(obj T), ) *ResourceHandlerFunc[T]
func (*ResourceHandlerFunc[T]) OnAdd ¶ added in v0.0.8
func (f *ResourceHandlerFunc[T]) OnAdd(obj T)
func (*ResourceHandlerFunc[T]) OnDelete ¶ added in v0.0.8
func (f *ResourceHandlerFunc[T]) OnDelete(obj T)
func (*ResourceHandlerFunc[T]) OnUpdate ¶ added in v0.0.8
func (f *ResourceHandlerFunc[T]) OnUpdate(oldObj, newObj T)
Click to show internal directories.
Click to hide internal directories.