cluster

package
v0.2.3-beta2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package cluster is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRouterPod added in v0.2.3

func CreateRouterPod(ctx context.Context, k KubernetesInterface, name string, options *options.DaemonOptions,
	labels, annotations map[string]string) error

func GetKtPods

func GetKtPods(ctx context.Context, k KubernetesInterface, namespace string) ([]coreV1.Pod, error)

GetKtPods fetch all shadow and router pods

func GetOrCreateShadow added in v0.2.3

func GetOrCreateShadow(ctx context.Context, k KubernetesInterface, name string, options *options.DaemonOptions, labels, annotations, envs map[string]string) (
	podIP, podName, sshcm string, credential *util.SSHCredential, err error)

GetOrCreateShadow create shadow

Types

type Kubernetes

type Kubernetes struct {
	KubeConfig string
	Clientset  kubernetes.Interface
}

Kubernetes implements KubernetesInterface

func (*Kubernetes) AddEphemeralContainer added in v0.2.0

func (k *Kubernetes) AddEphemeralContainer(ctx context.Context, containerName string, podName string,
	options *options.DaemonOptions, envs map[string]string) (sshcm string, err error)

AddEphemeralContainer add ephemeral container to specified pod

func (*Kubernetes) ClusterCidrs added in v0.1.0

func (k *Kubernetes) ClusterCidrs(ctx context.Context, namespace string, opt *options.ConnectOptions) (cidrs []string, err error)

ClusterCidrs get cluster Cidrs

func (*Kubernetes) CreateConfigMapWithSshKey added in v0.2.3

func (k *Kubernetes) CreateConfigMapWithSshKey(ctx context.Context, labels map[string]string, sshcm string, namespace string,
	generator *util.SSHGenerator) (configMap *coreV1.ConfigMap, err error)

func (*Kubernetes) CreatePod added in v0.2.3

func (k *Kubernetes) CreatePod(ctx context.Context, metaAndSpec *PodMetaAndSpec, options *options.DaemonOptions) error

CreatePod create pod

func (*Kubernetes) CreateService added in v0.1.0

func (k *Kubernetes) CreateService(ctx context.Context, metaAndSpec *SvcMetaAndSpec) (*coreV1.Service, error)

CreateService create kubernetes service

func (*Kubernetes) CreateShadowPod added in v0.2.3

func (k *Kubernetes) CreateShadowPod(ctx context.Context, metaAndSpec *PodMetaAndSpec, sshcm string, options *options.DaemonOptions) error

CreateShadowPod create shadow pod

func (*Kubernetes) DecreaseRef added in v0.1.0

func (k *Kubernetes) DecreaseRef(ctx context.Context, name string, namespace string) (cleanup bool, err error)

DecreaseRef decrease pod ref count by 1

func (*Kubernetes) ExecInPod added in v0.2.3

func (k *Kubernetes) ExecInPod(containerName, podName, namespace string, opts options.RuntimeOptions, cmd ...string) (string, string, error)

func (*Kubernetes) GetConfigMap added in v0.2.3

func (k *Kubernetes) GetConfigMap(ctx context.Context, name, namespace string) (*coreV1.ConfigMap, error)

GetConfigMap get configmap

func (*Kubernetes) GetDeployment added in v0.1.0

func (k *Kubernetes) GetDeployment(ctx context.Context, name string, namespace string) (*appV1.Deployment, error)

GetDeployment ...

func (*Kubernetes) GetPod added in v0.2.0

func (k *Kubernetes) GetPod(ctx context.Context, name string, namespace string) (*coreV1.Pod, error)

GetPod ...

func (*Kubernetes) GetPods

func (k *Kubernetes) GetPods(ctx context.Context, labels map[string]string, namespace string) (*coreV1.PodList, error)

GetPods get pods by label

func (*Kubernetes) GetService added in v0.2.3

func (k *Kubernetes) GetService(ctx context.Context, name, namespace string) (*coreV1.Service, error)

GetService get service

func (*Kubernetes) GetServiceHosts added in v0.2.3

func (k *Kubernetes) GetServiceHosts(ctx context.Context, namespace string) (hosts map[string]string)

GetServiceHosts get service dns map

func (*Kubernetes) GetServices added in v0.2.3

func (k *Kubernetes) GetServices(ctx context.Context, matchLabels map[string]string, namespace string) ([]coreV1.Service, error)

GetServices get pods by label

func (*Kubernetes) IncreaseRef added in v0.2.3

func (k *Kubernetes) IncreaseRef(ctx context.Context, name string, namespace string) error

IncreaseRef increase pod ref count by 1

func (*Kubernetes) RemoveConfigMap added in v0.1.0

func (k *Kubernetes) RemoveConfigMap(ctx context.Context, name, namespace string) (err error)

RemoveConfigMap remove ConfigMap instance

func (*Kubernetes) RemoveEphemeralContainer added in v0.2.0

func (k *Kubernetes) RemoveEphemeralContainer(ctx context.Context, containerName, podName string, namespace string) (err error)

RemoveEphemeralContainer remove ephemeral container from specified pod

func (*Kubernetes) RemovePod added in v0.2.0

func (k *Kubernetes) RemovePod(ctx context.Context, name, namespace string) (err error)

RemovePod remove pod instances

func (*Kubernetes) RemoveService added in v0.1.0

func (k *Kubernetes) RemoveService(ctx context.Context, name, namespace string) (err error)

RemoveService remove service

func (*Kubernetes) ScaleTo added in v0.1.0

func (k *Kubernetes) ScaleTo(ctx context.Context, name, namespace string, replicas *int32) (err error)

ScaleTo scale deployment to

func (*Kubernetes) UpdateDeployment added in v0.1.0

func (k *Kubernetes) UpdateDeployment(ctx context.Context, deployment *appV1.Deployment) (*appV1.Deployment, error)

UpdateDeployment ...

func (*Kubernetes) UpdatePod added in v0.2.0

func (k *Kubernetes) UpdatePod(ctx context.Context, pod *coreV1.Pod) (*coreV1.Pod, error)

UpdatePod ...

func (*Kubernetes) UpdateService added in v0.2.3

func (k *Kubernetes) UpdateService(ctx context.Context, svc *coreV1.Service) (*coreV1.Service, error)

UpdateService ...

func (*Kubernetes) WaitPodReady added in v0.2.3

func (k *Kubernetes) WaitPodReady(name, namespace string) (pod *coreV1.Pod, err error)

type KubernetesInterface

type KubernetesInterface interface {
	CreatePod(ctx context.Context, metaAndSpec *PodMetaAndSpec, options *options.DaemonOptions) error
	CreateShadowPod(ctx context.Context, metaAndSpec *PodMetaAndSpec, sshcm string, options *options.DaemonOptions) error
	GetPod(ctx context.Context, name string, namespace string) (*coreV1.Pod, error)
	GetPods(ctx context.Context, labels map[string]string, namespace string) (pods *coreV1.PodList, err error)
	UpdatePod(ctx context.Context, pod *coreV1.Pod) (*coreV1.Pod, error)
	WaitPodReady(name, namespace string) (pod *coreV1.Pod, err error)
	IncreaseRef(ctx context.Context, name, namespace string) error
	DecreaseRef(ctx context.Context, name, namespace string) (cleanup bool, err error)
	AddEphemeralContainer(ctx context.Context, containerName, podName string, options *options.DaemonOptions, envs map[string]string) (sshcm string, err error)
	RemoveEphemeralContainer(ctx context.Context, containerName, podName string, namespace string) (err error)
	ExecInPod(containerName, podName, namespace string, opts options.RuntimeOptions, cmd ...string) (string, string, error)
	RemovePod(ctx context.Context, name, namespace string) (err error)

	GetDeployment(ctx context.Context, name string, namespace string) (*appV1.Deployment, error)
	UpdateDeployment(ctx context.Context, deployment *appV1.Deployment) (*appV1.Deployment, error)
	ScaleTo(ctx context.Context, deployment, namespace string, replicas *int32) (err error)

	CreateService(ctx context.Context, metaAndSpec *SvcMetaAndSpec) (*coreV1.Service, error)
	UpdateService(ctx context.Context, svc *coreV1.Service) (*coreV1.Service, error)
	GetService(ctx context.Context, name, namespace string) (*coreV1.Service, error)
	GetServices(ctx context.Context, matchLabels map[string]string, namespace string) ([]coreV1.Service, error)
	GetServiceHosts(ctx context.Context, namespace string) (hosts map[string]string)
	RemoveService(ctx context.Context, name, namespace string) (err error)

	CreateConfigMapWithSshKey(ctx context.Context, labels map[string]string, sshcm string, namespace string,
		generator *util.SSHGenerator) (configMap *coreV1.ConfigMap, err error)
	GetConfigMap(ctx context.Context, name, namespace string) (*coreV1.ConfigMap, error)
	RemoveConfigMap(ctx context.Context, name, namespace string) (err error)

	ClusterCidrs(ctx context.Context, namespace string, connectOptions *options.ConnectOptions) (cidrs []string, err error)
}

KubernetesInterface kubernetes interface

func CreateFromClientSet added in v0.1.0

func CreateFromClientSet(clientSet kubernetes.Interface) (kubernetes KubernetesInterface, err error)

CreateFromClientSet kubernetes instance

type MockKubernetesInterface added in v0.1.0

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

MockKubernetesInterface is a mock of KubernetesInterface interface.

func NewMockKubernetesInterface added in v0.1.0

func NewMockKubernetesInterface(ctrl *gomock.Controller) *MockKubernetesInterface

NewMockKubernetesInterface creates a new mock instance.

func (*MockKubernetesInterface) AddEphemeralContainer added in v0.2.0

func (m *MockKubernetesInterface) AddEphemeralContainer(ctx context.Context, containerName, podName string, options *options.DaemonOptions, envs map[string]string) (string, error)

AddEphemeralContainer mocks base method.

func (*MockKubernetesInterface) ClusterCidrs added in v0.1.0

func (m *MockKubernetesInterface) ClusterCidrs(ctx context.Context, namespace string, connectOptions *options.ConnectOptions) ([]string, error)

ClusterCidrs mocks base method.

func (*MockKubernetesInterface) CreateConfigMapWithSshKey added in v0.2.3

func (m *MockKubernetesInterface) CreateConfigMapWithSshKey(ctx context.Context, labels map[string]string, sshcm, namespace string, generator *util.SSHGenerator) (*v10.ConfigMap, error)

CreateConfigMapWithSshKey mocks base method.

func (*MockKubernetesInterface) CreatePod added in v0.2.3

func (m *MockKubernetesInterface) CreatePod(ctx context.Context, metaAndSpec *PodMetaAndSpec, options *options.DaemonOptions) error

CreatePod mocks base method.

func (*MockKubernetesInterface) CreateService added in v0.1.0

func (m *MockKubernetesInterface) CreateService(ctx context.Context, metaAndSpec *SvcMetaAndSpec) (*v10.Service, error)

CreateService mocks base method.

func (*MockKubernetesInterface) CreateShadowPod added in v0.2.3

func (m *MockKubernetesInterface) CreateShadowPod(ctx context.Context, metaAndSpec *PodMetaAndSpec, sshcm string, options *options.DaemonOptions) error

CreateShadowPod mocks base method.

func (*MockKubernetesInterface) DecreaseRef added in v0.1.0

func (m *MockKubernetesInterface) DecreaseRef(ctx context.Context, name, namespace string) (bool, error)

DecreaseRef mocks base method.

func (*MockKubernetesInterface) EXPECT added in v0.1.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockKubernetesInterface) ExecInPod added in v0.2.3

func (m *MockKubernetesInterface) ExecInPod(containerName, podName, namespace string, opts options.RuntimeOptions, cmd ...string) (string, string, error)

ExecInPod mocks base method.

func (*MockKubernetesInterface) GetConfigMap added in v0.2.3

func (m *MockKubernetesInterface) GetConfigMap(ctx context.Context, name, namespace string) (*v10.ConfigMap, error)

GetConfigMap mocks base method.

func (*MockKubernetesInterface) GetDeployment added in v0.1.0

func (m *MockKubernetesInterface) GetDeployment(ctx context.Context, name, namespace string) (*v1.Deployment, error)

GetDeployment mocks base method.

func (*MockKubernetesInterface) GetPod added in v0.2.0

func (m *MockKubernetesInterface) GetPod(ctx context.Context, name, namespace string) (*v10.Pod, error)

GetPod mocks base method.

func (*MockKubernetesInterface) GetPods

func (m *MockKubernetesInterface) GetPods(ctx context.Context, labels map[string]string, namespace string) (*v10.PodList, error)

GetPods mocks base method.

func (*MockKubernetesInterface) GetService added in v0.2.3

func (m *MockKubernetesInterface) GetService(ctx context.Context, name, namespace string) (*v10.Service, error)

GetService mocks base method.

func (*MockKubernetesInterface) GetServiceHosts added in v0.2.3

func (m *MockKubernetesInterface) GetServiceHosts(ctx context.Context, namespace string) map[string]string

GetServiceHosts mocks base method.

func (*MockKubernetesInterface) GetServices added in v0.2.3

func (m *MockKubernetesInterface) GetServices(ctx context.Context, matchLabels map[string]string, namespace string) ([]v10.Service, error)

GetServices mocks base method.

func (*MockKubernetesInterface) IncreaseRef added in v0.2.3

func (m *MockKubernetesInterface) IncreaseRef(ctx context.Context, name, namespace string) error

IncreaseRef mocks base method.

func (*MockKubernetesInterface) RemoveConfigMap added in v0.1.0

func (m *MockKubernetesInterface) RemoveConfigMap(ctx context.Context, name, namespace string) error

RemoveConfigMap mocks base method.

func (*MockKubernetesInterface) RemoveEphemeralContainer added in v0.2.2

func (m *MockKubernetesInterface) RemoveEphemeralContainer(ctx context.Context, containerName, podName, namespace string) error

RemoveEphemeralContainer mocks base method.

func (*MockKubernetesInterface) RemovePod added in v0.2.0

func (m *MockKubernetesInterface) RemovePod(ctx context.Context, name, namespace string) error

RemovePod mocks base method.

func (*MockKubernetesInterface) RemoveService added in v0.1.0

func (m *MockKubernetesInterface) RemoveService(ctx context.Context, name, namespace string) error

RemoveService mocks base method.

func (*MockKubernetesInterface) ScaleTo added in v0.1.0

func (m *MockKubernetesInterface) ScaleTo(ctx context.Context, deployment, namespace string, replicas *int32) error

ScaleTo mocks base method.

func (*MockKubernetesInterface) UpdateDeployment added in v0.1.0

func (m *MockKubernetesInterface) UpdateDeployment(ctx context.Context, deployment *v1.Deployment) (*v1.Deployment, error)

UpdateDeployment mocks base method.

func (*MockKubernetesInterface) UpdatePod added in v0.2.0

func (m *MockKubernetesInterface) UpdatePod(ctx context.Context, pod *v10.Pod) (*v10.Pod, error)

UpdatePod mocks base method.

func (*MockKubernetesInterface) UpdateService added in v0.2.3

func (m *MockKubernetesInterface) UpdateService(ctx context.Context, svc *v10.Service) (*v10.Service, error)

UpdateService mocks base method.

func (*MockKubernetesInterface) WaitPodReady added in v0.2.3

func (m *MockKubernetesInterface) WaitPodReady(name, namespace string) (*v10.Pod, error)

WaitPodReady mocks base method.

type MockKubernetesInterfaceMockRecorder added in v0.1.0

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

MockKubernetesInterfaceMockRecorder is the mock recorder for MockKubernetesInterface.

func (*MockKubernetesInterfaceMockRecorder) AddEphemeralContainer added in v0.2.0

func (mr *MockKubernetesInterfaceMockRecorder) AddEphemeralContainer(ctx, containerName, podName, options, envs interface{}) *gomock.Call

AddEphemeralContainer indicates an expected call of AddEphemeralContainer.

func (*MockKubernetesInterfaceMockRecorder) ClusterCidrs added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) ClusterCidrs(ctx, namespace, connectOptions interface{}) *gomock.Call

ClusterCidrs indicates an expected call of ClusterCidrs.

func (*MockKubernetesInterfaceMockRecorder) CreateConfigMapWithSshKey added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) CreateConfigMapWithSshKey(ctx, labels, sshcm, namespace, generator interface{}) *gomock.Call

CreateConfigMapWithSshKey indicates an expected call of CreateConfigMapWithSshKey.

func (*MockKubernetesInterfaceMockRecorder) CreatePod added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) CreatePod(ctx, metaAndSpec, options interface{}) *gomock.Call

CreatePod indicates an expected call of CreatePod.

func (*MockKubernetesInterfaceMockRecorder) CreateService added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) CreateService(ctx, metaAndSpec interface{}) *gomock.Call

CreateService indicates an expected call of CreateService.

func (*MockKubernetesInterfaceMockRecorder) CreateShadowPod added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) CreateShadowPod(ctx, metaAndSpec, sshcm, options interface{}) *gomock.Call

CreateShadowPod indicates an expected call of CreateShadowPod.

func (*MockKubernetesInterfaceMockRecorder) DecreaseRef added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) DecreaseRef(ctx, name, namespace interface{}) *gomock.Call

DecreaseRef indicates an expected call of DecreaseRef.

func (*MockKubernetesInterfaceMockRecorder) ExecInPod added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) ExecInPod(containerName, podName, namespace, opts interface{}, cmd ...interface{}) *gomock.Call

ExecInPod indicates an expected call of ExecInPod.

func (*MockKubernetesInterfaceMockRecorder) GetConfigMap added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) GetConfigMap(ctx, name, namespace interface{}) *gomock.Call

GetConfigMap indicates an expected call of GetConfigMap.

func (*MockKubernetesInterfaceMockRecorder) GetDeployment added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) GetDeployment(ctx, name, namespace interface{}) *gomock.Call

GetDeployment indicates an expected call of GetDeployment.

func (*MockKubernetesInterfaceMockRecorder) GetPod added in v0.2.0

func (mr *MockKubernetesInterfaceMockRecorder) GetPod(ctx, name, namespace interface{}) *gomock.Call

GetPod indicates an expected call of GetPod.

func (*MockKubernetesInterfaceMockRecorder) GetPods

func (mr *MockKubernetesInterfaceMockRecorder) GetPods(ctx, labels, namespace interface{}) *gomock.Call

GetPods indicates an expected call of GetPods.

func (*MockKubernetesInterfaceMockRecorder) GetService added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) GetService(ctx, name, namespace interface{}) *gomock.Call

GetService indicates an expected call of GetService.

func (*MockKubernetesInterfaceMockRecorder) GetServiceHosts added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) GetServiceHosts(ctx, namespace interface{}) *gomock.Call

GetServiceHosts indicates an expected call of GetServiceHosts.

func (*MockKubernetesInterfaceMockRecorder) GetServices added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) GetServices(ctx, matchLabels, namespace interface{}) *gomock.Call

GetServices indicates an expected call of GetServices.

func (*MockKubernetesInterfaceMockRecorder) IncreaseRef added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) IncreaseRef(ctx, name, namespace interface{}) *gomock.Call

IncreaseRef indicates an expected call of IncreaseRef.

func (*MockKubernetesInterfaceMockRecorder) RemoveConfigMap added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) RemoveConfigMap(ctx, name, namespace interface{}) *gomock.Call

RemoveConfigMap indicates an expected call of RemoveConfigMap.

func (*MockKubernetesInterfaceMockRecorder) RemoveEphemeralContainer added in v0.2.2

func (mr *MockKubernetesInterfaceMockRecorder) RemoveEphemeralContainer(ctx, containerName, podName, namespace interface{}) *gomock.Call

RemoveEphemeralContainer indicates an expected call of RemoveEphemeralContainer.

func (*MockKubernetesInterfaceMockRecorder) RemovePod added in v0.2.0

func (mr *MockKubernetesInterfaceMockRecorder) RemovePod(ctx, name, namespace interface{}) *gomock.Call

RemovePod indicates an expected call of RemovePod.

func (*MockKubernetesInterfaceMockRecorder) RemoveService added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) RemoveService(ctx, name, namespace interface{}) *gomock.Call

RemoveService indicates an expected call of RemoveService.

func (*MockKubernetesInterfaceMockRecorder) ScaleTo added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) ScaleTo(ctx, deployment, namespace, replicas interface{}) *gomock.Call

ScaleTo indicates an expected call of ScaleTo.

func (*MockKubernetesInterfaceMockRecorder) UpdateDeployment added in v0.1.0

func (mr *MockKubernetesInterfaceMockRecorder) UpdateDeployment(ctx, deployment interface{}) *gomock.Call

UpdateDeployment indicates an expected call of UpdateDeployment.

func (*MockKubernetesInterfaceMockRecorder) UpdatePod added in v0.2.0

func (mr *MockKubernetesInterfaceMockRecorder) UpdatePod(ctx, pod interface{}) *gomock.Call

UpdatePod indicates an expected call of UpdatePod.

func (*MockKubernetesInterfaceMockRecorder) UpdateService added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) UpdateService(ctx, svc interface{}) *gomock.Call

UpdateService indicates an expected call of UpdateService.

func (*MockKubernetesInterfaceMockRecorder) WaitPodReady added in v0.2.3

func (mr *MockKubernetesInterfaceMockRecorder) WaitPodReady(name, namespace interface{}) *gomock.Call

WaitPodReady indicates an expected call of WaitPodReady.

type PodMetaAndSpec added in v0.1.0

type PodMetaAndSpec struct {
	Meta  *ResourceMeta
	Image string
	Envs  map[string]string
}

PodMetaAndSpec ...

type ResourceMeta added in v0.1.0

type ResourceMeta struct {
	Name        string
	Namespace   string
	Labels      map[string]string
	Annotations map[string]string
}

ResourceMeta ...

type SSHkeyMeta added in v0.1.0

type SSHkeyMeta struct {
	SshConfigMapName string
	PrivateKeyPath   string
}

SSHkeyMeta ...

type SvcMetaAndSpec added in v0.2.3

type SvcMetaAndSpec struct {
	Meta      *ResourceMeta
	External  bool
	Ports     map[int]int
	Selectors map[string]string
}

SvcMetaAndSpec ...

Jump to

Keyboard shortcuts

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