Documentation ¶
Overview ¶
Package cluster contains code for syncing cluster
Index ¶
Constants ¶
View Source
const ( UserAgentName = "Cluster-Controller" KubeAPIQPS = 20.0 KubeAPIBurst = 30 KubeconfigSecretDataKey = "kubeconfig" )
Variables ¶
View Source
var KubeconfigGetterForCluster = func(c *federation_v1alpha1.Cluster) clientcmd.KubeconfigGetter { return func() (*clientcmdapi.Config, error) { namespace := os.Getenv("POD_NAMESPACE") if namespace == "" { return nil, fmt.Errorf("unexpected: POD_NAMESPACE env var returned empty string") } client, err := client.NewInCluster() if err != nil { return nil, fmt.Errorf("error in creating in-cluster client: %s", err) } data := []byte{} if c.Spec.SecretRef != nil { secret, err := client.Secrets(namespace).Get(c.Spec.SecretRef.Name) if err != nil { return nil, fmt.Errorf("error in fetching secret: %s", err) } ok := false data, ok = secret.Data[KubeconfigSecretDataKey] if !ok { return nil, fmt.Errorf("secret does not have data with key: %s", KubeconfigSecretDataKey) } } else { glog.Infof("didnt find secretRef for cluster %s. Trying insecure access", c.Name) } return clientcmd.Load(data) } }
This is to inject a different kubeconfigGetter in tests. We dont use the standard one which calls NewInCluster in tests to avoid having to setup service accounts and mount files with secret tokens.
Functions ¶
This section is empty.
Types ¶
type ClusterClient ¶
type ClusterClient struct {
// contains filtered or unexported fields
}
func NewClusterClientSet ¶
func NewClusterClientSet(c *federation_v1alpha1.Cluster) (*ClusterClient, error)
func (*ClusterClient) GetClusterHealthStatus ¶
func (self *ClusterClient) GetClusterHealthStatus() *federation_v1alpha1.ClusterStatus
GetClusterHealthStatus gets the kubernetes cluster health status by requesting "/healthz"
func (*ClusterClient) GetClusterZones ¶
func (self *ClusterClient) GetClusterZones() (zones []string, region string, err error)
GetClusterZones gets the kubernetes cluster zones and region by inspecting labels on nodes in the cluster.
type ClusterController ¶
type ClusterController struct {
// contains filtered or unexported fields
}
func NewclusterController ¶
func NewclusterController(federationClient federationclientset.Interface, clusterMonitorPeriod time.Duration) *ClusterController
NewclusterController returns a new cluster controller
func (*ClusterController) GetClusterStatus ¶
func (cc *ClusterController) GetClusterStatus(cluster *federation_v1alpha1.Cluster) (*federation_v1alpha1.ClusterStatus, error)
func (*ClusterController) UpdateClusterStatus ¶
func (cc *ClusterController) UpdateClusterStatus() error
UpdateClusterStatus checks cluster status and get the metrics from cluster's restapi
Click to show internal directories.
Click to hide internal directories.