Documentation
¶
Index ¶
- Constants
- func DeleteAllEtcdKeys()
- func NewEtcdClient() *etcd.Client
- func NewHelper() (tools.EtcdHelper, error)
- func RCFromManifest(fileName string) *api.ReplicationController
- func RequireEtcd()
- func RunAMaster(t *testing.T) (*master.Master, *httptest.Server)
- func RunParallel(task Task, numTasks, numWorkers int)
- func ScaleRC(name, ns string, replicas int, restClient *client.Client) (*api.ReplicationController, error)
- func StartPods(numPods int, host string, restClient *client.Client) error
- func StartRC(controller *api.ReplicationController, restClient *client.Client) (*api.ReplicationController, error)
- func StopRC(rc *api.ReplicationController, restClient *client.Client) error
- func WithEtcdKey(f func(string))
- type Config
- type MasterComponents
- type Task
Constants ¶
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"
// Test Namspace, for pods and rcs.
TestNS = "test"
)
Variables ¶
This section is empty.
Functions ¶
func DeleteAllEtcdKeys ¶
func DeleteAllEtcdKeys()
DeleteAllEtcdKeys deletes all keys from etcd. TODO: Instead of sprinkling calls to this throughout the code, adjust the prefix in etcdtest package; then just delete everything once at the end of the test run.
func NewEtcdClient ¶
func NewEtcdClient() *etcd.Client
func RCFromManifest ¶
func RCFromManifest(fileName string) *api.ReplicationController
RCFromManifest reads a .json file and returns the rc in it.
func RequireEtcd ¶
func RequireEtcd()
func RunAMaster ¶
func RunAMaster(t *testing.T) (*master.Master, *httptest.Server)
TODO: Merge this into startMasterOrDie.
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 int, restClient *client.Client) (*api.ReplicationController, error)
ScaleRC scales the given rc to the given replicas.
func StartPods ¶
func StartPods(numPods int, host string, restClient *client.Client) error
StartPods check for numPods in TestNS. If they exist, it no-ops, otherwise it starts up a temp rc, scales it to match numPods, then deletes the rc leaving behind the pods.
func StartRC ¶
func StartRC(controller *api.ReplicationController, restClient *client.Client) (*api.ReplicationController, error)
StartRC creates given rc if it doesn't already exist, then updates it via kubectl's scaler.
func StopRC ¶
func StopRC(rc *api.ReplicationController, restClient *client.Client) error
StopRC stops the rc via kubectl's stop library
func WithEtcdKey ¶
func WithEtcdKey(f func(string))
Types ¶
type Config ¶
type Config struct {
// If nil, a default is used, partially filled configs will not get populated.
MasterConfig *master.Config
StartReplicationManager bool
// If true, all existing etcd keys are purged before starting master components
DeleteEtcdKeys 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 MasterComponents ¶
type MasterComponents struct {
// Raw http server in front of the master
ApiServer *httptest.Server
// Kubernetes master, contains an embedded etcd helper
KubeMaster *master.Master
// Restclient used to talk to the kubernetes master
RestClient *client.Client
// Replication controller manager
ControllerManager *controller.ReplicationManager
// Kubernetes etcd helper, has embedded etcd client
EtcdHelper *tools.EtcdHelper
// 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.