kubernetes

package
v0.2.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MiniKubeIPEnvVar is the environment variable name which will have Minikube node IP
	MiniKubeIPEnvVar = "DAPR_TEST_MINIKUBE_IP"

	// PollInterval is how frequently e2e tests will poll for updates.
	PollInterval = 1 * time.Second
	// PollTimeout is how long e2e tests will wait for resource updates when polling.
	PollTimeout = 10 * time.Minute
)
View Source
const (
	// DaprTestKubeNameSpace is the default Kubernetes namespace for e2e test
	DaprTestKubeNameSpace = "dapr-tests"

	// TestAppLabelKey is the label key for Kubernetes label selector
	TestAppLabelKey = "testapp"
	// DaprSideCarName is the Pod name of Dapr side car
	DaprSideCarName = "daprd"

	// DefaultContainerPort is the default container port exposed from test app
	DefaultContainerPort = 3000
	// DefaultExternalPort is the default external port exposed by load balancer ingress
	DefaultExternalPort = 3000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppDescription

type AppDescription struct {
	AppName        string
	DaprEnabled    bool
	ImageName      string
	RegistryName   string
	Replicas       int32
	IngressEnabled bool
}

AppDescription holds the deployment information of test app

type AppManager

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

AppManager holds Kubernetes clients and namespace used for test apps and provides the helpers to manage the test apps

func NewAppManager

func NewAppManager(kubeClients *KubeClient, namespace string, app AppDescription) *AppManager

NewAppManager creates AppManager instance

func (*AppManager) AcquireExternalURL

func (m *AppManager) AcquireExternalURL() string

AcquireExternalURL gets external ingress endpoint from service when it is ready

func (*AppManager) AcquireExternalURLFromService

func (m *AppManager) AcquireExternalURLFromService(svc *apiv1.Service) string

AcquireExternalURLFromService gets external url from Service Object.

func (*AppManager) CreateIngressService

func (m *AppManager) CreateIngressService() (*apiv1.Service, error)

CreateIngressService creates Ingress endpoint for test app

func (*AppManager) DeleteDeployment

func (m *AppManager) DeleteDeployment(ignoreNotFound bool) error

DeleteDeployment deletes deployment for the test app

func (*AppManager) DeleteService

func (m *AppManager) DeleteService(ignoreNotFound bool) error

DeleteService deletes deployment for the test app

func (*AppManager) Deploy

func (m *AppManager) Deploy() (*appsv1.Deployment, error)

Deploy deploys app based on app description

func (*AppManager) Dispose

func (m *AppManager) Dispose() error

Dispose deletes deployment and service

func (*AppManager) GetOrCreateNamespace

func (m *AppManager) GetOrCreateNamespace() (*apiv1.Namespace, error)

GetOrCreateNamespace gets or creates namespace unless namespace exists

func (*AppManager) Init

func (m *AppManager) Init() error

Init installs app by AppDescription

func (*AppManager) IsDeploymentDeleted

func (m *AppManager) IsDeploymentDeleted(deployment *appsv1.Deployment, err error) bool

IsDeploymentDeleted returns true if deployment does not exist or current pod replica is zero

func (*AppManager) IsDeploymentDone

func (m *AppManager) IsDeploymentDone(deployment *appsv1.Deployment, err error) bool

IsDeploymentDone returns true if deployment object completes pod deployments

func (*AppManager) IsServiceDeleted

func (m *AppManager) IsServiceDeleted(svc *apiv1.Service, err error) bool

IsServiceDeleted returns true if service does not exist

func (*AppManager) IsServiceIngressReady

func (m *AppManager) IsServiceIngressReady(svc *apiv1.Service, err error) bool

IsServiceIngressReady returns true if external ip is available

func (*AppManager) Name

func (m *AppManager) Name() string

Name returns app name

func (*AppManager) ValidiateSideCar

func (m *AppManager) ValidiateSideCar() (bool, error)

ValidiateSideCar validates that dapr side car is running in dapr enabled pods

func (*AppManager) WaitUntilDeploymentState

func (m *AppManager) WaitUntilDeploymentState(isState func(*appsv1.Deployment, error) bool) (*appsv1.Deployment, error)

WaitUntilDeploymentState waits until isState returns true

func (*AppManager) WaitUntilServiceState

func (m *AppManager) WaitUntilServiceState(isState func(*apiv1.Service, error) bool) (*apiv1.Service, error)

WaitUntilServiceState waits until isState returns true

type KubeClient

type KubeClient struct {
	ClientSet kubernetes.Interface
}

KubeClient holds instances of Kubernetes clientset TODO: Add cluster management methods to clean up the old test apps

func NewKubeClient

func NewKubeClient(configPath string, clusterName string) (*KubeClient, error)

NewKubeClient creates KubeClient instance

func (*KubeClient) Deployments

func (c *KubeClient) Deployments(namespace string) appv1.DeploymentInterface

Deployments gets Deployment client for namespace

func (*KubeClient) Namespaces

func (c *KubeClient) Namespaces() apiv1.NamespaceInterface

Namespaces gets Namespace client

func (*KubeClient) Pods

func (c *KubeClient) Pods(namespace string) apiv1.PodInterface

Pods gets Pod client for namespace

func (*KubeClient) Services

func (c *KubeClient) Services(namespace string) apiv1.ServiceInterface

Services gets Service client for namespace

Jump to

Keyboard shortcuts

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