Documentation
¶
Index ¶
- Constants
- Variables
- type Cluster
- type ClusterManager
- func (m *ClusterManager) Add(cluster *Cluster) error
- func (m *ClusterManager) AddNewClusters(name string, kubeconfig string) (*Cluster, error)
- func (m *ClusterManager) Delete(name string) error
- func (m *ClusterManager) DeletePod(opts types.NamespacedName, clusterNames ...string) error
- func (m *ClusterManager) DeletePods(opts *client.ListOptions, clusterNames ...string) error
- func (m *ClusterManager) Get(name string) (*Cluster, error)
- func (m *ClusterManager) GetAll(name ...string) []*Cluster
- func (m *ClusterManager) GetClusterIndex(name string) (int, bool)
- func (m *ClusterManager) GetDeployment(opts *client.ListOptions, clusterNames ...string) ([]*appsv1.Deployment, error)
- func (m *ClusterManager) GetEndpoints(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Endpoints, error)
- func (m *ClusterManager) GetEvent(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Event, error)
- func (m *ClusterManager) GetHelmRelease(opts map[string]string, clusterNames ...string) ([]*helmv3.Release, error)
- func (m *ClusterManager) GetNodes(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Node, error)
- func (m *ClusterManager) GetPod(opts types.NamespacedName, clusterNames ...string) (*corev1.Pod, error)
- func (m *ClusterManager) GetPods(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Pod, error)
- func (m *ClusterManager) GetRawCli(clusterNames ...string) (kubernetes.Interface, error)
- func (m *ClusterManager) GetService(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Service, error)
- func (m *ClusterManager) GetStatefulsets(opts *client.ListOptions, clusterNames ...string) ([]*appsv1.StatefulSet, error)
- func (m *ClusterManager) Start(ctx context.Context) error
- func (m *ClusterManager) Stop()
- type ClusterStatusType
- type CustomInterface
- type Interface
- type MasterClient
Constants ¶
const (
ClustersAll = "all"
)
key config
Variables ¶
var (
SyncPeriodTime = 1 * time.Hour
)
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { Name string AliasName string RawKubeconfig []byte Meta map[string]string RestConfig *rest.Config Client client.Client KubeCli kubernetes.Interface Log logr.Logger Mgr manager.Manager Cache cache.Cache SyncPeriod time.Duration StopperCancel context.CancelFunc Status ClusterStatusType // Started is true if the Informers has been Started Started bool }
func NewCluster ¶
func (*Cluster) StartCache ¶
type ClusterManager ¶
type ClusterManager struct { MasterClient Started bool sync.RWMutex // contains filtered or unexported fields }
ClusterManager ...
func (*ClusterManager) AddNewClusters ¶
func (m *ClusterManager) AddNewClusters(name string, kubeconfig string) (*Cluster, error)
func (*ClusterManager) DeletePod ¶
func (m *ClusterManager) DeletePod(opts types.NamespacedName, clusterNames ...string) error
DeletePod ...
func (*ClusterManager) DeletePods ¶
func (m *ClusterManager) DeletePods(opts *client.ListOptions, clusterNames ...string) error
DeletePods ...
func (*ClusterManager) GetAll ¶
func (m *ClusterManager) GetAll(name ...string) []*Cluster
GetAll get all cluster
func (*ClusterManager) GetClusterIndex ¶
func (m *ClusterManager) GetClusterIndex(name string) (int, bool)
GetClusterIndex ...
func (*ClusterManager) GetDeployment ¶
func (m *ClusterManager) GetDeployment(opts *client.ListOptions, clusterNames ...string) ([]*appsv1.Deployment, error)
GetDeployment ...
func (*ClusterManager) GetEndpoints ¶
func (m *ClusterManager) GetEndpoints(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Endpoints, error)
GetEndpoints ...
func (*ClusterManager) GetEvent ¶
func (m *ClusterManager) GetEvent(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Event, error)
GetEvent ...
func (*ClusterManager) GetHelmRelease ¶
func (m *ClusterManager) GetHelmRelease(opts map[string]string, clusterNames ...string) ([]*helmv3.Release, error)
GetHelmRelease ...
func (*ClusterManager) GetNodes ¶
func (m *ClusterManager) GetNodes(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Node, error)
GetNodes ...
func (*ClusterManager) GetPod ¶
func (m *ClusterManager) GetPod(opts types.NamespacedName, clusterNames ...string) (*corev1.Pod, error)
GetPod ...
func (*ClusterManager) GetPods ¶
func (m *ClusterManager) GetPods(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Pod, error)
GetPods ...
func (*ClusterManager) GetRawCli ¶
func (m *ClusterManager) GetRawCli(clusterNames ...string) (kubernetes.Interface, error)
GetRawCli return the client of the master cluster as default if len(clusterNames) == 0, otherwise it will return a client with the special name.
func (*ClusterManager) GetService ¶
func (m *ClusterManager) GetService(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Service, error)
GetService ...
func (*ClusterManager) GetStatefulsets ¶
func (m *ClusterManager) GetStatefulsets(opts *client.ListOptions, clusterNames ...string) ([]*appsv1.StatefulSet, error)
GetStatefulsets ...
func (*ClusterManager) Start ¶
func (m *ClusterManager) Start(ctx context.Context) error
Start timer check cluster health
func (*ClusterManager) Stop ¶
func (m *ClusterManager) Stop()
type ClusterStatusType ¶
type ClusterStatusType string
const ( // ClusterReady means the cluster is ready to accept workloads. ClusterReady ClusterStatusType = "Ready" // ClusterOffline means the cluster is temporarily down or not reachable ClusterOffline ClusterStatusType = "Offline" ClusterMaintain ClusterStatusType = "Maintaining" )
These are valid status of a cluster.
type CustomInterface ¶
type CustomInterface interface { Interface GetHelmRelease(opts map[string]string, clusterNames ...string) ([]*helmv3.Release, error) }
CustomInterface as the extension of the basic cluster, it includes the extra methods for handling your own business.
type Interface ¶
type Interface interface { GetRawCli(clusterNames ...string) (kubernetes.Interface, error) GetPod(opts types.NamespacedName, clusterNames ...string) (*corev1.Pod, error) GetPods(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Pod, error) GetNodes(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Node, error) GetDeployment(opts *client.ListOptions, clusterNames ...string) ([]*appsv1.Deployment, error) GetStatefulsets(opts *client.ListOptions, clusternames ...string) ([]*appsv1.StatefulSet, error) GetService(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Service, error) GetEndpoints(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Endpoints, error) GetEvent(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Event, error) DeletePods(opts *client.ListOptions, clusterNames ...string) error DeletePod(opts types.NamespacedName, clusterNames ...string) error }
Interface is used to shield the complexity of the underlying multi-cluster or single cluster.
type MasterClient ¶
type MasterClient struct { KubeCli kubernetes.Interface manager.Manager }
MasterClient ...