pke

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Autoscaling

type Autoscaling struct {
	Enabled bool `mapstructure:"enabled"`
	MinSize int  `mapstructure:"minSize"`
	MaxSize int  `mapstructure:"maxSize"`
}

Autoscaling describes the EC2 node pool's autoscaling settings.

type ClusterManager

type ClusterManager interface {
	// UpdateCluster updates an existing cluster.
	UpdateCluster(ctx context.Context, c cluster.Cluster, clusterUpdate ClusterUpdate) error
}

ClusterManager is responsible for managing clusters.

type ClusterUpdate

type ClusterUpdate struct {
	Version string `mapstructure:"version"`
}

ClusterUpdate describes a cluster update request.

A cluster update contains a partial representation of the cluster resource, updating only the changed values.

type ExistingNodePool

type ExistingNodePool struct {
	Name string
}

type MockNodePoolStore

type MockNodePoolStore struct {
	mock.Mock
}

MockNodePoolStore is an autogenerated mock for the NodePoolStore type.

func (*MockNodePoolStore) DeleteNodePool

func (_m *MockNodePoolStore) DeleteNodePool(ctx context.Context, organizationID uint, clusterID uint, clusterName string, nodePoolName string) (_result_0 error)

DeleteNodePool provides a mock function.

func (*MockNodePoolStore) ListNodePools

func (_m *MockNodePoolStore) ListNodePools(ctx context.Context, organizationID uint, clusterID uint, clusterName string) (existingNodePools map[string]ExistingNodePool, err error)

ListNodePools provides a mock function.

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock for the Service type.

func (*MockService) DeleteNodePool

func (_m *MockService) DeleteNodePool(ctx context.Context, clusterID uint, nodePoolName string) (isDeleted bool, err error)

DeleteNodePool provides a mock function.

func (*MockService) ListNodePools

func (_m *MockService) ListNodePools(ctx context.Context, clusterID uint) (_result_0 []NodePool, _result_1 error)

ListNodePools provides a mock function.

func (*MockService) UpdateCluster

func (_m *MockService) UpdateCluster(ctx context.Context, clusterID uint, clusterUpdate ClusterUpdate) (_result_0 error)

UpdateCluster provides a mock function.

func (*MockService) UpdateNodePool

func (_m *MockService) UpdateNodePool(ctx context.Context, clusterID uint, nodePoolName string, nodePoolUpdate NodePoolUpdate) (_result_0 string, _result_1 error)

UpdateNodePool provides a mock function.

type NodePool

type NodePool struct {
	Name         string            `mapstructure:"name"`
	Labels       map[string]string `mapstructure:"labels"`
	Size         int               `mapstructure:"size"`
	Autoscaling  Autoscaling       `mapstructure:"autoscaling"`
	VolumeSize   int               `mapstructure:"volumeSize"`
	InstanceType string            `mapstructure:"instanceType"`
	Image        string            `mapstructure:"image"`
	SpotPrice    string            `mapstructure:"spotPrice"`
	SubnetID     string            `mapstructure:"subnetId"`
}

NodePool encapsulates information about a cluster node pool.

type NodePoolManager

type NodePoolManager interface {
	// DeleteNodePool deletes an existing node pool in a cluster.
	DeleteNodePool(
		ctx context.Context,
		c cluster.Cluster,
		existingNodePool ExistingNodePool,
		shouldUpdateClusterStatus bool,
	) (err error)

	// UpdateNodePool updates an existing node pool in a cluster.
	UpdateNodePool(
		ctx context.Context,
		c cluster.Cluster,
		nodePoolName string,
		nodePoolUpdate NodePoolUpdate,
	) (string, error)
}

NodePoolManager is responsible for managing node pools.

type NodePoolStore

type NodePoolStore interface {
	// DeleteNodePool deletes an existing node pool from the storage.
	DeleteNodePool(ctx context.Context, organizationID, clusterID uint, clusterName string, nodePoolName string) error

	// ListNodePools retrieves the node pools for the cluster specified by its
	// cluster ID.
	ListNodePools(
		ctx context.Context,
		organizationID uint,
		clusterID uint,
		clusterName string,
	) (existingNodePools map[string]ExistingNodePool, err error)
}

NodePoolStore provides an interface for PKE node pool persistence.

type NodePoolUpdate

type NodePoolUpdate struct {
	Image string `mapstructure:"image"`

	Version string `mapstructure:"version"`

	Options NodePoolUpdateOptions `mapstructure:"options"`
}

NodePoolUpdate describes a node pool update request.

A node pool update contains a partial representation of the node pool resource, updating only the changed values.

type NodePoolUpdateDrainOptions

type NodePoolUpdateDrainOptions struct {
	Timeout int `mapstructure:"timeout"`

	FailOnError bool `mapstructure:"failOnError"`

	PodSelector string `mapstructure:"podSelector"`
}

type NodePoolUpdateOptions

type NodePoolUpdateOptions struct {
	// Maximum number of extra nodes that can be created during the update.
	MaxSurge int `mapstructure:"maxSurge"`

	// Maximum number of nodes that can be updated simultaneously.
	MaxBatchSize int `mapstructure:"maxBatchSize"`

	// Maximum number of nodes that can be unavailable during the update.
	MaxUnavailable int `mapstructure:"maxUnavailable"`

	// Kubernetes node drain specific options.
	Drain NodePoolUpdateDrainOptions `mapstructure:"drain"`
}

type Service

type Service interface {
	// DeleteNodePool deletes an existing node pool.
	DeleteNodePool(ctx context.Context, clusterID uint, nodePoolName string) (isDeleted bool, err error)
	// UpdateCluster updates a cluster.
	//
	// This method accepts a partial body representation.
	UpdateCluster(ctx context.Context, clusterID uint, clusterUpdate ClusterUpdate) error

	// UpdateNodePool updates an existing node pool in a cluster.
	//
	// This method accepts a partial body representation.
	UpdateNodePool(ctx context.Context, clusterID uint, nodePoolName string, nodePoolUpdate NodePoolUpdate) (string, error)

	// ListNodePools lists node pools from a cluster.
	ListNodePools(ctx context.Context, clusterID uint) ([]NodePool, error)
}

Service provides an interface to PKE AWS clusters.

func NewService

func NewService(
	genericClusters Store,
	nodePoolManager NodePoolManager,
	nodePoolStore NodePoolStore,
	enterprise bool,
) Service

NewService returns a new Service instance.

type Store

type Store interface {
	// GetCluster returns a generic Cluster.
	// Returns an error with the NotFound behavior when the cluster cannot be found.
	GetCluster(ctx context.Context, id uint) (cluster.Cluster, error)

	// SetStatus sets the cluster status.
	SetStatus(ctx context.Context, id uint, status string, statusMessage string) error
}

Store provides an interface to the generic Cluster model persistence.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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