framework

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2018 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Timeout used in benchmarks, to eg: scale an rc
	DefaultTimeout = 30 * time.Minute

	// Rc manifest used to create pods for benchmarks.
	// TODO: Convert this to a full path?
	TestRCManifest = "benchmark-controller.json"
)

Variables

This section is empty.

Functions

func CreateTestingNamespace added in v1.4.0

func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *testing.T) *v1.Namespace

func DeleteTestingNamespace added in v1.4.0

func DeleteTestingNamespace(ns *v1.Namespace, apiserver *httptest.Server, t *testing.T)

func EtcdMain added in v1.8.0

func EtcdMain(tests func() int)

func FindFreeLocalPort added in v1.6.0

func FindFreeLocalPort() (int, error)

FindFreeLocalPort returns the number of an available port number on the loopback interface. Useful for determining the port to launch a server on. Error handling required - there is a non-zero chance that the returned port number will be bound by another process after this function returns.

func GetEtcdURL added in v1.8.0

func GetEtcdURL() string

return the EtcdURL

func GetPauseImageName added in v1.8.0

func GetPauseImageName(c clientset.Interface) string

GetPauseImageName fetches the pause image name for the same architecture as the apiserver.

func GetServerArchitecture added in v1.8.0

func GetServerArchitecture(c clientset.Interface) string

GetServerArchitecture fetches the architecture of the cluster's apiserver.

func NewIntegrationTestMasterConfig added in v1.2.0

func NewIntegrationTestMasterConfig() *master.Config

Returns the master config appropriate for most integration tests.

func NewIntegrationTestNodePreparer added in v1.5.0

func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeNamePrefix string) testutils.TestNodePreparer

func NewMasterConfig added in v1.2.0

func NewMasterConfig() *master.Config

Returns a basic master config.

func NewSingleContentTypeSerializer added in v1.3.0

func NewSingleContentTypeSerializer(scheme *runtime.Scheme, info runtime.SerializerInfo) runtime.StorageSerializer

NewSingleContentTypeSerializer wraps a serializer in a NegotiatedSerializer that handles one content type

func RCFromManifest

func RCFromManifest(fileName string) *v1.ReplicationController

RCFromManifest reads a .json file and returns the rc in it.

func RunParallel

func RunParallel(task Task, numTasks, numWorkers int)

RunParallel spawns a goroutine per task in the given queue

func ScaleRC

func ScaleRC(name, ns string, replicas int32, clientset internalclientset.Interface) (*api.ReplicationController, error)

ScaleRC scales the given rc to the given replicas.

func StopRC

StopRC stops the rc via kubectl's stop library

Types

type CloseFunc added in v1.7.0

type CloseFunc func()

CloseFunc can be called to cleanup the master

func RunAMaster

func RunAMaster(masterConfig *master.Config) (*master.Master, *httptest.Server, CloseFunc)

func RunAMasterUsingServer added in v1.5.0

func RunAMasterUsingServer(masterConfig *master.Config, s *httptest.Server, masterReceiver MasterReceiver) (*master.Master, *httptest.Server, CloseFunc)

type Config

type Config struct {
	// If nil, a default is used, partially filled configs will not get populated.
	MasterConfig            *master.Config
	StartReplicationManager bool
	// Client throttling qps
	QPS float32
	// Client burst qps, also burst replicas allowed in rc manager
	Burst int
}

Config is a struct of configuration directives for NewMasterComponents.

type IntegrationTestNodePreparer added in v1.5.0

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

func (*IntegrationTestNodePreparer) CleanupNodes added in v1.5.0

func (p *IntegrationTestNodePreparer) CleanupNodes() error

func (*IntegrationTestNodePreparer) PrepareNodes added in v1.5.0

func (p *IntegrationTestNodePreparer) PrepareNodes() error

type MasterComponents

type MasterComponents struct {
	// Raw http server in front of the master
	ApiServer *httptest.Server
	// Kubernetes master, contains an embedded etcd storage
	KubeMaster *master.Master
	// Restclient used to talk to the kubernetes master
	ClientSet clientset.Interface
	// Replication controller manager
	ControllerManager *replicationcontroller.ReplicationManager
	// CloseFn shuts down the server
	CloseFn CloseFunc
	// contains filtered or unexported fields
}

MasterComponents is a control struct for all master components started via NewMasterComponents. TODO: Include all master components (scheduler, nodecontroller). TODO: Reconcile with integration.go, currently the master used there doesn't understand how to restart cleanly, which is required for each iteration of a benchmark. The integration tests also don't make it easy to isolate and turn off components at will.

func NewMasterComponents

func NewMasterComponents(c *Config) *MasterComponents

NewMasterComponents creates, initializes and starts master components based on the given config.

func (*MasterComponents) Stop

func (m *MasterComponents) Stop(apiServer, rcManager bool)

type MasterHolder added in v1.5.0

type MasterHolder struct {
	Initialized chan struct{}
	M           *master.Master
}

MasterHolder implements

func (*MasterHolder) SetMaster added in v1.5.0

func (h *MasterHolder) SetMaster(m *master.Master)

type MasterReceiver added in v1.5.0

type MasterReceiver interface {
	SetMaster(m *master.Master)
}

MasterReceiver can be used to provide the master to a custom incoming server function

type Task

type Task func(id int) error

Task is a function passed to worker goroutines by RunParallel. The function needs to implement its own thread safety.

Jump to

Keyboard shortcuts

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