clustermanager

package
v0.0.0-...-75da391 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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

View Source
const (
	DefaultGKENumNodes = 1
	DefaultGKENodeType = "n1-standard-4"
	DefaultGKERegion   = "us-central1"
	DefaultGKEZone     = ""
)

Variables

View Source
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

type ClusterOperations interface {
	Provider() string
	Acquire() error
	Delete() error
}

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

func (*GKECluster) Delete

func (gc *GKECluster) Delete() error

Delete deletes a GKE cluster

func (*GKECluster) Provider

func (gc *GKECluster) Provider() string

Provider returns gke

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

type ResourceType

type ResourceType string
var (
	ClusterResource ResourceType = "e2e-cls"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL