manager

package
v0.0.0-...-8f289dc Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CREATE_ACTION string = "create"
	DELETE_ACTION string = "delete"
	LIST_ACTION   string = "list"
	GET_ACTION    string = "get"
	UPDATE_ACTION string = "update"
	SCALE_ACTION  string = "scale"
	RUN_ACTION    string = "run"
	COPY_ACTION   string = "copy"
)

Supported actions

View Source
const (
	POD                     string = "Pod"
	DEPLOYMENT              string = "Deployment"
	STATEFUL_SET            string = "StatefulSet"
	REPLICATION_CONTROLLER  string = "ReplicationController"
	SERVICE                 string = "Service"
	NAMESPACE               string = "Namespace"
	CONFIG_MAP              string = "ConfigMap"
	ENDPOINTS               string = "Endpoints"
	EVENT                   string = "Event"
	COMPONENT_STATUS        string = "ComponentStatus"
	NODE                    string = "Node"
	LIMIT_RANGE             string = "LimitRange"
	PERSISTENT_VOLUME_CLAIM string = "PersistentVolumeClaim"
	PERSISTENT_VOLUME       string = "PersistentVolume"
	POD_TEMPLATE            string = "PodTemplate"
	RESOURCE_QUOTA          string = "ResourceQuota"
	SECRET                  string = "Secret"
	SERVICE_ACCOUNT         string = "ServiceAccount"
	ROLE                    string = "Role"
	ROLE_BINDING            string = "RoleBinding"
	CLUSTER_ROLE            string = "ClusterRole"
	CLUSTER_ROLE_BINDING    string = "ClusterRoleBinding"
)

Supported k8s resource kinds

View Source
const (
	ALL_OPERATION  string = "all"
	CURR_OPERATION string = "current"
)
View Source
const AppName string = "kbench"

Variables

View Source
var Managers = map[string]NewManagerFunc{
	"Pod":                   NewPodManager,
	"Deployment":            NewDeploymentManager,
	"StatefulSet":           NewStatefulSetManager,
	"Namespace":             NewNamespaceManager,
	"Service":               NewServiceManager,
	"ReplicationController": NewReplicationControllerManager,
	"Resource":              NewResourceManager,
}

Functions

func GetListOptions

func GetListOptions(s ActionSpec) metav1.ListOptions

Types

type ActionSpec

type ActionSpec struct {
	Name           string
	Tid            int
	Oid            int
	Namespace      string
	LabelKey       string
	LabelValue     string
	MatchGoroutine bool
	MatchOperation string
	Kind           string
}

type CopySpec

type CopySpec struct {
	ParentOutDir  string
	LocalPath     string
	ContainerPath string
	Upload        bool
	ActionFilter  ActionSpec
}

type DeploymentManager

type DeploymentManager struct {

	// Action functions
	ActionFuncs map[string]func(*DeploymentManager, interface{}) error
	// contains filtered or unexported fields
}

* DeploymentManager manages deployment actions and stats.

func (*DeploymentManager) CalculateStats

func (mgr *DeploymentManager) CalculateStats()

func (*DeploymentManager) CalculateSuccessRate

func (mgr *DeploymentManager) CalculateSuccessRate() int

func (*DeploymentManager) Create

func (mgr *DeploymentManager) Create(spec interface{}) error

* This function implements the CREATE action.

func (*DeploymentManager) Delete

func (mgr *DeploymentManager) Delete(n interface{}) error

* This function implements the DELETE action.

func (*DeploymentManager) DeleteAll

func (mgr *DeploymentManager) DeleteAll() error

* This function implements the DeleteAll manager interface. It is used to clean * all the resources that are created by the deployment manager.

func (*DeploymentManager) Get

func (mgr *DeploymentManager) Get(n interface{}) error

* This function implements the GET action.

func (*DeploymentManager) GetResourceName

func (mgr *DeploymentManager) GetResourceName(opNum int, tid int) string

func (*DeploymentManager) Init

func (mgr *DeploymentManager) Init(
	kubeConfig *restclient.Config,
	nsName string,
	maxClients int,
	resourceType string,
)

* This function is used to initialize the manager.

func (*DeploymentManager) IsStable

func (mgr *DeploymentManager) IsStable() bool

* This function returns whether all the pods in the deployment are ready

func (*DeploymentManager) List

func (mgr *DeploymentManager) List(n interface{}) error

* This function implements the LIST action.

func (*DeploymentManager) LogStats

func (mgr *DeploymentManager) LogStats()

* This function computes all the metrics and stores the results into the log file.

func (*DeploymentManager) Scale

func (mgr *DeploymentManager) Scale(n interface{}) error

* This function implements the SCALE action.

func (*DeploymentManager) SendMetricToWavefront

func (mgr *DeploymentManager) SendMetricToWavefront(now time.Time, wfTags []perf_util.WavefrontTag, wavefrontPathDir string, prefix string)

func (*DeploymentManager) Update

func (mgr *DeploymentManager) Update(n interface{}) error

* This function implements the UPDATE action.

type Manager

type Manager interface {
	// Create the specified resource
	Create(spec interface{}) error

	// Delete the specified resource
	Delete(name interface{}) error

	// Calculate metrics
	CalculateStats()

	// Log stats for the manager
	LogStats()

	SendMetricToWavefront(now time.Time, wfTags []perf_util.WavefrontTag, wavefrontPathDir string, prefix string)

	// Delete all the resources created by this manager
	DeleteAll() error

	CalculateSuccessRate() int
}

func GetManager

func GetManager(managerName string) (Manager, error)

func NewDeploymentManager

func NewDeploymentManager() Manager

func NewNamespaceManager

func NewNamespaceManager() Manager

func NewPodManager

func NewPodManager() Manager

func NewReplicationControllerManager

func NewReplicationControllerManager() Manager

func NewResourceManager

func NewResourceManager() Manager

func NewServiceManager

func NewServiceManager() Manager

func NewStatefulSetManager

func NewStatefulSetManager() Manager

type NamespaceManager

type NamespaceManager struct {

	// Action functions
	ActionFuncs map[string]func(*NamespaceManager, interface{}) error
	// contains filtered or unexported fields
}

* NamespaceManager manages namespace actions and stats.

func (*NamespaceManager) CalculateStats

func (mgr *NamespaceManager) CalculateStats()

func (*NamespaceManager) CalculateSuccessRate

func (mgr *NamespaceManager) CalculateSuccessRate() int

func (*NamespaceManager) Create

func (mgr *NamespaceManager) Create(spec interface{}) error

* This function implements the CREATE action.

func (*NamespaceManager) Delete

func (mgr *NamespaceManager) Delete(n interface{}) error

* This function implements the DELETE action.

func (*NamespaceManager) DeleteAll

func (mgr *NamespaceManager) DeleteAll() error

* This function implements the DeleteAll manager interface. It is used to clean * all the resources that are created by the namespace manager.

func (*NamespaceManager) Get

func (mgr *NamespaceManager) Get(n interface{}) error

* This function implements the GET action.

func (*NamespaceManager) GetResourceName

func (mgr *NamespaceManager) GetResourceName(opNum int, tid int) string

func (*NamespaceManager) Init

func (mgr *NamespaceManager) Init(
	kubeConfig *restclient.Config,
	nsName string,
	maxClients int,
)

* This function implements the Init interface and is used to initialize the manager.

func (*NamespaceManager) List

func (mgr *NamespaceManager) List(n interface{}) error

* This function implements the LIST action.

func (*NamespaceManager) LogStats

func (mgr *NamespaceManager) LogStats()

* This function computes all the metrics and stores the results into the log file.

func (*NamespaceManager) SendMetricToWavefront

func (mgr *NamespaceManager) SendMetricToWavefront(now time.Time, wfTags []perf_util.WavefrontTag, wavefrontPathDir string, prefix string)

func (*NamespaceManager) Update

func (mgr *NamespaceManager) Update(n interface{}) error

* This function implements the UPDATE action.

type NewManagerFunc

type NewManagerFunc func() Manager

type PodManager

type PodManager struct {

	// Action functions
	ActionFuncs map[string]func(*PodManager, interface{}) error
	// contains filtered or unexported fields
}

* PodManager manages pods actions and stats.

func (*PodManager) CalculateStats

func (mgr *PodManager) CalculateStats()

func (*PodManager) CalculateSuccessRate

func (mgr *PodManager) CalculateSuccessRate() int

func (*PodManager) Copy

func (mgr *PodManager) Copy(n interface{}) error

* This function implements the COPY action.

func (*PodManager) Create

func (mgr *PodManager) Create(spec interface{}) error

* This function implements the CREATE action.

func (*PodManager) Delete

func (mgr *PodManager) Delete(n interface{}) error

* This function implements the DELETE action.

func (*PodManager) DeleteAll

func (mgr *PodManager) DeleteAll() error

* This function implements the DeleteAll manager interface. It is used to clean * all the resources that are created by the pod manager.

func (*PodManager) Get

func (mgr *PodManager) Get(n interface{}) error

* This function implements the GET action.

func (*PodManager) GetResourceName

func (mgr *PodManager) GetResourceName(userPodPrefix string, opNum int, tid int) string

func (*PodManager) Init

func (mgr *PodManager) Init(
	kubeConfig *restclient.Config,
	nsName string,
	createNamespace bool,
	maxClients int,
	resourceType string,
)

* This function implements the Init interface and is used to initialize the manager

func (*PodManager) IsStable

func (mgr *PodManager) IsStable() bool

* This function returns whether all the created pods become ready

func (*PodManager) List

func (mgr *PodManager) List(n interface{}) error

* This function implements the LIST action.

func (*PodManager) LogStats

func (mgr *PodManager) LogStats()

* This function computes all the metrics and stores the results into the log file.

func (*PodManager) Run

func (mgr *PodManager) Run(n interface{}) error

* This function implements the RUN action.

func (*PodManager) SendMetricToWavefront

func (mgr *PodManager) SendMetricToWavefront(
	now time.Time,
	wfTags []perf_util.WavefrontTag,
	wavefrontPathDir string,
	prefix string)

func (*PodManager) Update

func (mgr *PodManager) Update(n interface{}) error

* This function implements the UPDATE action.

func (*PodManager) UpdateBeforeDeletion

func (mgr *PodManager) UpdateBeforeDeletion(name string, ns string)

* This function updates the stats before deletion

type ReplicationControllerManager

type ReplicationControllerManager struct {

	// Action functions
	ActionFuncs map[string]func(*ReplicationControllerManager, interface{}) error
	// contains filtered or unexported fields
}

* ReplicationControllerManager manages replication controller actions and stats.

func (*ReplicationControllerManager) CalculateStats

func (mgr *ReplicationControllerManager) CalculateStats()

func (*ReplicationControllerManager) CalculateSuccessRate

func (mgr *ReplicationControllerManager) CalculateSuccessRate() int

func (*ReplicationControllerManager) Create

func (mgr *ReplicationControllerManager) Create(spec interface{}) error

* This function implements the CREATE action.

func (*ReplicationControllerManager) Delete

func (mgr *ReplicationControllerManager) Delete(n interface{}) error

* This function implements the DELETE action.

func (*ReplicationControllerManager) DeleteAll

func (mgr *ReplicationControllerManager) DeleteAll() error

* This function implements the DeleteAll manager interface. It is used to clean * all the resources that are created by the replication controller manager.

func (*ReplicationControllerManager) Get

func (mgr *ReplicationControllerManager) Get(n interface{}) error

* This function implements the GET action.

func (*ReplicationControllerManager) GetResourceName

func (mgr *ReplicationControllerManager) GetResourceName(
	opNum int, tid int) string

func (*ReplicationControllerManager) Init

func (mgr *ReplicationControllerManager) Init(
	kubeConfig *restclient.Config,
	nsName string,
	maxClients int,
	resourceType string,
)

* This function is used to initialize the manager.

func (*ReplicationControllerManager) IsStable

func (mgr *ReplicationControllerManager) IsStable() bool

* This function returns whether all pods in the replication controller are ready

func (*ReplicationControllerManager) List

func (mgr *ReplicationControllerManager) List(n interface{}) error

* This function implements the LIST action.

func (*ReplicationControllerManager) LogStats

func (mgr *ReplicationControllerManager) LogStats()

* This function computes all the metrics and stores the results into the log file.

func (*ReplicationControllerManager) Scale

func (mgr *ReplicationControllerManager) Scale(n interface{}) error

* This function implements the SCALE action.

func (*ReplicationControllerManager) SendMetricToWavefront

func (mgr *ReplicationControllerManager) SendMetricToWavefront(
	now time.Time, wfTags []perf_util.WavefrontTag,
	wavefrontPathDir string, prefix string)

func (*ReplicationControllerManager) Update

func (mgr *ReplicationControllerManager) Update(n interface{}) error

* This function implements the UPDATE action.

type ResourceManager

type ResourceManager struct {

	// Action functions
	ActionFuncs map[string]func(*ResourceManager, interface{}) error
	// contains filtered or unexported fields
}

* ResourceManager manages resource (of any kind) actions and stats.

func (*ResourceManager) CalculateStats

func (mgr *ResourceManager) CalculateStats()

func (*ResourceManager) CalculateSuccessRate

func (mgr *ResourceManager) CalculateSuccessRate() int

func (*ResourceManager) Create

func (mgr *ResourceManager) Create(spec interface{}) error

* This function implements the CREATE action.

func (*ResourceManager) Delete

func (mgr *ResourceManager) Delete(n interface{}) error

* This function implements the DELETE action.

func (*ResourceManager) DeleteAll

func (mgr *ResourceManager) DeleteAll() error

* This function implements the DeleteAll manager interface. It is used to clean * all the resources that are created by this manager.

func (*ResourceManager) Get

func (mgr *ResourceManager) Get(n interface{}) error

* This function implements the GET action.

func (*ResourceManager) GetResourceName

func (mgr *ResourceManager) GetResourceName(opNum int, tid int, kind string) string

func (*ResourceManager) Init

func (mgr *ResourceManager) Init(
	kubeConfig *restclient.Config,
	nsName string,
	createNamespace bool,
	maxClients int,
)

* This function implements the Init interface and is used to initialize the manager.

func (*ResourceManager) List

func (mgr *ResourceManager) List(n interface{}) error

* This function implements the LIST action.

func (*ResourceManager) LogStats

func (mgr *ResourceManager) LogStats()

* This function computes all the metrics and stores the results into the log file.

func (*ResourceManager) SendMetricToWavefront

func (mgr *ResourceManager) SendMetricToWavefront(now time.Time, wfTags []perf_util.WavefrontTag, wavefrontPathDir string, prefix string)

type RunSpec

type RunSpec struct {
	RunCommand   string
	ActionFilter ActionSpec
}

type ServiceManager

type ServiceManager struct {

	// Action functions
	ActionFuncs map[string]func(*ServiceManager, interface{}) error
	// contains filtered or unexported fields
}

* ServiceManager manages service actions and stats.

func (*ServiceManager) CalculateStats

func (mgr *ServiceManager) CalculateStats()

func (*ServiceManager) CalculateSuccessRate

func (mgr *ServiceManager) CalculateSuccessRate() int

func (*ServiceManager) Create

func (mgr *ServiceManager) Create(spec interface{}) error

* This function implements the CREATE action.

func (*ServiceManager) Delete

func (mgr *ServiceManager) Delete(n interface{}) error

* This function implements the DELETE action.

func (*ServiceManager) DeleteAll

func (mgr *ServiceManager) DeleteAll() error

* This function implements the DeleteAll manager interface. It is used to clean * all the resources that are created by the namespace manager.

func (*ServiceManager) Get

func (mgr *ServiceManager) Get(n interface{}) error

* This function implements the GET action.

func (*ServiceManager) GetResourceName

func (mgr *ServiceManager) GetResourceName(opNum int, tid int) string

func (*ServiceManager) Init

func (mgr *ServiceManager) Init(
	kubeConfig *restclient.Config,
	nsName string,
	createNamespace bool,
	maxClients int,
)

* This function implements the Init interface and is used to initialize the manager.

func (*ServiceManager) List

func (mgr *ServiceManager) List(n interface{}) error

* This function implements the LIST action.

func (*ServiceManager) LogStats

func (mgr *ServiceManager) LogStats()

* This function computes all the metrics and stores the results into the log file.

func (*ServiceManager) SendMetricToWavefront

func (mgr *ServiceManager) SendMetricToWavefront(now time.Time, wfTags []perf_util.WavefrontTag, wavefrontPathDir string, prefix string)

func (*ServiceManager) Update

func (mgr *ServiceManager) Update(n interface{}) error

* This function implements the UPDATE action.

type StatefulSetManager

type StatefulSetManager struct {

	// Action functions
	ActionFuncs map[string]func(*StatefulSetManager, interface{}) error
	// contains filtered or unexported fields
}

* StatefulSetManager manages statefulset actions and stats. * TODO: factor this out with DeploymentManager

func (*StatefulSetManager) CalculateStats

func (mgr *StatefulSetManager) CalculateStats()

func (*StatefulSetManager) CalculateSuccessRate

func (mgr *StatefulSetManager) CalculateSuccessRate() int

func (*StatefulSetManager) Create

func (mgr *StatefulSetManager) Create(spec interface{}) error

* This function implements the CREATE action.

func (*StatefulSetManager) Delete

func (mgr *StatefulSetManager) Delete(n interface{}) error

* This function implements the DELETE action.

func (*StatefulSetManager) DeleteAll

func (mgr *StatefulSetManager) DeleteAll() error

* This function implements the DeleteAll manager interface. It is used to clean * all the resources that are created by the statefulset manager.

func (*StatefulSetManager) Get

func (mgr *StatefulSetManager) Get(n interface{}) error

* This function implements the GET action.

func (*StatefulSetManager) GetResourceName

func (mgr *StatefulSetManager) GetResourceName(opNum int, tid int) string

func (*StatefulSetManager) Init

func (mgr *StatefulSetManager) Init(
	kubeConfig *restclient.Config,
	nsName string,
	maxClients int,
	resourceType string,
)

* This function is used to initialize the manager.

func (*StatefulSetManager) IsStable

func (mgr *StatefulSetManager) IsStable() bool

* This function returns whether all the pods in the statefulset are ready

func (*StatefulSetManager) List

func (mgr *StatefulSetManager) List(n interface{}) error

* This function implements the LIST action.

func (*StatefulSetManager) LogStats

func (mgr *StatefulSetManager) LogStats()

* This function computes all the metrics and stores the results into the log file.

func (*StatefulSetManager) Scale

func (mgr *StatefulSetManager) Scale(n interface{}) error

* This function implements the SCALE action.

func (*StatefulSetManager) SendMetricToWavefront

func (mgr *StatefulSetManager) SendMetricToWavefront(now time.Time, wfTags []perf_util.WavefrontTag, wavefrontPathDir string, prefix string)

func (*StatefulSetManager) Update

func (mgr *StatefulSetManager) Update(n interface{}) error

* This function implements the UPDATE action.

Jump to

Keyboard shortcuts

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