Documentation
¶
Index ¶
- func GetAddonsConfig(addons []string) *container.AddonsConfig
- func GetClusterLocation(region, zone string) string
- func NewCreateClusterRequest(request *Request) (*container.CreateClusterRequest, error)
- func RegionZoneFromLoc(location string) (string, string)
- func ServiceEndpoint(environment string) (string, error)
- func Wait(gsc SDKOperations, project, region, zone, opName string, wait time.Duration) error
- type Request
- type SDKOperations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
RegionZoneFromLoc returns the region and the zone, given the location.
func ServiceEndpoint ¶
ServiceEndpoint returns the container service endpoint for the given environment.
Types ¶
type Request ¶
type Request struct {
// 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
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