Documentation ¶
Overview ¶
Package clustermanager provides support for managing clusters for e2e tests, responsible for creating/deleting cluster, and cluster life cycle management if running in Prow usage example:
func acquireCluster() { clusterOps := GKEClient{}.Setup(2, "n1-standard-8", "us-east1", "a", "myproject") // Cast to GKEOperation GKEOps := clusterOps.(GKECluster) if err = GKEOps.Acquire(); err != nil { log.Fatalf("Failed acquire cluster: '%v'", err) } log.Printf("GKE project is: %s", GKEOps.Project) log.Printf("GKE cluster is: %v", GKEOps.Cluster) }
Index ¶
Constants ¶
const ( DefaultGKENumNodes = 1 DefaultGKENodeType = "n1-standard-4" DefaultGKERegion = "us-central1" DefaultGKEZone = "" )
Variables ¶
var (
DefaultGKEBackupRegions = []string{"us-west1", "us-east1"}
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Setup(...interface{}) (ClusterOperations, error)
}
Client is the entrypoint
type ClusterOperations ¶
ClusterOperations contains all provider specific logics
type GKEClient ¶
type GKEClient struct { }
GKEClient implements Client
func (*GKEClient) Setup ¶
func (gs *GKEClient) Setup(numNodes *int64, nodeType *string, region *string, zone *string, project *string) (ClusterOperations, error)
Setup sets up a GKECluster client. numNodes: default to 3 if not provided nodeType: default to n1-standard-4 if not provided region: default to regional cluster if not provided, and use default backup regions zone: default is none, must be provided together with region
type GKECluster ¶
type GKECluster struct { Request *GKERequest // Project might be GKE specific, so put it here Project *string // NeedCleanup tells whether the cluster needs to be deleted afterwards // This probably should be part of task wrapper's logic NeedCleanup bool Cluster *container.Cluster // contains filtered or unexported fields }
GKECluster implements ClusterOperations
func (*GKECluster) Acquire ¶
func (gc *GKECluster) Acquire() error
Acquire gets existing cluster or create a new one, the creation logic contains retries in BackupRegions. Default creating cluster in us-central1, and default BackupRegions are us-west1 and us-east1. If Region or Zone is provided then there is no retries
type GKERequest ¶
type GKERequest struct { NumNodes int64 NodeType string Region string Zone string BackupRegions []string }
GKERequest contains all requests collected for cluster creation
type GKESDKClient ¶
type GKESDKClient struct {
*container.Service
}
GKESDKClient Implement GKESDKOperations
type GKESDKOperations ¶
type GKESDKOperations interface {
// contains filtered or unexported methods
}
GKESDKOperations wraps GKE SDK related functions