Documentation
¶
Index ¶
- Constants
- Variables
- type AppDescription
- type AppManager
- func (m *AppManager) AcquireExternalURL() string
- func (m *AppManager) AcquireExternalURLFromService(svc *apiv1.Service) string
- func (m *AppManager) App() AppDescription
- func (m *AppManager) CreateIngressService() (*apiv1.Service, error)
- func (m *AppManager) DeleteDeployment(ignoreNotFound bool) error
- func (m *AppManager) DeleteService(ignoreNotFound bool) error
- func (m *AppManager) Deploy() (*appsv1.Deployment, error)
- func (m *AppManager) Dispose(wait bool) error
- func (m *AppManager) DoPortForwarding(podName string, targetPorts ...int) ([]int, error)
- func (m *AppManager) GetCPUAndMemory(sidecar bool) (int64, float64, error)
- func (m *AppManager) GetHostDetails() ([]PodInfo, error)
- func (m *AppManager) GetOrCreateNamespace() (*apiv1.Namespace, error)
- func (m *AppManager) GetTotalRestarts() (int, error)
- func (m *AppManager) Init() error
- func (m *AppManager) IsDeploymentDeleted(deployment *appsv1.Deployment, err error) bool
- func (m *AppManager) IsDeploymentDone(deployment *appsv1.Deployment, err error) bool
- func (m *AppManager) IsServiceDeleted(svc *apiv1.Service, err error) bool
- func (m *AppManager) IsServiceIngressReady(svc *apiv1.Service, err error) bool
- func (m *AppManager) Name() string
- func (m *AppManager) SaveContainerLogs() error
- func (m *AppManager) ScaleDeploymentReplica(replicas int32) error
- func (m *AppManager) ValidiateSideCar() (bool, error)
- func (m *AppManager) WaitUntilDeploymentState(isState func(*appsv1.Deployment, error) bool) (*appsv1.Deployment, error)
- func (m *AppManager) WaitUntilServiceState(isState func(*apiv1.Service, error) bool) (*apiv1.Service, error)
- type ComponentDescription
- type DaprComponent
- type KubeClient
- func (c *KubeClient) DaprComponents(namespace string) componentsv1alpha1.ComponentInterface
- func (c *KubeClient) Deployments(namespace string) appv1.DeploymentInterface
- func (c *KubeClient) GetClientConfig() *rest.Config
- func (c *KubeClient) Namespaces() apiv1.NamespaceInterface
- func (c *KubeClient) Pods(namespace string) apiv1.PodInterface
- func (c *KubeClient) Services(namespace string) apiv1.ServiceInterface
- type PodInfo
- type PodPortForwarder
- type PortForwardRequest
Constants ¶
const ( // MiniKubeIPEnvVar is the environment variable name which will have Minikube node IP MiniKubeIPEnvVar = "DAPR_TEST_MINIKUBE_IP" // ContainerLogPathEnvVar is the environment variable name which will have the container logs ContainerLogPathEnvVar = "DAPR_CONTAINER_LOG_PATH" // ContainerLogDefaultPath ContainerLogDefaultPath = "./container_logs" // 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 )
const ( // 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 // DaprComponentsKind is component kind DaprComponentsKind = "components.dapr.io" // DaprTestNamespaceEnvVar is the environment variable for setting the Kubernetes namespace for e2e tests DaprTestNamespaceEnvVar = "DAPR_TEST_NAMESPACE" // Environment variable for setting Kubernetes node affinity OS TargetOsEnvVar = "TARGET_OS" // Environment variable for setting Kubernetes node affinity ARCH TargetArchEnvVar = "TARGET_ARCH" )
Variables ¶
var ( // DaprTestNamespace is the default Kubernetes namespace for e2e tests DaprTestNamespace = "dapr-tests" // TargetOs is default os affinity for Kubernetes nodes TargetOs = "linux" // TargetArch is the default architecture affinity for Kubernetes nodes TargetArch = "amd64" )
Functions ¶
This section is empty.
Types ¶
type AppDescription ¶
type AppDescription struct { AppName string AppPort int AppProtocol string DaprEnabled bool ImageName string RegistryName string Replicas int32 IngressEnabled bool MetricsPort string Config string AppCPULimit string AppCPURequest string AppMemoryLimit string AppMemoryRequest string DaprCPULimit string DaprCPURequest string DaprMemoryLimit string DaprMemoryRequest string Namespace *string }
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) App ¶ added in v0.3.0
func (m *AppManager) App() AppDescription
App returns app description
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(wait bool) error
Dispose deletes deployment and service
func (*AppManager) DoPortForwarding ¶ added in v0.4.0
func (m *AppManager) DoPortForwarding(podName string, targetPorts ...int) ([]int, error)
DoPortForwarding performs port forwarding for given podname to access test apps in the cluster
func (*AppManager) GetCPUAndMemory ¶ added in v1.0.0
func (m *AppManager) GetCPUAndMemory(sidecar bool) (int64, float64, error)
GetCPUAndMemory returns the Cpu and Memory usage for the dapr app or sidecar
func (*AppManager) GetHostDetails ¶ added in v0.8.0
func (m *AppManager) GetHostDetails() ([]PodInfo, error)
GetHostDetails returns the name and IP address of the pods running the app
func (*AppManager) GetOrCreateNamespace ¶
func (m *AppManager) GetOrCreateNamespace() (*apiv1.Namespace, error)
GetOrCreateNamespace gets or creates namespace unless namespace exists
func (*AppManager) GetTotalRestarts ¶ added in v1.0.0
func (m *AppManager) GetTotalRestarts() (int, error)
GetTotalRestarts returns the total number of restarts for the app or sidecar
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) SaveContainerLogs ¶ added in v1.0.0
func (m *AppManager) SaveContainerLogs() error
SaveContainerLogs get container logs for all containers in the pod and saves them to disk
func (*AppManager) ScaleDeploymentReplica ¶ added in v0.3.0
func (m *AppManager) ScaleDeploymentReplica(replicas int32) error
ScaleDeploymentReplica scales the deployment
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 ComponentDescription ¶ added in v0.3.0
type ComponentDescription struct { // Name is the name of dapr component Name string // Namespace to deploy the component to Namespace *string // Type contains component types (<type>.<component_name>) TypeName string // MetaData contains the metadata for dapr component MetaData map[string]string }
ComponentDescription holds dapr component description
type DaprComponent ¶ added in v0.3.0
type DaprComponent struct {
// contains filtered or unexported fields
}
DaprComponent holds kubernetes client and component information
func NewDaprComponent ¶ added in v0.3.0
func NewDaprComponent(client *KubeClient, ns string, comp ComponentDescription) *DaprComponent
NewDaprComponent creates DaprComponent instance
func (*DaprComponent) Dispose ¶ added in v0.3.0
func (do *DaprComponent) Dispose(wait bool) error
func (*DaprComponent) Init ¶ added in v0.3.0
func (do *DaprComponent) Init() error
func (*DaprComponent) Name ¶ added in v0.3.0
func (do *DaprComponent) Name() string
type KubeClient ¶
type KubeClient struct { ClientSet kubernetes.Interface MetricsClient metrics.Interface DaprClientSet daprclient.Interface // contains filtered or unexported fields }
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) DaprComponents ¶ added in v0.3.0
func (c *KubeClient) DaprComponents(namespace string) componentsv1alpha1.ComponentInterface
DaprComponents gets Dapr component client for namespace
func (*KubeClient) Deployments ¶
func (c *KubeClient) Deployments(namespace string) appv1.DeploymentInterface
Deployments gets Deployment client for namespace
func (*KubeClient) GetClientConfig ¶ added in v0.4.0
func (c *KubeClient) GetClientConfig() *rest.Config
GetClientConfig returns client configuration
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
type PodPortForwarder ¶ added in v0.8.0
type PodPortForwarder struct {
// contains filtered or unexported fields
}
PodPortFowarder implements the PortForwarder interface for Kubernetes
func NewPodPortForwarder ¶ added in v0.8.0
func NewPodPortForwarder(c *KubeClient, namespace string) *PodPortForwarder
NewPodPortForwarder returns a new PodPortForwarder
func (*PodPortForwarder) Close ¶ added in v0.8.0
func (p *PodPortForwarder) Close() error
type PortForwardRequest ¶ added in v0.4.0
type PortForwardRequest struct {
// contains filtered or unexported fields
}
PortForwardRequest encapsulates data required to establish a Kuberentes tunnel