Version: v0.0.0-...-f480fc3 Latest Latest

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0




This section is empty.


This section is empty.


func GetAddonsConfig

func GetAddonsConfig(addons []string) *container.AddonsConfig

GetAddonsConfig gets AddonsConfig from a slice of addon names, contains the logic of converting string argument to typed AddonsConfig, for example `IstioConfig`. Currently supports Istio, HorizontalPodAutoscaling, HttpLoadBalancing and CloudRun.

func GetClusterLocation

func GetClusterLocation(region, zone string) string

GetClusterLocation returns the location used in GKE operations, given the region and zone.

func NewCreateClusterRequest

func NewCreateClusterRequest(request *Request) (*container.CreateClusterRequest, error)

NewCreateClusterRequest returns a new CreateClusterRequest that can be used in gcloud SDK.

func RegionZoneFromLoc

func RegionZoneFromLoc(location string) (string, string)

RegionZoneFromLoc returns the region and the zone, given the location.

func ServiceEndpoint

func ServiceEndpoint(environment string) (string, error)

ServiceEndpoint returns the container service endpoint for the given environment.

func Wait

func Wait(gsc SDKOperations, project, region, zone, opName string, wait time.Duration) error

Wait depends on unique opName(operation ID created by cloud), and waits until it's done


type Request

type Request struct {
	// GCPCredentialFile: the GCP credential file to use for the cluster operations
	GCPCredentialFile string

	// Project: name of the gcloud project for the cluster
	Project string

	// GKEVersion: GKE version of the cluster, default to be latest if not provided
	GKEVersion string

	// ReleaseChannel: GKE release channel. Only one of GKEVersion or ReleaseChannel can be
	// specified at a time.
	// https://cloud.google.com/kubernetes-engine/docs/concepts/release-channels
	ReleaseChannel string

	// ClusterName: name of the cluster
	ClusterName string

	// MinNodes: the minimum number of nodes of the cluster
	MinNodes int64

	// MaxNodes: the maximum number of nodes of the cluster
	MaxNodes int64

	// NodeType: node type of the cluster, e.g. e2-standard-4, e2-standard-8
	NodeType string

	// Region: region of the cluster, e.g. us-west1, us-central1
	Region string

	// Zone: default is none, must be provided together with region
	Zone string

	// Addons: cluster addons to be added to cluster, such as istio
	Addons []string

	// EnableWorkloadIdentity: whether to enable Workload Identity for this cluster
	EnableWorkloadIdentity bool

	// ServiceAccount: service account that will be used on this cluster
	ServiceAccount string

Request contains all settings collected for cluster creation

func (*Request) DeepCopy

func (r *Request) DeepCopy() *Request

DeepCopy will make a deepcopy of the request struct.

type SDKOperations

type SDKOperations interface {
	CreateCluster(project, region, zone string, req *container.CreateClusterRequest) error
	CreateClusterAsync(project, region, zone string, req *container.CreateClusterRequest) (*container.Operation, error)
	DeleteCluster(project, region, zone, clusterName string) error
	DeleteClusterAsync(project, region, zone, clusterName string) (*container.Operation, error)
	GetCluster(project, region, zone, clusterName string) (*container.Cluster, error)
	GetOperation(project, region, zone, opName string) (*container.Operation, error)
	ListClustersInProject(project string) ([]*container.Cluster, error)

SDKOperations wraps GKE SDK related functions

func NewSDKClient

func NewSDKClient(opts ...option.ClientOption) (SDKOperations, error)

NewSDKClient returns an SDKClient that implements SDKOperations


Path Synopsis

Jump to

Keyboard shortcuts

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