gke

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CloudLoggingService is the Cloud Logging service with a Kubernetes-native resource model
	CloudLoggingService = "logging.googleapis.com/kubernetes"
)

Logging Services

View Source
const (
	// CloudMonitoringService is the Cloud Monitoring service with a Kubernetes-native resource model
	CloudMonitoringService = "monitoring.googleapis.com/kubernetes"
)

Monitoring Services

View Source
const (
	// NetworkProviderCalico describes the calico provider
	NetworkProviderCalico = "CALICO"
)

Network Providers

Variables

This section is empty.

Functions

func ClusterRRN

func ClusterRRN(projectID, location, clusterName string) string

ClusterRRN returns an Relative Resource Name of a cluster in the specified region or zone

func Create

func Create(ctx context.Context, gkeClient services.GKEClusterService, config *gkev1.GKEClusterConfig) error

Create creates an upstream GKE cluster.

func GetCluster

func GetCluster(ctx context.Context, gkeClient services.GKEClusterService, configSpec *gkev1.GKEClusterConfigSpec) (*gkeapi.Cluster, error)

func GetGKEClient

func GetGKEClient(ctx context.Context, credential string) (*gkeapi.Service, error)

GetGKEClient accepts a JSON credential string and returns a Service client.

func GetGKEClusterClient added in v1.2.0

func GetGKEClusterClient(ctx context.Context, credential string) (services.GKEClusterService, error)

func GetTokenSource

func GetTokenSource(ctx context.Context, credential string) (oauth2.TokenSource, error)

func Location

func Location(region, zone string) string

Location returns the region or zone depending on which is not set to empty. Cluster creation validation should ensure that only one of region or zone is set, not both.

func LocationRRN

func LocationRRN(projectID, location string) string

LocationRRN returns a Relative Resource Name representing a location. This RRN can either represent a Region or a Zone. It can be used as the parent attribute during cluster creation to create a zonal or regional cluster, or be used to generate more specific RRNs like an RRN representing a cluster.

https://cloud.google.com/apis/design/resource_names#relative_resource_name

func NodePoolRRN

func NodePoolRRN(projectID, location, clusterName, nodePool string) string

NodePoolRRN returns a Relative Resource Name of a node pool in a cluster in the region or zone for the specified project

func RemoveCluster

func RemoveCluster(ctx context.Context, gkeClient services.GKEClusterService, config *gkev1.GKEClusterConfig) error

RemoveCluster attempts to delete a cluster and retries the delete request if the cluster is busy.

Types

type Status

type Status int

Status indicates how to handle the response from a request to update a resource

const (
	// Changed means the request to change resource was accepted and change is in progress
	Changed Status = iota
	// Retry means the request to change resource was rejected due to an expected error and should be retried later
	Retry
	// NotChanged means the resource was not changed, either due to error or because it was unnecessary
	NotChanged
)

Status indicators

func CreateNodePool

func CreateNodePool(ctx context.Context, gkeClient services.GKEClusterService, config *gkev1.GKEClusterConfig, nodePoolConfig *gkev1.GKENodePoolConfig) (Status, error)

CreateNodePool creates an upstream node pool with the given cluster as a parent.

func RemoveNodePool

func RemoveNodePool(ctx context.Context, gkeClient services.GKEClusterService, config *gkev1.GKEClusterConfig, nodePoolName string) (Status, error)

RemoveNodePool deletes a node pool

func UpdateClusterAddons

func UpdateClusterAddons(ctx context.Context, gkeClient services.GKEClusterService, config *gkev1.GKEClusterConfig, upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateClusterAddons updates the cluster addons. In the case of the NetworkPolicyConfig addon, this may need to be retried after NetworkPolicyEnabled has been updated.

func UpdateLabels

func UpdateLabels(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	config *gkev1.GKEClusterConfig,
	upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateLabels updates the cluster labels.

func UpdateLocations

func UpdateLocations(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	config *gkev1.GKEClusterConfig,
	upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateLocations updates Locations.

func UpdateLoggingMonitoringService

func UpdateLoggingMonitoringService(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	config *gkev1.GKEClusterConfig,
	upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateLoggingMonitoringService updates both LoggingService and MonitoringService. In most cases, updating one requires explicitly updating the other as well, so these are paired.

func UpdateMaintenanceWindow

func UpdateMaintenanceWindow(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	config *gkev1.GKEClusterConfig,
	upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateMaintenanceWindow updates Cluster.MaintenancePolicy.Window.DailyMaintenanceWindow.StartTime

func UpdateMasterAuthorizedNetworks

func UpdateMasterAuthorizedNetworks(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	config *gkev1.GKEClusterConfig,
	upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateMasterAuthorizedNetworks updates MasterAuthorizedNetworks

func UpdateMasterKubernetesVersion

func UpdateMasterKubernetesVersion(ctx context.Context, gkeClient services.GKEClusterService, config *gkev1.GKEClusterConfig, upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateMasterKubernetesVersion updates the Kubernetes version for the control plane. This must occur before the Kubernetes version is changed on the nodes.

func UpdateNetworkPolicyEnabled

func UpdateNetworkPolicyEnabled(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	config *gkev1.GKEClusterConfig,
	upstreamSpec *gkev1.GKEClusterConfigSpec) (Status, error)

UpdateNetworkPolicyEnabled updates the Cluster NetworkPolicy setting.

func UpdateNodePoolAutoscaling

func UpdateNodePoolAutoscaling(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	nodePool *gkev1.GKENodePoolConfig,
	config *gkev1.GKEClusterConfig,
	upstreamNodePool *gkev1.GKENodePoolConfig) (Status, error)

UpdateNodePoolAutoscaling updates the autoscaling parameters for a given node pool. If the node pool is busy, it will return a Retry status indicating the operation should be retried later.

func UpdateNodePoolConfig added in v1.1.6

func UpdateNodePoolConfig(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	nodePool *gkev1.GKENodePoolConfig,
	config *gkev1.GKEClusterConfig,
	upstreamNodePool *gkev1.GKENodePoolConfig) (Status, error)

UpdateNodePoolConfig updates the configured parameters for a given node pool. If the node pool is busy, it will return a Retry status indicating the operation should be retried later.

func UpdateNodePoolKubernetesVersionOrImageType

func UpdateNodePoolKubernetesVersionOrImageType(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	nodePool *gkev1.GKENodePoolConfig,
	config *gkev1.GKEClusterConfig,
	upstreamNodePool *gkev1.GKENodePoolConfig) (Status, error)

UpdateNodePoolKubernetesVersionOrImageType sends a combined request to update either the node pool Kubernetes version or image type or both. These attributes are among the few that can be updated in the same request. If the node pool is busy, it will return a Retry status indicating the operation should be retried later.

func UpdateNodePoolManagement

func UpdateNodePoolManagement(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	nodePool *gkev1.GKENodePoolConfig,
	config *gkev1.GKEClusterConfig,
	upstreamNodePool *gkev1.GKENodePoolConfig) (Status, error)

UpdateNodePoolManagement updates the management parameters for a given node pool. If the node pool is busy, it will return a Retry status indicating the operation should be retried later.

func UpdateNodePoolSize

func UpdateNodePoolSize(
	ctx context.Context,
	gkeClient services.GKEClusterService,
	nodePool *gkev1.GKENodePoolConfig,
	config *gkev1.GKEClusterConfig,
	upstreamNodePool *gkev1.GKENodePoolConfig) (Status, error)

UpdateNodePoolSize sets the size of a given node pool. If the node pool is busy, it will return a Retry status indicating the operation should be retried later.

Directories

Path Synopsis
mock_services
Package mock_services is a generated GoMock package.
Package mock_services is a generated GoMock package.

Jump to

Keyboard shortcuts

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