util

package
v0.0.0-...-062dba2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The default master profile.  See: assets/tuned/manifests/default-cr-tuned.yaml
	DefaultMasterProfile = "openshift-control-plane"
	// The default worker profile.  See: assets/tuned/manifests/default-cr-tuned.yaml
	DefaultWorkerProfile = "openshift-node"
)
View Source
const (
	VerificationCommandAnnotation = "verificationCommand"
	VerificationOutputAnnotation  = "verificationOutput"
)

Variables

This section is empty.

Functions

func ExecAndLogCommand

func ExecAndLogCommand(name string, args ...string) (bytes.Buffer, bytes.Buffer, error)

ExecAndLogCommand executes command 'name' with arguments 'args' and logs the output. Returns captured standard output, standard error and the error returned.

func ExecCmdInPod

func ExecCmdInPod(pod *corev1.Pod, cmd ...string) (string, error)

ExecCmdInPod executes command with arguments 'cmd' in Pod 'pod'.

func ExecCmdInPodNamespace

func ExecCmdInPodNamespace(podNamespace, podName string, cmd ...string) (string, error)

ExecCmdInPodNamespace executes command with arguments 'cmd' in Pod 'podNamespace/podName'.

func GetClusterControlPlaneTopology

func GetClusterControlPlaneTopology(cs *framework.ClientSet) (configv1.TopologyMode, error)

GetClusterControlPlaneTopology returns infrastructures/cluster objects's ControlPlaneTopology status field and an error if any. It is HighlyAvailable on regular clusters, SingleReplica on SNO and External on HyperShift.

func GetClusterNodes

func GetClusterNodes(cs *framework.ClientSet) (int, error)

GetClusterNodes returns the number of cluster nodes and an error if any.

func GetCurrentDirPath

func GetCurrentDirPath() (string, error)

func GetDefaultWorkerProfile

func GetDefaultWorkerProfile(node *corev1.Node) string

GetDefaultWorkerProfile returns name of the default out-of-the-box TuneD profile for a node. See: assets/tuned/manifests/default-cr-tuned.yaml

func GetMachineConfigDaemonForNode

func GetMachineConfigDaemonForNode(cs *framework.ClientSet, node *corev1.Node) (*corev1.Pod, error)

GetMachineConfigDaemonForNode returns the machine-config-daemon pod that runs on the specified node

func GetNodeTuningOperatorPod

func GetNodeTuningOperatorPod(cs *framework.ClientSet) (*corev1.Pod, error)

GetNodeTuningOperator returns the node tuning operator Pod. If more than one operator Pod is running will return the first Pod found.

func GetNodesByRole

func GetNodesByRole(cs *framework.ClientSet, role string) ([]corev1.Node, error)

GetNodesByRole returns a list of nodes that match a given role.

func GetTunedForNode

func GetTunedForNode(cs *framework.ClientSet, node *corev1.Node) (*corev1.Pod, error)

GetTunedForNode returns a Pod that runs on a given node.

func GetUpdatedMachineCountForPool

func GetUpdatedMachineCountForPool(cs *framework.ClientSet, pool string) (int32, error)

GetUpdatedMachineCountForPool returns the UpdatedMachineCount for MCP 'pool'.

func LoadTuned

func LoadTuned(path string) (*tunedv1.Tuned, error)

func Logf

func Logf(format string, args ...interface{}) (n int, err error)

Logf formats using the default formats for its operands and writes to ginkgo.GinkgoWriter and a newline is appended. It returns the number of bytes written and any write error encountered.

func WaitForClusterOperatorConditionReason

func WaitForClusterOperatorConditionReason(cs *framework.ClientSet, interval, duration time.Duration,
	conditionType configv1.ClusterStatusConditionType, conditionReason string) error

WaitForClusterOperatorConditionReason blocks until the NTO ClusterOperator condition 'conditionType' Reason is equal to the value of 'conditionReason'. The execution interval to check the value is 'interval' and retries last for at most the duration 'duration'.

func WaitForClusterOperatorConditionStatus

func WaitForClusterOperatorConditionStatus(cs *framework.ClientSet, interval, duration time.Duration,
	conditionType configv1.ClusterStatusConditionType, conditionStatus configv1.ConditionStatus) error

WaitForClusterOperatorConditionStatus blocks until the NTO ClusterOperator condition 'conditionType' Status is equal to the value of 'conditionStatus'. The execution interval to check the value is 'interval' and retries last for at most the duration 'duration'.

func WaitForCmdInPod

func WaitForCmdInPod(interval, duration time.Duration, pod *corev1.Pod, cmd ...string) (string, error)

WaitForCmdInPod runs command with arguments 'cmd' in Pod 'pod' at an interval 'interval' and retries for at most the duration 'duration'. The function returns the retrieved value of standard output of the command at its first successful ('error' == nil) execution and an error set in case the command did not run successfully by the time duration 'duration' elapsed.

func WaitForCmdOutputInPod

func WaitForCmdOutputInPod(interval, duration time.Duration, pod *corev1.Pod, valExp string, trim bool, cmd ...string) (string, error)

WaitForCmdOutputInPod runs command with arguments 'cmd' in Pod 'pod' at an interval 'interval' and retries for at most the duration 'duration' expecting standard output of the command with leading and trailing whitespace optionally ('trim') trimmed to match 'valExp'. The function returns the retrieved value and an error in case the values did not match by the time duration 'duration' elapsed.

func WaitForPoolMachineCount

func WaitForPoolMachineCount(cs *framework.ClientSet, pool string, count int32) error

WaitForPoolMachineCount polls a pool until its machineCount equals to 'count'.

func WaitForPoolUpdatedMachineCount

func WaitForPoolUpdatedMachineCount(cs *framework.ClientSet, pool string, count int32) error

WaitForPoolUpdatedMachineCount polls a pool until its UpdatedMachineCount equals to 'count'.

func WaitForProfileConditionStatus

func WaitForProfileConditionStatus(cs *framework.ClientSet, interval, duration time.Duration, profile string, profileExpect string,
	conditionType tunedv1.ProfileConditionType, conditionStatus corev1.ConditionStatus) error

WaitForProfileConditionStatus blocks until Profile with name `profile` is reporting its `conditionType` with the value of 'conditionStatus', for the TuneD profile `profileExpect`. The execution interval to check the value is 'interval' and retries last for at most the duration 'duration'.

func WaitForSysctlInPod

func WaitForSysctlInPod(interval, duration time.Duration, pod *corev1.Pod, sysctlVar string) (string, error)

WaitForSysctlInPod waits for a successful ('error' == nil) output of the "sysctl -n 'sysctlVar'" command inside Pod 'pod'. The execution interval is 'interval' and retries last for at most the duration 'duration'. Returns the sysctl value retrieved with leading and trailing whitespace removed and an error during the command execution.

func WaitForSysctlValueInPod

func WaitForSysctlValueInPod(interval, duration time.Duration, pod *corev1.Pod, sysctlVar string, valExp string) (string, error)

WaitForSysctlValueInPod blocks until the sysctl value for 'sysctlVar' from inside Pod 'pod' is equal to 'valExp'. The execution interval to check the value is 'interval' and retries last for at most the duration 'duration'. Returns the sysctl value retrieved and an error during the last command execution.

Types

type VerificationData

type VerificationData struct {
	OutputCurrent  string
	OutputExpected string
	CommandArgs    []string
	TargetTunedPod *corev1.Pod
}

func MustExtractVerificationOutputAndCommand

func MustExtractVerificationOutputAndCommand(cs *framework.ClientSet, targetNode *corev1.Node, tuned *tunedv1.Tuned) VerificationData

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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