kubernetes: github.com/itorres/kubernetes/test/e2e Index | Files | Directories

package e2e

import "github.com/itorres/kubernetes/test/e2e"

This is a utility for prometheus pushing functionality.


Package Files

addon_update.go autoscaling_utils.go cadvisor.go cluster_size_autoscaling.go cluster_upgrade.go container_probe.go core.go daemon_restart.go daemon_set.go density.go deployment.go dns.go docker_containers.go downward_api.go downwardapi_volume.go empty_dir.go es_cluster_logging.go etcd_failure.go events.go example_cluster_dns.go example_k8petstore.go examples.go expansion.go framework.go garbage_collector.go google_compute.go horizontal_pod_autoscaling.go host_path.go ingress.go initial_resources.go job.go kibana_logging.go kube-ui.go kubectl.go kubelet.go kubelet_etc_hosts.go kubelet_perf.go kubelet_stats.go kubeproxy.go latency.go load.go log_size_monitoring.go mesos.go metrics_util.go monitor_resources.go monitoring.go namespace.go networking.go nodeoutofdisk.go pd.go persistent_volumes.go pods.go portforward.go pre_stop.go privileged.go prompush.go proxy.go rc.go reboot.go resize_nodes.go resource_usage_gatherer.go restart.go scheduler_predicates.go secrets.go security_context.go service.go service_accounts.go service_latency.go serviceloadbalancers.go ssh.go util.go volumes.go


const (
    ADD    = "ADD"
    DEL    = "DEL"
const NodeStartupThreshold = 4 * time.Second

NodeStartupThreshold is a rough estimate of the time allocated for a pod to start on a node.


var InterestingApiServerMetrics = sets.NewString(
var InterestingKubeletMetrics = sets.NewString(
var MaxContainerFailures = 0

Maximum container failures this test tolerates before failing.

var ServiceNodePortRange = util.PortRange{Base: 30000, Size: 2768}

This should match whatever the default/configured range is

func BadEvents Uses

func BadEvents(events []*api.Event) int

Prints the histogram of the events and returns the number of bad events.

func CheckCadvisorHealthOnAllNodes Uses

func CheckCadvisorHealthOnAllNodes(c *client.Client, timeout time.Duration)

func ClusterLevelLoggingWithElasticsearch Uses

func ClusterLevelLoggingWithElasticsearch(f *Framework)

ClusterLevelLoggingWithElasticsearch is an end to end test for cluster level logging.

func ClusterLevelLoggingWithKibana Uses

func ClusterLevelLoggingWithKibana(f *Framework)

ClusterLevelLoggingWithKibana is an end to end test that checks to see if Kibana is alive.

func CoreDump Uses

func CoreDump(dir string)

func DeleteRC Uses

func DeleteRC(c *client.Client, ns, name string) error

Delete a Replication Controller and all pods it spawned

func FailedContainers Uses

func FailedContainers(pod *api.Pod) map[string]ContainerFailures

FailedContainers inspects all containers in a pod and returns failure information for containers that have failed or been restarted. A map is returned where the key is the containerID and the value is a struct containing the restart and failure information

func Failf Uses

func Failf(format string, a ...interface{})

func GetKubeletPods Uses

func GetKubeletPods(c *client.Client, node string) (*api.PodList, error)

GetKubeletPods retrieves the list of running pods on the kubelet. The pods includes necessary information (e.g., UID, name, namespace for pods/containers), but do not contain the full spec.

func HighLatencyKubeletOperations Uses

func HighLatencyKubeletOperations(c *client.Client, threshold time.Duration, nodeName string) ([]KubeletMetric, error)

HighLatencyKubeletOperations logs and counts the high latency metrics exported by the kubelet server via /metrics.

func HighLatencyRequests Uses

func HighLatencyRequests(c *client.Client) (int, error)

Prints top five summary metrics for request types with latency and returns number of such request types above threshold.

func LaunchHostExecPod Uses

func LaunchHostExecPod(client *client.Client, ns, name string) *api.Pod

LaunchHostExecPod launches a hostexec pod in the given namespace and waits until it's Running

func LaunchNetTestPodPerNode Uses

func LaunchNetTestPodPerNode(f *Framework, nodes *api.NodeList, name, version string) []string

func ListSchedulableNodesOrDie Uses

func ListSchedulableNodesOrDie(c *client.Client) *api.NodeList

Convenient wrapper around listing nodes supporting retries.

func LogSSHResult Uses

func LogSSHResult(result SSHResult)

func Logf Uses

func Logf(format string, a ...interface{})

func NewHostExecPodSpec Uses

func NewHostExecPodSpec(ns, name string) *api.Pod

NewHostExecPodSpec returns the pod spec of hostexec pod

func NewRestartConfig Uses

func NewRestartConfig(nodeName, daemonName string, healthzPort int, pollInterval, pollTimeout time.Duration) *restartDaemonConfig

NewRestartConfig creates a restartDaemonConfig for the given node and daemon.

func NodeAddresses Uses

func NodeAddresses(nodelist *api.NodeList, addrType api.NodeAddressType) []string

NodeAddresses returns the first address of the given type of each node.

func NodeSSHHosts Uses

func NodeSSHHosts(c *client.Client) ([]string, error)

NodeSSHHosts returns SSH-able host names for all nodes. It returns an error if it can't find an external IP for every node, though it still returns all hosts that it found in that case.

func OpenWebSocketForURL Uses

func OpenWebSocketForURL(url *url.URL, config *client.Config, protocols []string) (*websocket.Conn, error)

OpenWebSocketForURL constructs a websocket connection to the provided URL, using the client config, with the specified protocols.

func ParseKubeletMetrics Uses

func ParseKubeletMetrics(metricsBlob string) ([]KubeletMetric, error)

ParseKubeletMetrics reads metrics from the kubelet server running on the given node

func ReserveCpu Uses

func ReserveCpu(f *Framework, id string, millicores int)

func ReserveMemory Uses

func ReserveMemory(f *Framework, id string, megabytes int)

func RunDeployment Uses

func RunDeployment(config DeploymentConfig) error

RunDeployment Launches (and verifies correctness) of a Deployment and will wait for all pods it spawns to become "Running". It's the caller's responsibility to clean up externally (i.e. use the namespace lifecycle for handling cleanup).

func RunHostCmd Uses

func RunHostCmd(ns, name, cmd string) (string, error)

RunHostCmd runs the given cmd in the context of the given pod using `kubectl exec` inside of a shell.

func RunHostCmdOrDie Uses

func RunHostCmdOrDie(ns, name, cmd string) string

RunHostCmdOrDie calls RunHostCmd and dies on error.

func RunRC Uses

func RunRC(config RCConfig) error

RunRC Launches (and verifies correctness) of a Replication Controller and will wait for all pods it spawns to become "Running". It's the caller's responsibility to clean up externally (i.e. use the namespace lifecycle for handling cleanup).

func ScaleRC Uses

func ScaleRC(c *client.Client, ns, name string, size uint, wait bool) error

func ServeImageOrFail Uses

func ServeImageOrFail(f *Framework, test string, image string)

A basic test to check the deployment of an image using a replication controller. The image serves its hostname which is checked for each replica.

func SetTestContext Uses

func SetTestContext(t TestContextType)

func SkipIfProviderIs Uses

func SkipIfProviderIs(unsupportedProviders ...string)

func SkipUnlessNodeCountIsAtLeast Uses

func SkipUnlessNodeCountIsAtLeast(minNodeCount int)

func SkipUnlessProviderIs Uses

func SkipUnlessProviderIs(supportedProviders ...string)

func Skipf Uses

func Skipf(format string, args ...interface{})

func VerifyPodStartupLatency Uses

func VerifyPodStartupLatency(latency PodStartupLatency) error

Verifies whether 50, 90 and 99th percentiles of PodStartupLatency are within the threshold.

func VerifySchedulerLatency Uses

func VerifySchedulerLatency(c *client.Client) error

Verifies (currently just by logging them) the scheduling latencies.

type APICall Uses

type APICall struct {
    Resource string        `json:"resource"`
    Verb     string        `json:"verb"`
    Latency  LatencyMetric `json:"latency"`

type APIResponsiveness Uses

type APIResponsiveness struct {
    APICalls []APICall `json:"apicalls"`

func (APIResponsiveness) Len Uses

func (a APIResponsiveness) Len() int

func (APIResponsiveness) Less Uses

func (a APIResponsiveness) Less(i, j int) bool

func (APIResponsiveness) Swap Uses

func (a APIResponsiveness) Swap(i, j int)

type CloudConfig Uses

type CloudConfig struct {
    ProjectID         string
    Zone              string
    Cluster           string
    MasterName        string
    NodeInstanceGroup string
    NumNodes          int
    ClusterTag        string
    ServiceAccount    string

    Provider cloudprovider.Interface

type ContainerFailures Uses

type ContainerFailures struct {
    // contains filtered or unexported fields

type DeploymentConfig Uses

type DeploymentConfig struct {

type Framework Uses

type Framework struct {
    BaseName string

    Namespace                *api.Namespace
    Client                   *client.Client
    NamespaceDeletionTimeout time.Duration
    // contains filtered or unexported fields

Framework supports common operations used by e2e tests; it will keep a client & a namespace for you. Eventual goal is to merge this with integration test framework.

func NewFramework Uses

func NewFramework(baseName string) *Framework

NewFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).

func (*Framework) ReadFileViaContainer Uses

func (f *Framework) ReadFileViaContainer(podName, containerName string, path string) (string, error)

Read a file using kubectl exec cat <path>

func (*Framework) TestContainerOutput Uses

func (f *Framework) TestContainerOutput(scenarioName string, pod *api.Pod, containerIndex int, expectedOutput []string)

Runs the given pod and verifies that the output of exact container matches the desired output.

func (*Framework) TestContainerOutputRegexp Uses

func (f *Framework) TestContainerOutputRegexp(scenarioName string, pod *api.Pod, containerIndex int, expectedOutput []string)

Runs the given pod and verifies that the output of exact container matches the desired regexps.

func (*Framework) WaitForAnEndpoint Uses

func (f *Framework) WaitForAnEndpoint(serviceName string) error

WaitForAnEndpoint waits for at least one endpoint to become available in the service's corresponding endpoints object.

func (*Framework) WaitForPodRunning Uses

func (f *Framework) WaitForPodRunning(podName string) error

WaitForPodRunning waits for the pod to run in the namespace.

func (*Framework) WaitForPodRunningSlow Uses

func (f *Framework) WaitForPodRunningSlow(podName string) error

WaitForPodRunningSlow waits for the pod to run in the namespace. It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).

func (*Framework) WriteFileViaContainer Uses

func (f *Framework) WriteFileViaContainer(podName, containerName string, path string, contents string) error

Write a file using kubectl exec echo <contents> > <path> via specified container Because of the primitive technique we're using here, we only allow ASCII alphanumeric characters

type HPAScaleTest Uses

type HPAScaleTest struct {
    // contains filtered or unexported fields

HPAScaleTest struct is used by the scale(...) function.

type IngressController Uses

type IngressController struct {
    UID     string
    Project string
    // contains filtered or unexported fields

func (*IngressController) Cleanup Uses

func (cont *IngressController) Cleanup(del bool) error

type KubeProxyTestConfig Uses

type KubeProxyTestConfig struct {
    // contains filtered or unexported fields

type KubeletManagedHostConfig Uses

type KubeletManagedHostConfig struct {
    // contains filtered or unexported fields

type KubeletMetric Uses

type KubeletMetric struct {
    // eg: list, info, create
    Operation string
    // eg: sync_pods, pod_worker
    Method string
    // 0 <= quantile <=1, e.g. 0.95 is 95%tile, 0.5 is median.
    Quantile float64
    Latency  time.Duration

KubeletMetric stores metrics scraped from the kubelet server's /metric endpoint. TODO: Get some more structure around the metrics and this type

type KubeletMetricByLatency Uses

type KubeletMetricByLatency []KubeletMetric

KubeletMetricByLatency implements sort.Interface for []KubeletMetric based on the latency field.

func (KubeletMetricByLatency) Len Uses

func (a KubeletMetricByLatency) Len() int

func (KubeletMetricByLatency) Less Uses

func (a KubeletMetricByLatency) Less(i, j int) bool

func (KubeletMetricByLatency) Swap Uses

func (a KubeletMetricByLatency) Swap(i, j int)

type LBCTester Uses

type LBCTester interface {
    // contains filtered or unexported methods

LBCTester is an interface used to test loadbalancer controllers.

type LatencyMetric Uses

type LatencyMetric struct {
    Perc50 time.Duration `json:"Perc50"`
    Perc90 time.Duration `json:"Perc90"`
    Perc99 time.Duration `json:"Perc99"`

Dashboard metrics

type LogSizeGatherer Uses

type LogSizeGatherer struct {
    // contains filtered or unexported fields

LogSizeGatherer is a worker which grabs a WorkItem from the channel and does assigned work.

func (*LogSizeGatherer) Run Uses

func (g *LogSizeGatherer) Run()

func (*LogSizeGatherer) Work Uses

func (g *LogSizeGatherer) Work() bool

Work does a single unit of work: tries to take out a WorkItem from the queue, ssh-es into a given machine, gathers data, writes it to the shared <data> map, and creates a gorouting which reinserts work item into the queue with a <pollingPeriod> delay. Returns false if worker should exit.

type LogsSizeData Uses

type LogsSizeData struct {
    // contains filtered or unexported fields

func (*LogsSizeData) AddNewData Uses

func (d *LogsSizeData) AddNewData(ip, path string, timestamp time.Time, size int)

type LogsSizeDataSummary Uses

type LogsSizeDataSummary map[string]map[string][]TimestampedSize

node -> file -> data

func (*LogsSizeDataSummary) PrintHumanReadable Uses

func (s *LogsSizeDataSummary) PrintHumanReadable() string

TODO: make sure that we don't need locking here

func (*LogsSizeDataSummary) PrintJSON Uses

func (s *LogsSizeDataSummary) PrintJSON() string

type LogsSizeVerifier Uses

type LogsSizeVerifier struct {
    // contains filtered or unexported fields

LogsSizeVerifier gathers data about log files sizes from master and node machines. It oversees a <workersNo> workers which do the gathering.

func NewLogsVerifier Uses

func NewLogsVerifier(c *client.Client, stopChannel chan bool) *LogsSizeVerifier

NewLogsVerifier creates a new LogsSizeVerifier which will stop when stopChannel is closed

func (*LogsSizeVerifier) GetSummary Uses

func (v *LogsSizeVerifier) GetSummary() *LogsSizeDataSummary

PrintData returns a string with formated results

func (*LogsSizeVerifier) Run Uses

func (v *LogsSizeVerifier) Run()

Run starts log size gathering. It starts a gorouting for every worker and then blocks until stopChannel is closed

type PodDiff Uses

type PodDiff map[string]*podInfo

PodDiff is a map of pod name to podInfos

func Diff Uses

func Diff(oldPods []*api.Pod, curPods []*api.Pod) PodDiff

Diff computes a PodDiff given 2 lists of pods.

func (PodDiff) Print Uses

func (p PodDiff) Print(ignorePhases sets.String)

Print formats and prints the give PodDiff.

type PodStartupLatency Uses

type PodStartupLatency struct {
    Latency LatencyMetric `json:"latency"`

type PortsByPodName Uses

type PortsByPodName map[string][]int

type PortsByPodUID Uses

type PortsByPodUID map[types.UID][]int

type PrivilegedPodTestConfig Uses

type PrivilegedPodTestConfig struct {
    // contains filtered or unexported fields

type RCConfig Uses

type RCConfig struct {
    Client        *client.Client
    Image         string
    Command       []string
    Name          string
    Namespace     string
    PollInterval  time.Duration
    Timeout       time.Duration
    PodStatusFile *os.File
    Replicas      int
    CpuRequest    int64 // millicores
    CpuLimit      int64 // millicores
    MemRequest    int64 // bytes
    MemLimit      int64 // bytes

    // Env vars, set the same for every pod.
    Env map[string]string

    // Extra labels added to every pod.
    Labels map[string]string

    // Ports to declare in the container (map of name to containerPort).
    Ports map[string]int

    // Pointer to a list of pods; if non-nil, will be set to a list of pods
    // created by this RC by RunRC.
    CreatedPods *[]*api.Pod

    // Maximum allowable container failures. If exceeded, RunRC returns an error.
    // Defaults to replicas*0.1 if unspecified.
    MaxContainerFailures *int

type ResourceConsumer Uses

type ResourceConsumer struct {
    // contains filtered or unexported fields

ResourceConsumer is a tool for testing. It helps create specified usage of CPU or memory (Warning: memory not supported) typical use case: rc.ConsumeCPU(600) // ... check your assumption here rc.ConsumeCPU(300) // ... check your assumption here

func NewDynamicResourceConsumer Uses

func NewDynamicResourceConsumer(name, kind string, replicas, initCPUTotal, initMemoryTotal int, cpuLimit, memLimit int64, framework *Framework) *ResourceConsumer

func NewStaticResourceConsumer Uses

func NewStaticResourceConsumer(name string, replicas, initCPUTotal, initMemoryTotal int, cpuLimit, memLimit int64, framework *Framework) *ResourceConsumer

TODO this still defaults to replication controller

func (*ResourceConsumer) CleanUp Uses

func (rc *ResourceConsumer) CleanUp()

func (*ResourceConsumer) ConsumeCPU Uses

func (rc *ResourceConsumer) ConsumeCPU(millicores int)

ConsumeCPU consumes given number of CPU

func (*ResourceConsumer) ConsumeMem Uses

func (rc *ResourceConsumer) ConsumeMem(megabytes int)

ConsumeMem consumes given number of Mem

func (*ResourceConsumer) EnsureDesiredReplicas Uses

func (rc *ResourceConsumer) EnsureDesiredReplicas(desiredReplicas int, timeout time.Duration)

func (*ResourceConsumer) GetReplicas Uses

func (rc *ResourceConsumer) GetReplicas() int

func (*ResourceConsumer) WaitForReplicas Uses

func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int)

type ResourceUsageSummary Uses

type ResourceUsageSummary map[int][]singleContainerSummary

func (*ResourceUsageSummary) PrintHumanReadable Uses

func (s *ResourceUsageSummary) PrintHumanReadable() string

func (*ResourceUsageSummary) PrintJSON Uses

func (s *ResourceUsageSummary) PrintJSON() string

type SSHResult Uses

type SSHResult struct {
    User   string
    Host   string
    Cmd    string
    Stdout string
    Stderr string
    Code   int

func SSH Uses

func SSH(cmd, host, provider string) (SSHResult, error)

SSH synchronously SSHs to a node running on provider and runs cmd. If there is no error performing the SSH, the stdout, stderr, and exit code are returned.

type SchedulingLatency Uses

type SchedulingLatency struct {
    Scheduling LatencyMetric `json:"scheduling:`
    Binding    LatencyMetric `json:"binding"`
    Total      LatencyMetric `json:"total"`

type State Uses

type State struct {
    Received map[string]int

partially cloned from webserver.go

type TestContextType Uses

type TestContextType struct {
    KubeConfig  string
    KubeContext string
    CertDir     string
    Host        string
    RepoRoot    string
    Provider    string
    CloudConfig CloudConfig
    KubectlPath string
    OutputDir   string

    MinStartupPods        int
    UpgradeTarget         string
    PrometheusPushGateway string
    VerifyServiceAccount  bool
    DeleteNamespace       bool
    CleanStart            bool
    // If set to true framework will start a goroutine monitoring resource usage of system add-ons.
    // It will read the data every 30 seconds from all Nodes and print summary during afterEach.
    GatherKubeSystemResourceUsageData bool
    GatherLogsSizes                   bool
    GatherMetricsAfterTest            bool
    // Currently supported values are 'hr' for human-readable and 'json'. It's a comma separated list.
    OutputPrintType string
    // contains filtered or unexported fields

type TestDataSummary Uses

type TestDataSummary interface {
    PrintHumanReadable() string
    PrintJSON() string

type TimestampedSize Uses

type TimestampedSize struct {
    // contains filtered or unexported fields

TimestampedSize contains a size together with a time of measurement.

type VolumeTestConfig Uses

type VolumeTestConfig struct {
    // contains filtered or unexported fields

Configuration of one tests. The test consist of: - server pod - runs serverImage, exports ports[] - client pod - does not need any special configuration

type WebserverTest Uses

type WebserverTest struct {
    ServiceName string
    Namespace   string
    Client      *client.Client

    TestId string
    Labels map[string]string
    // contains filtered or unexported fields

Simple helper class to avoid too much boilerplate in tests

func NewWebserverTest Uses

func NewWebserverTest(client *client.Client, namespace string, serviceName string) *WebserverTest

func (*WebserverTest) BuildServiceSpec Uses

func (t *WebserverTest) BuildServiceSpec() *api.Service

Build default config for a service (which can then be changed)

func (*WebserverTest) Cleanup Uses

func (t *WebserverTest) Cleanup() []error

func (*WebserverTest) CreateService Uses

func (t *WebserverTest) CreateService(service *api.Service) (*api.Service, error)

Create a service, and record it for cleanup

func (*WebserverTest) CreateWebserverRC Uses

func (t *WebserverTest) CreateWebserverRC(replicas int) *api.ReplicationController

CreateWebserverRC creates rc-backed pods with the well-known webserver configuration and records it for cleanup.

func (*WebserverTest) DeleteService Uses

func (t *WebserverTest) DeleteService(serviceName string) error

Delete a service, and remove it from the cleanup list

type WorkItem Uses

type WorkItem struct {
    // contains filtered or unexported fields

WorkItem is a command for a worker that contains an IP of machine from which we want to gather data and paths to all files we're interested in.



Package e2e imports 77 packages (graph). Updated 2018-01-01. Refresh now. Tools for package owners.