cluster

package
v0.0.0-...-fbcd7f5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNodePool

func NewNodePool(nodePool Pool) (*container.NodePool, error)

Types

type API

type API interface {
	Create(ctx context.Context, clusterConfig Cluster) error
	Delete(ctx context.Context, name string, zoneID string) error
}

API provides a mockable interface for the GCP api. Find the implementation of the GCP wrapped API in wrapped.go

type APIWrapper

type APIWrapper struct {
	ProjectID      string
	ZoneID         string
	ClusterService *container.ProjectsZonesClustersService
}

APIWrapper wraps the GCP api

func NewGKEClient

func NewGKEClient(ctx context.Context, projectID string) (*APIWrapper, error)

func (*APIWrapper) Create

func (caw *APIWrapper) Create(ctx context.Context, clusterConfig Cluster) error

Create calls the wrapped GCP api to create a cluster

func (*APIWrapper) Delete

func (caw *APIWrapper) Delete(ctx context.Context, name string, zoneID string) error

Delete calls the wrapped GCP api to delete a cluster

func (*APIWrapper) Get

func (caw *APIWrapper) Get(ctx context.Context, clusterID string, zoneID string) (*container.Cluster, error)

type Autoscaling

type Autoscaling struct {
	Enabled      bool  `yaml:"enabled"`
	MinNodeCount int64 `yaml:"minNodeCount"`
	MaxNodeCount int64 `yaml:"maxNodeCount"`
}

Autoscaling features for cluster

type Client

type Client struct {
	Option
	// contains filtered or unexported fields
}

Client wrapper for KMS and GCS secret storage

func New

func New(opts Option, api API) (*Client, error)

New returns a new Client, wrapping gke

func NewClient

func NewClient(ctx context.Context, opts Option, credentials string) (*Client, error)

func (*Client) Create

func (cc *Client) Create(ctx context.Context, clusterConfig Cluster) error

Create attempts to create a GKE cluster

func (*Client) Delete

func (cc *Client) Delete(ctx context.Context, name string, zoneId string) error

Delete attempts to delete a GKE cluster

type Cluster

type Cluster struct {
	Name                  string            `yaml:"name"`
	Location              string            `yaml:"location"`
	Description           string            `yaml:"description,omitempty"`
	Labels                map[string]string `yaml:"labels,omitempty"`
	Pools                 []Pool            `yaml:"pools"`
	InitialClusterVersion string            `yaml:"kubernetesVersion,omitempty"`
	K8sClient             *kubernetes.Clientset
	KubectlWrapper        *kubectl.Wrapper
	Populator             *k8s.Populator
}

type MockAPI

type MockAPI struct {
}

func (*MockAPI) Create

func (api *MockAPI) Create(ctx context.Context, clusterConfig Cluster) error

func (*MockAPI) Delete

func (api *MockAPI) Delete(ctx context.Context, name string, zoneId string) error

type NodeConfig

type NodeConfig struct {
	MachineType string `yaml:"machineType,omitempty"`
	DiskType    string `yaml:"diskType,omitempty"`
	DiskSizeGb  int64  `yaml:"diskSizeGb,omitempty"`
}

type Option

type Option struct {
	Prefix         string // global prefix
	ProjectID      string // GCP project ID
	ServiceAccount string // filename of the serviceaccount to use
}

func (Option) WithProjectID

func (o Option) WithProjectID(pid string) Option

WithProjectID modifies option to have a project id

func (Option) WithServiceAccount

func (o Option) WithServiceAccount(sa string) Option

WithServiceAccount modifies option to have a service account

type Pool

type Pool struct {
	Name        string      `yaml:"name"`
	Size        int64       `yaml:"initialSize,omitempty"`
	Autoscaling Autoscaling `yaml:"autoscaling,omitempty"`
	NodeConfig  NodeConfig  `yaml:"config,omitempty"`
}

node pool settings

Jump to

Keyboard shortcuts

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