kubernetes

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinimumVersion = "1.26"
)

Variables

This section is empty.

Functions

func CheckForNodeWithE2ELabel added in v1.0.4

func CheckForNodeWithE2ELabel(ctx context.Context, k8s kubernetes.Interface, nodeName string) (*corev1.Node, error)

func CordonNode

func CordonNode(ctx context.Context, k8s kubernetes.Interface, node *corev1.Node, logger logr.Logger) error

func CreateNginxPodInNode

func CreateNginxPodInNode(ctx context.Context, k8s kubernetes.Interface, nodeName, namespace, region string, logger logr.Logger) error

func CreatePod added in v1.0.4

func CreatePod(ctx context.Context, k8s kubernetes.Interface, pod *corev1.Pod, logger logr.Logger) error

func DeleteNode

func DeleteNode(ctx context.Context, k8s kubernetes.Interface, name string) error

func DeletePod

func DeletePod(ctx context.Context, k8s kubernetes.Interface, name, namespace string) error

func DrainNode

func DrainNode(ctx context.Context, k8s kubernetes.Interface, node *corev1.Node) error

func EnsureNodeWithE2ELabelIsDeleted added in v1.0.4

func EnsureNodeWithE2ELabelIsDeleted(ctx context.Context, k8s kubernetes.Interface, nodeName string) error

func ExecPodWithRetries added in v1.0.2

func ExecPodWithRetries(ctx context.Context, config *restclient.Config, k8s kubernetes.Interface, name, namespace string, cmd ...string) (stdout, stderr string, err error)

Retries up to 5 times to avoid connection errors

func FetchLogs added in v1.0.6

func FetchLogs(ctx context.Context, k8s kubernetes.Interface, name, namespace string, options ...ik8s.ListOption) (string, error)

FetchLogs retrieves logs for all pods with the specified selectors and returns it in a single string.

func GetDaemonSet added in v1.0.2

func GetDaemonSet(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, namespace, name string) (*appsv1.DaemonSet, error)

func GetNginxPodName

func GetNginxPodName(name string) string

func GetNodeInternalIP added in v1.0.4

func GetNodeInternalIP(node *corev1.Node) string

func GetPodLogsWithRetries added in v1.0.2

func GetPodLogsWithRetries(ctx context.Context, k8s kubernetes.Interface, name, namespace string) (logs string, err error)

Retries up to 5 times to avoid connection errors

func IsPreviousVersionSupported

func IsPreviousVersionSupported(kubernetesVersion string) (bool, error)

func NetworkUnavailableCondition added in v1.0.5

func NetworkUnavailableCondition(node *corev1.Node) *corev1.NodeCondition

func NewServiceAccount added in v1.0.3

func NewServiceAccount(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, namespace, name string) error

func NodeNetworkAvailable added in v1.0.5

func NodeNetworkAvailable(node *corev1.Node) bool

NodeNetworkAvailable returns true if the node has a network available condition with status false. If the condition is not present, although technically this mean it might have the a network available, it returns false. Most CNI will set this condition to true whenever they finish their setup. In particular, Cilium and Calico do it.

func PreviousVersion

func PreviousVersion(kubernetesVersion string) (string, error)

func UncordonNode

func UncordonNode(ctx context.Context, k8s kubernetes.Interface, node *corev1.Node) error

func WaitForDaemonSetPodToBeRunning added in v1.0.4

func WaitForDaemonSetPodToBeRunning(ctx context.Context, k8s kubernetes.Interface, namespace, daemonSetName, nodeName string, logger logr.Logger) error

func WaitForHybridNodeToBeNotReady

func WaitForHybridNodeToBeNotReady(ctx context.Context, k8s kubernetes.Interface, nodeName string, logger logr.Logger) error

func WaitForHybridNodeToBeReady

func WaitForHybridNodeToBeReady(ctx context.Context, k8s kubernetes.Interface, nodeName string, logger logr.Logger) (*corev1.Node, error)

WaitForHybridNodeToBeReady will continue to poll until the node is: - marked ready - cilium-agent taint is removed (agent is ready on this node) - nodeNetworkAvailable is true - internal IP address is set

func WaitForNamespaceToBeDeleted added in v1.0.5

func WaitForNamespaceToBeDeleted(ctx context.Context, k8s kubernetes.Interface, name string) error

func WaitForNode

func WaitForNode(ctx context.Context, k8s kubernetes.Interface, nodeName string, logger logr.Logger) (*corev1.Node, error)

WaitForNode wait for the node to join the cluster and fetches the node info which has the nodeName label

func WaitForNodeToHaveVersion

func WaitForNodeToHaveVersion(ctx context.Context, k8s kubernetes.Interface, nodeName, targetVersion string, logger logr.Logger) (*corev1.Node, error)

func WaitForPodsToBeRunning added in v1.0.6

func WaitForPodsToBeRunning(ctx context.Context, k8s kubernetes.Interface, listOptions metav1.ListOptions, namespace string, logger logr.Logger) error

WaitForPodsToBeRunning waits until a pod is in running phase and all containers are ready.

Types

type ConformanceOption added in v1.0.5

type ConformanceOption func(*types.Configuration)

func WithOutputDir added in v1.0.5

func WithOutputDir(outputDir string) ConformanceOption

type ConformanceTest added in v1.0.5

type ConformanceTest struct {
	Namespace string
	// contains filtered or unexported fields
}

func NewConformanceTest added in v1.0.5

func NewConformanceTest(clientConfig *rest.Config, k8s *kubernetes.Clientset, logger logr.Logger, opts ...ConformanceOption) ConformanceTest

func (ConformanceTest) Cleanup added in v1.0.5

func (c ConformanceTest) Cleanup(ctx context.Context) error

func (ConformanceTest) CollectLogs added in v1.0.5

func (c ConformanceTest) CollectLogs(ctx context.Context) error

func (ConformanceTest) FetchExitCode added in v1.0.5

func (c ConformanceTest) FetchExitCode(ctx context.Context) (int, error)

func (ConformanceTest) Run added in v1.0.5

func (c ConformanceTest) Run(ctx context.Context) error

type VerifyNode

type VerifyNode struct {
	ClientConfig *rest.Config
	K8s          clientgo.Interface
	Logger       logr.Logger
	Region       string

	NodeName string
	NodeIP   string
}

VerifyNode checks that a node is healthy, can run pods, extract logs and run commands on them.

func (VerifyNode) Run

func (v VerifyNode) Run(ctx context.Context) error

func (VerifyNode) WaitForNodeReady added in v1.0.3

func (v VerifyNode) WaitForNodeReady(ctx context.Context) (*corev1.Node, error)

Jump to

Keyboard shortcuts

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