resources

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package resources implements Kubernetes resources utilities. Used for CSI EBS driver testing.

Index

Constants

View Source
const (
	PromDeploymentName = "prometheus"
	PromServiceName    = "prometheus"
	PromImage          = "prom/prometheus:v2.1.0"
)

Variables

This section is empty.

Functions

func NewPromAPI

func NewPromAPI(f *framework.Framework, ns *corev1.Namespace) (promv1.API, error)

NewPromAPI creates a new Prometheus API

Types

type PatchSpec

type PatchSpec struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value int32  `json:"value"`
}

PatchSpec is for Kubernetes patching

type Prom

type Prom struct {
	API promv1.API
}

Prom holds the created prom v1 API and the time the test runs

func (*Prom) Query

func (p *Prom) Query(query string, testTime time.Time) (model.SampleValue, error)

Query returns the value for the Prometheus query

func (*Prom) QueryPercent

func (p *Prom) QueryPercent(requests string, failures string, testTime time.Time) (model.SampleValue, error)

QueryPercent returns the percentage value for a Prometheus query

type Resources

type Resources struct {
	Daemonset  *appsv1.DaemonSet
	Deployment *appsv1.Deployment
	Services   []*corev1.Service
}

Resources is a grouping of Kubernetes resources

func NewNginxResources

func NewNginxResources(ns, serviceAccountName, nodeName string, replicas int32) *Resources

NewNginxResources creates new Kubernetes nginx resources and takes in a namespace, the node name to run on, and replica count

func NewPromResources

func NewPromResources(ns, serviceAccountName, nodeName string, replicas int32) *Resources

NewPromResources creates new prometheus Kubernetes resources and takes in a namespace, the node name to run on, and replica count

func NewTestpodResources

func NewTestpodResources(ns, serviceAccountName, nodeName string, replicas int32) *Resources

NewTestpodResources creates new Kubernetes resources with image exported as env TESTPOD_IMAGE_URI. Build the image at https://github.com/aws/amazon-vpc-cni-k8s/ with `make build-docker-testpod`

func (*Resources) ExpectCleanupSuccessful

func (r *Resources) ExpectCleanupSuccessful(ctx context.Context, f *framework.Framework, ns *corev1.Namespace)

ExpectCleanupSuccessful expects cleaning up services and deployments to be successful

func (*Resources) ExpectDaemonsetUpdateSuccessful

func (r *Resources) ExpectDaemonsetUpdateSuccessful(ctx context.Context, f *framework.Framework, ns *corev1.Namespace)

ExpectDaemonsetUpdateSuccessful expects updating a daemonset to be successful

func (*Resources) ExpectDeploySuccessful

func (r *Resources) ExpectDeploySuccessful(ctx context.Context, f *framework.Framework, timeout time.Duration, ns *corev1.Namespace)

ExpectDeploySuccessful expects a deployment and any services to be successful

func (*Resources) ExpectDeploymentScaleSuccessful

func (r *Resources) ExpectDeploymentScaleSuccessful(ctx context.Context, f *framework.Framework, timeout time.Duration, ns *corev1.Namespace, replicas int32)

ExpectDeploymentScaleSuccessful expects a deployment to scale successfully

func (*Resources) ExpectServicesSuccessful

func (r *Resources) ExpectServicesSuccessful(ctx context.Context, f *framework.Framework, ns *corev1.Namespace, replicas int)

ExpectServicesSuccessful expects service creation to be successful

Jump to

Keyboard shortcuts

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