utils

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EKSIdleNodepoolInstanceType is the instance type of idle nodepool.
	//
	// NOTE: The EKS cloud provider will delete all the NOT-READY nodes
	// which aren't managed by it. When kwok-controller fails to update
	// virtual node's lease, the EKS cloud provider would delete that
	// virtual node. It's unexpected behavior. In order to avoid this case,
	// we should create a idle nodepool with one node and use that node's
	// provider ID for all the virtual nodes so that EKS cloud provider
	// won't delete our virtual nodes.
	EKSIdleNodepoolInstanceType = "m4.large"

	// EKSRunnerNodepoolInstanceType is the instance type of nodes for kperf
	// runners.
	//
	// NOTE: This is default type. Please align it with ../manifests/loadprofile/ekswarmup.yaml.
	EKSRunnerNodepoolInstanceType = "m4.4xlarge"
)

Functions

func BuildClientset added in v0.1.0

func BuildClientset(kubeCfgPath string) (*kubernetes.Clientset, error)

BuildClientset returns kubernetes clientset.

func CreateTempFileWithContent

func CreateTempFileWithContent(data []byte) (_name string, _cleanup func() error, retErr error)

CreateTempFileWithContent creates temporary file with data.

func DeployAndRepeatRollingUpdateDeployments added in v0.1.0

func DeployAndRepeatRollingUpdateDeployments(
	ctx context.Context,
	kubeCfgPath string,
	releaseName string,
	total, replica, paddingBytes int,
	internal time.Duration,
) (rollingUpdateFn, cleanupFn func(), retErr error)

DeployAndRepeatRollingUpdateDeployments deploys and repeats to rolling-update deployments.

func DeployRunnerGroup

func DeployRunnerGroup(ctx context.Context,
	kubeCfgPath, runnerImage, rgCfgFile string,
	runnerFlowControl, runnerGroupAffinity string) (*types.RunnerGroupsReport, error)

DeployRunnerGroup deploys runner group for benchmark.

func FetchAPIServerCores

func FetchAPIServerCores(ctx context.Context, kubeCfgPath string) (map[string]int, error)

FetchAPIServerCores fetchs core number for each kube-apiserver.

func FetchNodeProviderIDByType

func FetchNodeProviderIDByType(ctx context.Context, kubeCfgPath string, instanceType string) (string, error)

FetchNodeProviderIDByType is used to get one node's provider id with a given instance type.

func NSLookup

func NSLookup(domainURL string) ([]string, error)

NSLookup returns ips for URL.

func NewLoadProfileFromEmbed

func NewLoadProfileFromEmbed(target string, tweakFn func(*types.RunnerGroupSpec) error) (_name string, _cleanup func() error, _ error)

NewLoadProfileFromEmbed reads load profile from embed memory.

func RepeatJobWithPod added in v0.1.3

func RepeatJobWithPod(ctx context.Context, kubeCfgPath string, namespace string, target string, internal time.Duration)

RepeatJobWithPod repeats to deploy 3k pods.

Types

type KperfRunner

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

KperfRunner is the wrapper of exec.Command to execute kperf command.

func NewKperfRunner

func NewKperfRunner(kubeCfgPath string, runnerImage string) *KperfRunner

func (*KperfRunner) DeleteNodepool

func (kr *KperfRunner) DeleteNodepool(ctx context.Context, timeout time.Duration, name string) error

DeleteNodepool deletes a virtual nodepool by a given name.

func (*KperfRunner) NewNodepool

func (kr *KperfRunner) NewNodepool(
	ctx context.Context,
	timeout time.Duration,
	name string, nodes int, cpu, memory, maxPods int,
	affinity string,
	sharedProviderID string,
) error

NewNodepool creates new virtual nodepool.

func (*KperfRunner) RGDelete

func (kr *KperfRunner) RGDelete(ctx context.Context, timeout time.Duration) error

RGDelete deletes runner group.

func (*KperfRunner) RGResult

func (kr *KperfRunner) RGResult(ctx context.Context, timeout time.Duration) (string, error)

RGResult fetches runner group's result.

func (*KperfRunner) RGRun

func (kr *KperfRunner) RGRun(ctx context.Context, timeout time.Duration, rgCfgPath, flowcontrol, affinity string) error

RGRun deploys runner group into kubernetes cluster.

type KubectlRunner

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

KubectlRunner is the wrapper of exec.Command to execute kubectl command.

func NewKubectlRunner

func NewKubectlRunner(kubeCfgPath string, namespace string) *KubectlRunner

func (*KubectlRunner) Apply

func (kr *KubectlRunner) Apply(ctx context.Context, timeout time.Duration, filePath string) error

Apply runs apply subcommand.

func (*KubectlRunner) CreateNamespace

func (kr *KubectlRunner) CreateNamespace(ctx context.Context, timeout time.Duration, name string) error

CreateNamespace creates a new namespace.

func (*KubectlRunner) Delete

func (kr *KubectlRunner) Delete(ctx context.Context, timeout time.Duration, filePath string) error

Delete runs delete subcommand.

func (*KubectlRunner) DeleteNamespace

func (kr *KubectlRunner) DeleteNamespace(ctx context.Context, timeout time.Duration, name string) error

DeleteNamespace delete a namespace.

func (*KubectlRunner) DeploymentRestart added in v0.0.9

func (kr *KubectlRunner) DeploymentRestart(ctx context.Context, timeout time.Duration, name string) error

DeploymentRestart restats a deployment.

func (*KubectlRunner) DeploymentRolloutStatus added in v0.0.9

func (kr *KubectlRunner) DeploymentRolloutStatus(ctx context.Context, timeout time.Duration, name string) error

DeploymentRolloutStatus watches the rollout status of a deployment.

func (*KubectlRunner) FQDN

func (kr *KubectlRunner) FQDN(ctx context.Context, timeout time.Duration) (string, error)

FQDN returns the FQDN of the cluster.

func (*KubectlRunner) Metrics

func (kr *KubectlRunner) Metrics(ctx context.Context, timeout time.Duration, fqdn, ip string) ([]byte, error)

Metrics returns the metrics for a specific kube-apiserver.

func (*KubectlRunner) Wait

func (kr *KubectlRunner) Wait(ctx context.Context, timeout time.Duration, condition, waitTimeout, target string) error

Wait runs wait subcommand.

Jump to

Keyboard shortcuts

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