k8ssvc

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrVolumeExist means PersistentVolume exists
	ErrVolumeExist = errors.New("PersistentVolume Exists")
	// ErrVolumeClaimExist means PersistentVolumeClaim exists
	ErrVolumeClaimExist = errors.New("PersistentVolumeClaim Exists")
)

Functions

This section is empty.

Types

type K8sSvc

type K8sSvc struct {
	// contains filtered or unexported fields
}

K8sSvc implements the containersvc interface for kubernetes. https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster

func NewK8sSvc

func NewK8sSvc(cloudPlatform string, namespace string) (*K8sSvc, error)

NewK8sSvc creates a new K8sSvc instance.

func NewK8sSvcWithConfig

func NewK8sSvcWithConfig(cloudPlatform string, namespace string, config *rest.Config) (*K8sSvc, error)

NewK8sSvcWithConfig creates a new K8sSvc instance with the config.

func (*K8sSvc) CreatePV

func (s *K8sSvc) CreatePV(ctx context.Context, service string, pvname string, sclassname string, volID string, volSizeGB int64, fsType string) (*corev1.PersistentVolume, error)

CreatePV creates a PersistentVolume.

func (*K8sSvc) CreatePVC

func (s *K8sSvc) CreatePVC(ctx context.Context, service string, pvcname string, pvname string, sclassname string, volSizeGB int64) (*corev1.PersistentVolumeClaim, error)

CreatePVC creates a PersistentVolumeClaim.

func (*K8sSvc) CreateService

func (s *K8sSvc) CreateService(ctx context.Context, opts *containersvc.CreateServiceOptions) error

CreateService creates the headless service, storage class and statefulset.

func (*K8sSvc) DeleteService

func (s *K8sSvc) DeleteService(ctx context.Context, cluster string, service string) error

DeleteService deletes the service on the container platform. Expect no error (nil) if service does not exist.

func (*K8sSvc) DeleteTask

func (s *K8sSvc) DeleteTask(ctx context.Context, cluster string, service string, taskType string) error

DeleteTask deletes the task.

func (*K8sSvc) GetServiceStatus

func (s *K8sSvc) GetServiceStatus(ctx context.Context, cluster string, service string) (*common.ServiceStatus, error)

GetServiceStatus returns the service status.

func (*K8sSvc) GetServiceTask

func (s *K8sSvc) GetServiceTask(ctx context.Context, cluster string, service string, containerInstanceID string) (serviceTaskID string, err error)

GetServiceTask gets the service task on the container instance.

func (*K8sSvc) GetTaskStatus

func (s *K8sSvc) GetTaskStatus(ctx context.Context, cluster string, taskID string) (*common.TaskStatus, error)

GetTaskStatus gets the task status.

func (*K8sSvc) IsServiceExist

func (s *K8sSvc) IsServiceExist(ctx context.Context, cluster string, service string) (bool, error)

IsServiceExist checks if service exists. If not exist, return false & nil. If exists, return true & nil. If meets any error, error will be returned.

func (*K8sSvc) ListActiveServiceTasks

func (s *K8sSvc) ListActiveServiceTasks(ctx context.Context, cluster string, service string) (serviceTaskIDs map[string]bool, err error)

ListActiveServiceTasks lists the active (pending and running) tasks of the service.

func (*K8sSvc) RunTask

func (s *K8sSvc) RunTask(ctx context.Context, opts *containersvc.RunTaskOptions) (taskID string, err error)

RunTask runs a task.

func (*K8sSvc) ScaleService

func (s *K8sSvc) ScaleService(ctx context.Context, cluster string, service string, desiredCount int64) error

ScaleService scales the service containers up/down to the desiredCount. Note: it does not wait till all containers are started or stopped.

func (*K8sSvc) StopService

func (s *K8sSvc) StopService(ctx context.Context, cluster string, service string) error

StopService stops the service on the container platform, and waits till all containers are stopped. Expect no error (nil) if service is already stopped or does not exist.

Directories

Path Synopsis
Note: the example only works with the code within the same release/branch.
Note: the example only works with the code within the same release/branch.

Jump to

Keyboard shortcuts

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