### Setup Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/imagepreload Sets up the image preloading mechanism for the cluster. ```APIDOC ## func Setup(conf *config.ClusterLoaderConfig, f *framework.Framework) error ### Description Ensures every node in the cluster preloads the given list of images before starting tests. It achieves this by creating a DaemonSet that executes "docker pull" and waits for Node objects to be updated. As a side-effect, the size of Node objects increases. Preloading is skipped in kubemark or if no images are specified. ### Signature ```go func Setup(conf *config.ClusterLoaderConfig, f *framework.Framework) error ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) Returns nil on successful setup. #### Response Example None ### Errors Returns an error if the setup process fails. ``` -------------------------------- ### Setup Image Preloading Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/imagepreload Ensures all nodes in the cluster preload the specified list of images before tests start. This function creates a DaemonSet to pull images and updates Node objects. Preloading is skipped in kubemark or if no images are specified. ```go func Setup(conf *config.ClusterLoaderConfig, f *framework.Framework) error ``` -------------------------------- ### Start and Sync Informer Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/informer Use StartAndSync to start a shared informer and wait until its cache is synchronized. It requires the informer instance, a stop channel, and a timeout duration. ```go func StartAndSync(i cache.SharedInformer, stopCh <-chan struct{}, timeout time.Duration) error ``` -------------------------------- ### Get Replicas from Watcher Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/runtimeobjects Starts a ReplicasWatcher and retrieves the current number of replicas. Ensure the watcher is properly initialized before calling. ```go func GetReplicasOnce(rw ReplicasWatcher) (int, error) ``` -------------------------------- ### StartParams Struct - Go Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common Represents configuration parameters for starting a measurement action. Includes metric name, version, queries, unit, and dimensions. ```go type StartParams struct { MetricName string MetricVersion string Queries []GenericQuery Unit string Dimensions []string } ``` -------------------------------- ### StartAndSync Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/informer Starts a given informer and waits until it has been fully synced, returning an error if the timeout is reached. ```APIDOC ## func StartAndSync ### Description StartAndSync starts informer and waits for it to be synced. ### Signature ```go func StartAndSync(i cache.SharedInformer, stopCh <-chan struct{}, timeout time.Duration) error ``` ``` -------------------------------- ### PrepareConfig Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework/config Creates and initializes a Kubernetes client configuration. This function handles the necessary setup for a fully functional configuration object. ```APIDOC ## PrepareConfig ### Description PrepareConfig creates and initializes client config. ### Signature ```go func PrepareConfig(path string) (config *restclient.Config, err error) ``` ### Parameters #### Path Parameters - **path** (string) - Description: The path to the configuration file. ``` -------------------------------- ### Get InstancesState from NamespacesState Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/state Get returns the state of object instances, including the number of existing replicas and their configuration. ```go func (ns *NamespacesState) Get(namespace string, identifier InstancesIdentifier) (*InstancesState, bool) ``` -------------------------------- ### Get Discovery Client with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetDiscoveryClient retrieves the DiscoveryClient for Kubernetes API discovery. ```go func (f *Framework) GetDiscoveryClient() *discovery.DiscoveryClient ``` -------------------------------- ### Monkey.Init Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/chaos Initializes the Monkey with a given configuration. It starts simulating failures until the stop channel is closed. ```APIDOC ## Monkey.Init ### Description Init initializes Monkey with given config. When stopCh is closed, the Monkey will stop simulating failures. ### Signature ```go func (m *Monkey) Init(config api.ChaosMonkeyConfig, stopCh <-chan struct{}) (*sync.WaitGroup, error) ``` ### Parameters - **config** (api.ChaosMonkeyConfig) - The configuration for the chaos monkey. - **stopCh** (<-chan struct{}) - A channel that signals when to stop the simulation. ``` -------------------------------- ### NewRootFramework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework Creates a framework instance for the root cluster, useful for specific cluster setups. ```APIDOC ## NewRootFramework ### Description Creates a framework instance for the root cluster. For most clusters, this is identical to `NewFramework`. ### Method ```go func NewRootFramework(clusterConfig *config.ClusterConfig, clientsNumber int) (*Framework, error) ``` ### Parameters - **clusterConfig** (*config.ClusterConfig) - The cluster configuration to use. - **clientsNumber** (int) - The number of clients to create. ### Returns - (*Framework, error) - A new Framework instance and an error if creation fails. ``` -------------------------------- ### GetReplicasOnce Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/runtimeobjects Starts a ReplicasWatcher and retrieves the number of replicas. ```APIDOC ## GetReplicasOnce ### Description GetReplicasOnce starts ReplicasWatcher and gets a number of replicas. ### Signature ```go func GetReplicasOnce(rw ReplicasWatcher) (int, error) ``` ``` -------------------------------- ### Get REST Client Config with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetRestClient retrieves the REST client configuration for the framework. ```go func (f *Framework) GetRestClient() *restclient.Config ``` -------------------------------- ### Implement Custom Dependency Interface Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/dependency Implement the `Dependency` interface to create custom dependencies. This involves defining `Setup`, `Teardown`, and `String` methods. ```go type Dependency interface { Setup(config *Config) error Teardown(config *Config) error String() string } type myDependency struct{} func (d *myDependency) Setup(config *Config) error { // Setup logic here return nil } func (d *myDependency) Teardown(config *Config) error { // Teardown logic here return nil } func (d *myDependency) String() string { return "MyDependency" } ``` -------------------------------- ### NodeKiller Run Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/chaos Starts the NodeKiller. It runs until the provided stop channel is closed. ```go func (k *NodeKiller) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) ``` -------------------------------- ### SetUpExecService Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/execservice Sets up the exec service by creating an exec pod. ```APIDOC ## SetUpExecService ### Description SetUpExecService creates exec pod. ### Signature ```go func SetUpExecService(f *framework.Framework, c config.ExecServiceConfig) error ``` ``` -------------------------------- ### Get ClusterLoader2 Environment Mappings Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/config Loads and returns a map of environment variables that start with the CL2_ prefix. This is useful for configuring cluster loader behavior via environment variables. ```go func LoadCL2Envs() (map[string]interface{}, error) ``` -------------------------------- ### Get Kubernetes ClientSets with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetClientSets retrieves the MultiClientSet for interacting with the Kubernetes API. ```go func (f *Framework) GetClientSets() *MultiClientSet ``` -------------------------------- ### Get Dynamic Clients with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetDynamicClients retrieves the MultiDynamicClient for dynamic Kubernetes API interactions. ```go func (f *Framework) GetDynamicClients() *MultiDynamicClient ``` -------------------------------- ### Prepare Kubernetes Client Config Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework/config Creates and initializes a Kubernetes client configuration from a specified path. ```go func PrepareConfig(path string) (config *restclient.Config, err error) ``` -------------------------------- ### Get Kubemark Master Components Resource Usage Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/kubemark Retrieves the resource usage for Kubemark master components. This function is intended for use within Kubemark environments and may require specific setup for SSH access. ```go func GetKubemarkMasterComponentsResourceUsage(host string, provider provider.Provider) map[string]*ResourceUsage ``` -------------------------------- ### Get Cluster Configuration with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetClusterConfig retrieves the cluster configuration used by the framework. ```go func (f *Framework) GetClusterConfig() *config.ClusterConfig ``` -------------------------------- ### Set Up Prometheus Stack Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/prometheus Sets up the Prometheus stack in the cluster. This operation is idempotent; applying manifests again will have no effect if the stack is already present. ```go func (pc *Controller) SetUpPrometheusStack() error ``` -------------------------------- ### ResourceUsageSummary Get Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/gatherers The Get method for ResourceUsageSummary. It retrieves a collection of SingleContainerSummaries for a given percentile. ```go func (r *ResourceUsageSummary) Get(perc string) []util.SingleContainerSummary ``` -------------------------------- ### Create OwnerReferenceBasedPodStore Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Initializes an OwnerReferenceBasedPodStore with a controlled pods indexer and the owner object. ```go func NewOwnerReferenceBasedPodStore(controlledPodsIndexer controlledPodsIndexer, owner interface{}) (*OwnerReferenceBasedPodStore, error) ``` -------------------------------- ### Get Resource Version from ResourcesVersionsState Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/state Get returns the current resource version for a given resource type identifier. ```go func (rs *ResourcesVersionsState) Get(identifier ResourceTypeIdentifier) (string, bool) ``` -------------------------------- ### Monkey Init Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/chaos Initializes the Monkey with a configuration and a stop channel. The simulation stops when the stop channel is closed. ```go func (m *Monkey) Init(config api.ChaosMonkeyConfig, stopCh <-chan struct{}) (*sync.WaitGroup, error) ``` -------------------------------- ### SetUpExecService Function Signature - ExecService Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/execservice Creates an exec pod in the cluster. This function is responsible for the deployment and initialization of the pod that will be used for command execution. ```go func SetUpExecService(f *framework.Framework, c config.ExecServiceConfig) error ``` -------------------------------- ### KubestellarProvider GetManagedPrometheusClient Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the managed Prometheus client. ```APIDOC ## GetManagedPrometheusClient ### Description Gets the managed Prometheus client. ### Method Signature ```go func (p *KubestellarProvider) GetManagedPrometheusClient() (prom.Client, error) ``` ### Returns - **prom.Client**: The managed Prometheus client. - **error**: An error if the client cannot be obtained. ``` -------------------------------- ### Manage Automanaged Namespaces with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework Create, delete, and list automanaged namespaces using the Framework. Specify options for creation and timeouts for deletion. ```go func (f *Framework) CreateAutomanagedNamespaces(namespaceCount int, allowExistingNamespaces bool, deleteAutomanagedNamespaces bool) error ``` ```go func (f *Framework) DeleteAutomanagedNamespaces(timeout time.Duration) *errors.ErrorList ``` ```go func (f *Framework) GetAutomanagedNamespacePrefix() string ``` ```go func (f *Framework) ListAutomanagedNamespaces() ([]string, []string, error) ``` ```go func (f *Framework) SetAutomanagedNamespacePrefix(nsName string) ``` -------------------------------- ### KubemarkProvider GetManagedPrometheusClient Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the managed Prometheus client. ```APIDOC ## GetManagedPrometheusClient ### Description Gets the managed Prometheus client. ### Method Signature ```go func (p *KubemarkProvider) GetManagedPrometheusClient() (prom.Client, error) ``` ### Returns - **prom.Client**: The managed Prometheus client. - **error**: An error if the client cannot be obtained. ``` -------------------------------- ### Create a NodeStore Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Creates a NodeStore to list nodes based on an object selector. Requires a Kubernetes clientset interface. ```go func NewNodeStore(c clientset.Interface, selector *util.ObjectSelector) (*NodeStore, error) ``` -------------------------------- ### KindProvider GetManagedPrometheusClient Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the managed Prometheus client. ```APIDOC ## GetManagedPrometheusClient ### Description Gets the managed Prometheus client. ### Method Signature ```go func (p *KindProvider) GetManagedPrometheusClient() (prom.Client, error) ``` ### Returns - **prom.Client**: The managed Prometheus client. - **error**: An error if the client cannot be obtained. ``` -------------------------------- ### Create Kubernetes Object with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework CreateObject creates a Kubernetes object based on its description in a specified namespace. ```go func (f *Framework) CreateObject(namespace string, name string, obj *unstructured.Unstructured, options ...*client.APICallOptions) error ``` -------------------------------- ### KCPProvider GetManagedPrometheusClient Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the managed Prometheus client. ```APIDOC ## GetManagedPrometheusClient ### Description Gets the managed Prometheus client. ### Method Signature ```go func (p *KCPProvider) GetManagedPrometheusClient() (prom.Client, error) ``` ### Returns - **prom.Client**: The managed Prometheus client. - **error**: An error if the client cannot be obtained. ``` -------------------------------- ### Get Kubernetes Client Config Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework/config Retrieves the Kubernetes client configuration from a specified path without additional initialization. ```go func GetConfig(path string) (config *restclient.Config, err error) ``` -------------------------------- ### NewProvider Function Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Creates a new provider instance based on initialization options. Returns an error if the specified provider is not supported. ```go func NewProvider(initOptions *InitOptions) (Provider, error) ``` -------------------------------- ### Create Kubernetes Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework Use NewFramework to create a new framework instance based on cluster configuration. NewRootFramework is available for the root cluster. ```go func NewFramework(clusterConfig *config.ClusterConfig, clientsNumber int) (*Framework, error) ``` ```go func NewRootFramework(clusterConfig *config.ClusterConfig, clientsNumber int) (*Framework, error) ``` -------------------------------- ### Get One-Time Resource Usage on Node Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/kubelet Queries the node's /stats/summary endpoint to retrieve resource usage. It takes a Kubernetes client, node name, port, and a function to get container names. Returns resource usage per container and an error if any. ```go func GetOneTimeResourceUsageOnNode(c clientset.Interface, nodeName string, port int, containerNames func() []string) (util.ResourceUsagePerContainer, error) ``` -------------------------------- ### NewGKEKubemarkProvider Constructor Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Creates a new instance of GKEKubemarkProvider. Requires a configuration map for initialization. ```go func NewGKEKubemarkProvider(config map[string]string) *GKEKubemarkProvider ``` -------------------------------- ### LocalProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```APIDOC ## GetComponentProtocolAndPort ### Description Gets the protocol and port for a given component. ### Method Signature ```go func (p *LocalProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` ### Parameters #### Path Parameters - **componentName** (string) - The name of the component. ### Returns - **string**: The protocol of the component. - **int**: The port of the component. - **error**: An error if the component is not found or other issues occur. ``` -------------------------------- ### KubestellarProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```APIDOC ## GetComponentProtocolAndPort ### Description Gets the protocol and port for a given component. ### Method Signature ```go func (p *KubestellarProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` ### Parameters #### Path Parameters - **componentName** (string) - The name of the component. ### Returns - **string**: The protocol of the component. - **int**: The port of the component. - **error**: An error if the component is not found or other issues occur. ``` -------------------------------- ### KubemarkProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```APIDOC ## GetComponentProtocolAndPort ### Description Gets the protocol and port for a given component. ### Method Signature ```go func (p *KubemarkProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` ### Parameters #### Path Parameters - **componentName** (string) - The name of the component. ### Returns - **string**: The protocol of the component. - **int**: The port of the component. - **error**: An error if the component is not found or other issues occur. ``` -------------------------------- ### ContainerResourceGatherer StartGatheringData Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/gatherers The StartGatheringData method for ContainerResourceGatherer. This method starts the data gathering process and blocks until StopAndSummarize is called. ```go func (g *ContainerResourceGatherer) StartGatheringData() ``` -------------------------------- ### GCEProvider GetConfig Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Returns the configuration for the GCEProvider. This may contain specific settings for GCE environments. ```go func (p *GCEProvider) GetConfig() Config ``` -------------------------------- ### KindProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```APIDOC ## GetComponentProtocolAndPort ### Description Gets the protocol and port for a given component. ### Method Signature ```go func (p *KindProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` ### Parameters #### Path Parameters - **componentName** (string) - The name of the component. ### Returns - **string**: The protocol of the component. - **int**: The port of the component. - **error**: An error if the component is not found or other issues occur. ``` -------------------------------- ### Create New PromqlExecutor Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common/executors Constructor for PromqlExecutor. It loads time series and rules from a specified file. Samples are loaded from a test file and start at time.Time.UTC(0,0). ```go func NewPromqlExecutor(timeSeriesFile string) (*PromqlExecutor, error) ``` -------------------------------- ### KCPProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```APIDOC ## GetComponentProtocolAndPort ### Description Gets the protocol and port for a given component. ### Method Signature ```go func (p *KCPProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` ### Parameters #### Path Parameters - **componentName** (string) - The name of the component. ### Returns - **string**: The protocol of the component. - **int**: The port of the component. - **error**: An error if the component is not found or other issues occur. ``` -------------------------------- ### Initialize Flag Set Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/flags Initializes the flag set, preparing it for parsing. ```go func InitFlagSet() ``` -------------------------------- ### Create New PVStore Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Creates a PVStore, a wrapper around cache.Store for Persistent Volumes, based on a given object selector. Requires a Kubernetes clientset and provisioner string. ```go func NewPVStore(c clientset.Interface, selector *util.ObjectSelector, provisioner string) (*PVStore, error) ``` -------------------------------- ### LocalProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```go func (p *LocalProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` -------------------------------- ### NewKubemarkProvider Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Constructs a new KubemarkProvider with the given configuration. ```go func NewKubemarkProvider(config map[string]string) *KubemarkProvider ``` -------------------------------- ### KubestellarProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```go func (p *KubestellarProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` -------------------------------- ### KubemarkProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```go func (p *KubemarkProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` -------------------------------- ### New Kubelet Metrics Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common/metrics Initializes and returns a new KubeletMetrics object. ```go func NewKubeletMetrics() KubeletMetrics ``` -------------------------------- ### KindProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```go func (p *KindProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` -------------------------------- ### PVsStartupStatus.String Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Returns a string representation of the PVsStartupStatus, providing a human-readable summary of the PV states. ```APIDOC ## PVsStartupStatus.String ### Description String returns string representation for PVsStartupStatus. ### Method Signature ```go func (s *PVsStartupStatus) String() string ``` ``` -------------------------------- ### KCPProvider GetComponentProtocolAndPort Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Gets the protocol and port for a given component. ```go func (p *KCPProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` -------------------------------- ### Initialize Image Preload Flags Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/imagepreload Call this function to initialize any command-line flags related to image preloading. ```go func InitFlags() ``` -------------------------------- ### Create New PodStore Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Creates a PodStore, a wrapper around cache.Store for Pods, based on a given object selector. Requires a Kubernetes clientset. ```go func NewPodStore(c clientset.Interface, selector *util.ObjectSelector) (*PodStore, error) ``` -------------------------------- ### Get Client from MultiDynamicClient Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetClient retrieves a dynamic.Interface from the MultiDynamicClient. ```go func (m *MultiDynamicClient) GetClient() dynamic.Interface ``` -------------------------------- ### Get Client from MultiClientSet Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetClient retrieves a Kubernetes clientset.Interface from the MultiClientSet. ```go func (m *MultiClientSet) GetClient() clientset.Interface ``` -------------------------------- ### Get Automanaged Namespace Prefix Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework Retrieves the prefix used for automanaged namespaces. ```go func (f *Framework) GetAutomanagedNamespacePrefix() string ``` -------------------------------- ### NewProvider Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Creates a new provider instance based on the provided initialization options. Returns an error if the specified provider is not supported. ```APIDOC ## NewProvider ### Description Creates a new provider from init options. It will return an error if the provider name is not supported. ### Signature ```go func NewProvider(initOptions *InitOptions) (Provider, error) ``` ``` -------------------------------- ### GKEProvider GetConfig Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Returns the configuration for the GKEProvider. This configuration is used during its initialization. ```go func (p *GKEProvider) GetConfig() Config ``` -------------------------------- ### TimeLimitedLoad Type Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/api Spreads operation starts evenly over a given amount of time. ```APIDOC ## type TimeLimitedLoad ```go type TimeLimitedLoad struct { // TimeLimit specifies the amount of time that the operations will be spread over. TimeLimit Duration `json:"timeLimit"` } ``` TimeLimitedLoad spreads the operation starts out evenly over a given amount of time. ``` -------------------------------- ### Get All Errors from StepResult Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/test Retrieves all errors accumulated within the StepResult, including those from sub-steps. ```go func (s *StepResult) GetAllErrors() *errors.ErrorList ``` -------------------------------- ### Load Test Suite Configuration Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/config Loads the test suite configuration from a file specified by the given path. ```go func LoadTestSuite(path string) (api.TestSuite, error) ``` -------------------------------- ### Get ResourcesVersionState from State Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/state GetResourcesVersionState returns the ResourcesVersionsState component of the overall cluster state. ```go func (s *State) GetResourcesVersionState() *ResourcesVersionsState ``` -------------------------------- ### Run Test Execution Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/test Executes the test based on the provided test configuration. This is the main entry point for running a test scenario. ```go func RunTest(ctx Context) *errors.ErrorList ``` -------------------------------- ### Get NamespacesState from State Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/state GetNamespacesState returns the NamespacesState component of the overall cluster state. ```go func (s *State) GetNamespacesState() *NamespacesState ``` -------------------------------- ### PVsStartupStatus Computation Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Utilities for computing and representing the startup status of Persistent Volumes. ```APIDOC ## ComputePVsStartupStatus ### Description Computes the startup status of Persistent Volumes based on the actual and expected counts. ### Signature func ComputePVsStartupStatus(PVs []*corev1.PersistentVolume, expected int) PVsStartupStatus ## PVsStartupStatus.String ### Description Returns a string representation of the PVsStartupStatus. ### Signature func (s *PVsStartupStatus) String() string ``` -------------------------------- ### WaitForGenericK8sObjectsOptions Summary Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Returns a summary string for logging purposes, derived from the options. ```go func (o *WaitForGenericK8sObjectsOptions) Summary() string ``` -------------------------------- ### GKEKubemarkProvider GetConfig Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Returns the configuration associated with the GKEKubemarkProvider. This configuration is used during its initialization. ```go func (p *GKEKubemarkProvider) GetConfig() Config ``` -------------------------------- ### Apply Templated Manifests with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework ApplyTemplatedManifests finds and applies manifest template files matching a glob pattern, substituting placeholders using a provided map. ```go func (f *Framework) ApplyTemplatedManifests(fsys fs.FS, manifestGlob string, templateMapping map[string]interface{}, options ...*client.APICallOptions) error ``` -------------------------------- ### LoadCL2Envs Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/config LoadCL2Envs loads and returns a mapping from environment variables that start with the CL2_ prefix. ```APIDOC ## LoadCL2Envs ### Description LoadCL2Envs returns mapping from the envs starting with CL2_ prefix. ### Signature ```go func LoadCL2Envs() (map[string]interface{}, error) ``` ``` -------------------------------- ### NodeKiller.Run Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/chaos Starts the NodeKiller to simulate node failures until the provided stop channel is closed. ```APIDOC ## NodeKiller.Run ### Description Run starts NodeKiller until stopCh is closed. ### Signature ```go func (k *NodeKiller) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) ``` ### Parameters - **stopCh** (<-chan struct{}) - A channel that signals when to stop the NodeKiller. - **wg** (*sync.WaitGroup) - A wait group to signal completion. ``` -------------------------------- ### NewTemplateProvider Function Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/config Creates and returns a new instance of TemplateProvider, requiring a file system interface. ```go func NewTemplateProvider(fsys fs.FS) *TemplateProvider ``` -------------------------------- ### TemplateProvider.TemplateToConfig Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/config Generates a test configuration object from a template file, substituting placeholders with values from a mapping. ```go func (tp *TemplateProvider) TemplateToConfig(path string, mapping map[string]interface{}) (*api.Config, error) ``` -------------------------------- ### InitOptions Struct Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Encapsulates fields required for provider initialization. ```go type InitOptions struct { // TODO(#1361) remove this and use providerConfigs. KubemarkRootKubeConfigPath string ProviderName string ProviderConfigs []string } ``` -------------------------------- ### Get Apiserver Latency Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util GetApiserverLatency retrieves the apiserver latency based on the cluster version information. ```go func GetApiserverLatency(clusterVersion version.Info) string ``` -------------------------------- ### Grab All Metrics Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common/metrics Grab returns a Collection of metrics from all configured components. ```go func (g *Grabber) Grab() (Collection, error) ``` -------------------------------- ### NewFramework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework Creates a new framework instance for interacting with a Kubernetes cluster configuration. ```APIDOC ## NewFramework ### Description Creates a new framework instance based on the provided cluster configuration and number of clients. ### Method ```go func NewFramework(clusterConfig *config.ClusterConfig, clientsNumber int) (*Framework, error) ``` ### Parameters - **clusterConfig** (*config.ClusterConfig) - The cluster configuration to use. - **clientsNumber** (int) - The number of clients to create. ### Returns - (*Framework, error) - A new Framework instance and an error if creation fails. ``` -------------------------------- ### Get Master Name Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/util Retrieves the name of the master node in a Kubernetes cluster. Requires a clientset.Interface. ```go func GetMasterName(c clientset.Interface) (string, error) ``` -------------------------------- ### Get Prometheus Controller Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/prometheus Retrieves the underlying framework instance associated with the Prometheus Controller. ```go func (pc *Controller) GetFramework() *framework.Framework ``` -------------------------------- ### InitOptions Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Encapsulates the fields needed to initialize a provider. ```APIDOC ## InitOptions ### Description InitOptions encapsulates the fields needed to initialize a provider. ### Fields - **KubemarkRootKubeConfigPath** (string) - TODO(#1361) remove this and use providerConfigs. - **ProviderName** (string) - **ProviderConfigs** ([]string) ``` -------------------------------- ### ComputePVsStartupStatus Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Computes the startup status for a given group of Persistent Volumes (PVs). It takes a slice of PVs and an expected count, returning a PVsStartupStatus object. ```APIDOC ## ComputePVsStartupStatus ### Description ComputePVsStartupStatus computes PVsStartupStatus for a group of PVs. ### Function Signature ```go func ComputePVsStartupStatus(PVs []*corev1.PersistentVolume, expected int) PVsStartupStatus ``` ``` -------------------------------- ### Connect to Prometheus UI Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/prometheus Use this command to establish a port-forward connection to the Prometheus UI. Ensure Prometheus is running in the 'monitoring' namespace. ```bash kubectl --namespace monitoring port-forward svc/prometheus-k8s 9090 --address=0.0.0.0 ``` -------------------------------- ### Get Kubernetes Object with Framework Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework GetObject retrieves a Kubernetes object by its GroupVersionKind, namespace, and name. ```go func (f *Framework) GetObject(gvk schema.GroupVersionKind, namespace string, name string, options ...*client.APICallOptions) (*unstructured.Unstructured, error) ``` -------------------------------- ### StartParams.Validate Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common Validates the configuration of StartParams. This method checks if the parameters provided for starting a measurement are valid. ```APIDOC ## StartParams.Validate ### Description Validates the configuration of StartParams. ### Method Signature ``` func (p *StartParams) Validate() error ``` ``` -------------------------------- ### InitializeTemplateMappingForDNSPropagationProbe Function Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common/probes Initializes a template mapping for DNS propagation probes. This function is part of the measurement configuration. ```go func InitializeTemplateMappingForDNSPropagationProbe(config *measurement.Config) (map[string]interface{}, error) ``` -------------------------------- ### InitializeTemplateMappingForDNSPropagationProbe Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common/probes Initializes the template mapping for the DNS propagation probe based on the provided configuration. ```APIDOC ## InitializeTemplateMappingForDNSPropagationProbe ### Description Initializes the template mapping for the DNS propagation probe based on the provided configuration. ### Signature ```go func InitializeTemplateMappingForDNSPropagationProbe(config *measurement.Config) (map[string]interface{}, error) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **map[string]interface{}**: A map containing the initialized template mappings. - **error**: An error if the initialization fails. #### Response Example None ``` -------------------------------- ### String Representation of PVsStartupStatus Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Returns a string representation of the PVsStartupStatus. Useful for logging or debugging. ```go func (s *PVsStartupStatus) String() string ``` -------------------------------- ### Get Deleted PVCs from PVCDiff Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Returns a slice of names for PVCs that were deleted between the old and new sets. ```go func (p PVCDiff) DeletedPVCs() []string ``` -------------------------------- ### Get Added PVCs from PVCDiff Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Returns a slice of names for PVCs that were added between the old and new sets. ```go func (p PVCDiff) AddedPVCs() []string ``` -------------------------------- ### NewKubemarkProvider Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Constructs a new KubemarkProvider. ```APIDOC ## NewKubemarkProvider ### Description Constructs a new KubemarkProvider. ### Method Signature ```go func NewKubemarkProvider(config map[string]string) *KubemarkProvider ``` ### Parameters #### Path Parameters - **config** (map[string]string) - Configuration for the Kubemark provider. ``` -------------------------------- ### InitFlags Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/execservice Initializes flags for the exec service configuration. ```APIDOC ## InitFlags ### Description InitFlags initializes flags for the exec service configuration. ### Signature ```go func InitFlags(c *config.ExecServiceConfig) ``` ``` -------------------------------- ### Get string representation of NamespacesRange Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util String returns a printable representation of the NamespacesRange. Use this for logging or debugging. ```go func (nr *NamespacesRange) String() string ``` -------------------------------- ### Monkey Summary Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/chaos Logs the execution summary of the Monkey. ```go func (m *Monkey) Summary() string ``` -------------------------------- ### SteppedLoad Type Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/api Defines a load pattern that starts a burst of a given size every X seconds. ```APIDOC ## type SteppedLoad ```go type SteppedLoad struct { // BurstSize specifies the qps peek. BurstSize int32 `json:"burstSize"` // StepDelay specifies the interval between peeks. StepDelay Duration `json:"stepDelay"` } ``` SteppedLoad defines a load that starts a burst of a given size every X seconds. ``` -------------------------------- ### Get Apiserver SLI Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util GetApiserverSLI retrieves the apiserver Service Level Indicator based on the cluster version information. ```go func GetApiserverSLI(clusterVersion version.Info) string ``` -------------------------------- ### Get Schedulable Untainted Nodes Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/util Fetches a list of nodes in the Kubernetes cluster that are schedulable and do not have taints. Requires a clientset.Interface. ```go func GetSchedulableUntainedNodes(c clientset.Interface) ([]corev1.Node, error) ``` -------------------------------- ### NewGCEProvider Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Creates a new GCE provider instance. ```APIDOC ## NewGCEProvider ### Description Creates a new GCE provider. ### Signature ```go func NewGCEProvider(_ map[string]string) Provider ``` ``` -------------------------------- ### NamespacesState Operations Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/state Functions for managing state related to namespaces, including setting, getting, and deleting instance information. ```APIDOC ## NamespacesState.Set ### Description Stores information about object instances state to the test state. ### Signature ```go func (ns *NamespacesState) Set(namespace string, identifier InstancesIdentifier, instances *InstancesState) ``` ## NamespacesState.Get ### Description Retrieves the state of object instances, including the number of existing replicas and their configuration. ### Signature ```go func (ns *NamespacesState) Get(namespace string, identifier InstancesIdentifier) (*InstancesState, bool) ``` ## NamespacesState.Delete ### Description Removes information about given instances. If there is no information for the given object, it is assumed that there are no object replicas. ### Signature ```go func (ns *NamespacesState) Delete(namespace string, identifier InstancesIdentifier) error ``` ``` -------------------------------- ### Create Simple Reporter Function Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/test Function to create a simple Reporter implementation. It requires a report filename and a test suite description. ```go func CreateSimpleReporter(reportFilename, testSuiteDescription string) Reporter ``` -------------------------------- ### Get Object Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/framework Retrieves a Kubernetes object by its GroupVersionKind, namespace, and name. Optional API call options can be provided. ```go func (f *Framework) GetObject(gvk schema.GroupVersionKind, namespace string, name string, _ ...*client.APICallOptions) (*unstructured.Unstructured, error) ``` -------------------------------- ### ComputePVCsStartupStatus Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Computes the startup status for a given group of Persistent Volume Claims (PVCs). It takes a slice of PVCs and an expected count, returning a PVCsStartupStatus object. ```APIDOC ## ComputePVCsStartupStatus ### Description Computes PVCsStartupStatus for a group of PVCs. ### Function Signature ```go func ComputePVCsStartupStatus(pvcs []*corev1.PersistentVolumeClaim, expected int) PVCsStartupStatus ``` ``` -------------------------------- ### Get Template Functions Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/config Returns a map of supported function names to their corresponding functions for use with the template provider. ```go func GetFuncs(fsys fs.FS) template.FuncMap ``` -------------------------------- ### Configuration for Measurement Instance Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/api Contains the identifier and optional parameters for a specific measurement instance within a wrapper measurement. Instance-specific parameters take precedence. ```go type MeasurementInstanceConfig struct { // Identifier is a string that identifies a single instance of measurement within a wrapper measurement Identifier string `json:"identifier"` // Params is an optional map which is specific to the measurement instance defined above by the identifier. // In case the Measurement level params also contain the same configs as defined in this, then while executing that // particular Measurement Instance, the params defined here would be given higher priority. Params map[string]interface{} `json:"params"` } ``` -------------------------------- ### Compute Pods Startup Status Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Computes the PodsStartupStatus for a given group of pods. It takes a slice of corev1.Pod and an optional pod update check function. ```go func ComputePodsStartupStatus(pods []*corev1.Pod, expected int, isPodUpdated func(*corev1.Pod) error) PodsStartupStatus { // Implementation omitted for brevity } ``` -------------------------------- ### Prometheus Client Interface Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/prometheus/clients Defines the interface for Prometheus clients, specifying a Query method to send GET requests. ```go type Client interface { // Query sends a GET request to Prometheus with the "query" field // in the URL's query string set using the provided arguments. Query(query string, queryTime time.Time) ([]byte, error) } ``` -------------------------------- ### NewKCPProvider Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Creates a new KCP provider instance. ```APIDOC ## NewKCPProvider ### Description Creates a new KCP provider. ### Signature ```go func NewKCPProvider(_ map[string]string) Provider ``` ``` -------------------------------- ### GKEKubemarkProvider GetComponentProtocolAndPort Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Retrieves the protocol and port for a given component on GKEKubemarkProvider. Essential for network communication setup. ```go func (p *GKEKubemarkProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` -------------------------------- ### EKSProvider GetConfig Method Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Retrieves the configuration for the EKS provider. ```go func (p *EKSProvider) GetConfig() Config ``` -------------------------------- ### Convert Duration to time.Duration Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/api Converts a custom Duration type to Go's standard time.Duration. No setup required. ```go func (d *Duration) ToTimeDuration() time.Duration ``` -------------------------------- ### InitFlagSet Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/flags Initializes the flag set, preparing it for parsing. ```APIDOC ## InitFlagSet ### Description Initializes the flag set. ### Signature ```go func InitFlagSet() ``` ``` -------------------------------- ### Grab Scheduler Metrics Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/common/metrics Retrieves metrics from the Kubernetes scheduler. No specific setup is required beyond having a Grabber instance. ```go func (g *Grabber) GrabFromScheduler() (SchedulerMetrics, error) ``` -------------------------------- ### ExecServiceConfig Structure Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/config Configuration for enabling and managing the execution service, including specifying the image registry. ```go type ExecServiceConfig struct { // Determines if service config should be enabled. Enable bool ImageRegistry string } ``` -------------------------------- ### List Runtime Objects by Kind Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/runtimeobjects Lists all runtime objects of a specific kind (GVR) that match the provided label and field selectors. Requires a dynamic client. ```go func ListRuntimeObjectsForKind(d dynamic.Interface, gvr schema.GroupVersionResource, labelSelector, fieldSelector string) ([]runtime.Object, error) ``` -------------------------------- ### Get Ordered Keys by Phase Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Returns keys that have a specific phase entry, sorted chronologically by the phase's timestamp. ```go func (o *ObjectTransitionTimes) GetOrderedKeys(phase string) []KeyTimestamp ``` -------------------------------- ### Get Object Phase Time Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Retrieves the timestamp for a specific phase of a given key, returning whether the entry exists. ```go func (o *ObjectTransitionTimes) Get(key, phase string) (time.Time, bool) ``` -------------------------------- ### PodsStartupStatus Struct Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Represents the startup status of a group of pods, including counts for various states like Running, Pending, and Terminating. ```go type PodsStartupStatus struct { Expected int Terminating int Running int Scheduled int RunningButNotReady int Waiting int Pending int Unknown int Inactive int Created int RunningUpdated int LastIsPodUpdatedError error } ``` -------------------------------- ### Define Object Configuration Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/api Configure object creation and management using Object, specifying basename, template path, and template fill values. Supports listing unknown objects for deletion. ```go type Object struct { // Basename is a string from which names of objects will be created. Basename string `json:"basename"` // ObjectTemplatePath specifies the path to object definition. ObjectTemplatePath string `json:"objectTemplatePath"` // TemplateFillMap specifies for each placeholder what value should it be replaced with. TemplateFillMap map[string]interface{} `json:"templateFillMap"` // ListUnknownObjectOptions, if set, will result in listing objects that were // not created directly via ClusterLoader2 before executing Phase. The main // use case for that is deleting unknown objects using the Phase mechanism, // e.g. deleting PVs that were created via StatefulSets leveraging all Phase // functionalities, e.g. respecting given QPS, doing it in parallel with other // Phases, etc. ListUnknownObjectOptions *ListUnknownObjectOptions `json:"listUnknownObjectOptions"` } ``` -------------------------------- ### Get SSH Signer Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/util Obtains an SSH signer based on the provided provider string. Used for authenticating SSH connections. ```go func GetSigner(provider string) (ssh.Signer, error) ``` -------------------------------- ### Get Schedulable Untainted Nodes Number Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/util Counts the number of nodes in the Kubernetes cluster that are schedulable and do not have taints. Requires a clientset.Interface. ```go func GetSchedulableUntainedNodesNumber(c clientset.Interface) (int, error) ``` -------------------------------- ### Define QPS Load Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/api Configure QPSLoad to specify the desired queries per second (QPS) for operations. ```go type QPSLoad struct { // QPS specifies requested qps. QPS float64 `json:"qps"` } ``` -------------------------------- ### Get Master IPs Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/util Retrieves the IP addresses of master nodes in a Kubernetes cluster. Requires a clientset.Interface and an address type. ```go func GetMasterIPs(c clientset.Interface, addressType corev1.NodeAddressType) ([]string, error) ``` -------------------------------- ### Create Summary Function Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement Creates a generic summary with a name, extension, and content. This is a utility function for creating summary objects. ```go func CreateSummary(name, ext, content string) Summary ``` -------------------------------- ### NewVsphereProvider Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Creates a new Vsphere provider instance. ```APIDOC ## NewVsphereProvider ### Description Creates a new Vsphere provider. ### Signature ```go func NewVsphereProvider(_ map[string]string) Provider ``` ``` -------------------------------- ### ReplicasWatcher Interface Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/runtimeobjects An interface for watching and retrieving replica counts. Implementations must block on Start until a correct value is available. ```go type ReplicasWatcher interface { Replicas() int // Start must block until Replicas() returns a correct value. Start(stopCh <-chan struct{}) error } ``` ```go var rw ReplicasWatcher = (...) if err := rw.Start(stopCh); err != nil { panic(err); } // Get number of replicas as needed. val = rw.Replicas() ... val = rw.Replicas() ``` -------------------------------- ### ContainerResourceGatherer Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util/gatherers ContainerResourceGatherer is responsible for gathering resource metrics from containers. It provides methods to start, stop, and summarize the collected data. ```APIDOC ## func NewResourceUsageGatherer ### Description Creates a new instance of ContainerResourceGatherer. ### Signature ```go func NewResourceUsageGatherer(c clientset.Interface, host string, port int, provider provider.Provider, options ResourceGathererOptions, namespace string) (*ContainerResourceGatherer, error) ``` ### Parameters * **c** (clientset.Interface) - Kubernetes client interface. * **host** (string) - Hostname of the node. * **port** (int) - Port for the metrics endpoint. * **provider** (provider.Provider) - Provider interface for accessing node information. * **options** (ResourceGathererOptions) - Options for the resource gatherer. * **namespace** (string) - Namespace to gather metrics from. ### Returns * (*ContainerResourceGatherer) - A new instance of ContainerResourceGatherer. * (error) - An error if the gatherer could not be created. ``` ```APIDOC ## func (*ContainerResourceGatherer) Dispose ### Description Disposes of the container resource gatherer, releasing any resources it holds. ### Signature ```go func (g *ContainerResourceGatherer) Dispose() ``` ``` ```APIDOC ## func (*ContainerResourceGatherer) StartGatheringData ### Description Starts a stat gathering worker for each node. This method blocks until StopAndSummarize is called. ### Signature ```go func (g *ContainerResourceGatherer) StartGatheringData() ``` ``` ```APIDOC ## func (*ContainerResourceGatherer) StopAndSummarize ### Description Stops the stat gathering workers, processes the collected stats, generates a resource summary for the specified percentiles, and returns the summary. ### Signature ```go func (g *ContainerResourceGatherer) StopAndSummarize(percentiles []int) (*ResourceUsageSummary, error) ``` ### Parameters * **percentiles** ([]int) - A slice of integers representing the percentiles for which to generate the summary. ### Returns * (*ResourceUsageSummary) - A summary of resource usage per container. * (error) - An error if the stats could not be processed or summarized. ``` -------------------------------- ### ObjectStore Wrapper Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util A wrapper around cache.Store providing enhanced functionality for object management. ```go type ObjectStore struct { cache.Store Reflector *cache.Reflector // contains filtered or unexported fields } ``` -------------------------------- ### SkeletonProvider Method Signatures Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Method signatures for the SkeletonProvider type, demonstrating a basic implementation of the Provider interface. ```go func (p *SkeletonProvider) Features() *Features ``` ```go func (p *SkeletonProvider) GetComponentProtocolAndPort(componentName string) (string, int, error) ``` ```go func (p *SkeletonProvider) GetConfig() Config ``` ```go func (p *SkeletonProvider) GetManagedPrometheusClient() (prom.Client, error) ``` ```go func (p *SkeletonProvider) GetRootFrameworkKubeConfigOverride() string ``` ```go func (p *SkeletonProvider) Metadata(_ clientset.Interface) (map[string]string, error) ``` ```go func (p *SkeletonProvider) Name() string ``` ```go func (p *SkeletonProvider) RunSSHCommand(cmd, host string) (string, string, int, error) ``` -------------------------------- ### Compute Persistent Volumes Startup Status Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/measurement/util Computes the startup status for a group of Persistent Volumes. Use this to track the readiness of PVs. ```go func ComputePVsStartupStatus(PVs []*corev1.PersistentVolume, expected int) PVsStartupStatus ``` -------------------------------- ### Prometheus Controller Type Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/prometheus Represents a controller for managing the Prometheus stack within a cluster. It handles setup, teardown, and snapshotting. ```go type Controller struct { // contains filtered or unexported fields } ``` -------------------------------- ### LocalProvider GetConfig Source: https://pkg.go.dev/k8s.io/perf-tests/clusterloader2/pkg/provider Retrieves the configuration for the Local provider. ```go func (p *LocalProvider) GetConfig() Config ```