Documentation ¶
Index ¶
- Constants
- Variables
- type BaseCluster
- type Cluster
- type ClusterManager
- func (m *ClusterManager) Add(cluster *Cluster) error
- func (m *ClusterManager) AddPreInit(preInit func())
- 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) ([]*appv1.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) GetNodes(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Node, error)
- func (m *ClusterManager) GetOriginKubeCli(clusterNames ...string) (kubernetes.Interface, 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) GetService(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Service, error)
- func (m *ClusterManager) GetStatefulsets(opts *client.ListOptions, clusterNames ...string) ([]*appv1.StatefulSet, error)
- func (m *ClusterManager) Start(stopCh <-chan struct{}) error
- type ClusterManagerOption
- type ClusterStatusType
- type CustomeCluster
- type MasterClient
Constants ¶
const ( KeyKubeconfig = "kubeconfig.yaml" KeyStauts = "status" ClustersAll = "all" )
key config
Variables ¶
var ( // SyncPeriodTime ... SyncPeriodTime = 1 * time.Hour )
Functions ¶
This section is empty.
Types ¶
type BaseCluster ¶
type BaseCluster interface { GetOriginKubeCli(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) ([]*appv1.Deployment, error) GetStatefulsets(opts *client.ListOptions, clusternames ...string) ([]*appv1.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 }
BaseCluster is used to shield the complexity of the underlying multi-cluster and single cluster.
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 Status ClusterStatusType // Started is true if the Informers has been Started Started bool // contains filtered or unexported fields }
Cluster ...
func NewCluster ¶
NewCluster ...
type ClusterManager ¶
type ClusterManager struct { MasterClient Opt *ClusterManagerOption PreInit func() Started bool ClusterAddInfo chan map[string]string // contains filtered or unexported fields }
ClusterManager ...
func NewClusterManager ¶
func NewClusterManager(cli MasterClient, opt *ClusterManagerOption) (*ClusterManager, error)
NewClusterManager ...
func (*ClusterManager) AddPreInit ¶
func (m *ClusterManager) AddPreInit(preInit func())
AddPreInit ...
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) ([]*appv1.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) GetNodes ¶
func (m *ClusterManager) GetNodes(opts *client.ListOptions, clusterNames ...string) ([]*corev1.Node, error)
GetNodes ...
func (*ClusterManager) GetOriginKubeCli ¶
func (m *ClusterManager) GetOriginKubeCli(clusterNames ...string) (kubernetes.Interface, error)
GetOriginKubeCli returns the kubecli of the master cluster client if len(clusterNames) == 0, otherwise returns the specific kubecli.
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) 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) ([]*appv1.StatefulSet, error)
GetStatefulsets ...
func (*ClusterManager) Start ¶
func (m *ClusterManager) Start(stopCh <-chan struct{}) error
Start timer check cluster health
type ClusterManagerOption ¶
ClusterManagerOption ...
func DefaultClusterManagerOption ¶
func DefaultClusterManagerOption(namespace string, ls map[string]string) *ClusterManagerOption
DefaultClusterManagerOption ...
type ClusterStatusType ¶
type ClusterStatusType string
ClusterStatusType ...
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 CustomeCluster ¶
type CustomeCluster interface { BaseCluster GetHelmRelease(opts map[string]string, clusterNames ...string) ([]*rlsv2.Release, error) }
CustomeCluster extend the methods of the basic cluster, including some special business methods.
type MasterClient ¶
type MasterClient struct { KubeCli kubernetes.Interface manager.Manager }
MasterClient ...