Documentation
¶
Index ¶
- Constants
- func CSIVolumeHandleFromPVC(ctx context.Context, k8s kubernetes.Interface, namespace, pvcName string) (string, error)
- func CheckForNodeWithE2ELabel(ctx context.Context, k8s kubernetes.Interface, nodeName string) (*corev1.Node, error)
- func CheckNamespaceExists(ctx context.Context, k8s kubernetes.Interface, namespace string) error
- func ConfigureCoreDNSAntiAffinity(ctx context.Context, k8s kubernetes.Interface, logger logr.Logger) error
- func ConfigureKubeDNSTrafficDistribution(ctx context.Context, k8s kubernetes.Interface, logger logr.Logger) error
- func CordonNode(ctx context.Context, k8s kubernetes.Interface, node *corev1.Node, ...) error
- func CountCoreDNSDistribution(ctx context.Context, k8s kubernetes.Interface, pods *corev1.PodList, ...) (hybridCount, cloudCount int)
- func CreateDeployment(ctx context.Context, k8s kubernetes.Interface, name, namespace, region string, ...) (*appsv1.Deployment, error)
- func CreateNamespace(ctx context.Context, k8s kubernetes.Interface, namespace string) error
- func CreateNginxPodInNode(ctx context.Context, k8s kubernetes.Interface, ...) error
- func CreatePod(ctx context.Context, k8s kubernetes.Interface, pod *corev1.Pod, ...) error
- func CreateResourceFromYAML(ctx context.Context, logger logr.Logger, dynamicClient dynamic.Interface, ...) (*unstructured.Unstructured, error)
- func CreateService(ctx context.Context, k8s kubernetes.Interface, name, namespace string, ...) (*corev1.Service, error)
- func DaemonSetWaitForReady(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, ...) error
- func DeleteDeploymentAndWait(ctx context.Context, k8s kubernetes.Interface, ...) error
- func DeleteDeploymentsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string, ...) error
- func DeleteManifestsWithRetries(ctx context.Context, k8s dynamic.Interface, ...) error
- func DeleteNamespace(ctx context.Context, k8s kubernetes.Interface, namespace string) error
- func DeleteNode(ctx context.Context, k8s kubernetes.Interface, name string) error
- func DeletePod(ctx context.Context, k8s kubernetes.Interface, name, namespace string) error
- func DeletePodsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string, ...) error
- func DeleteResource(ctx context.Context, logger logr.Logger, dynamicClient dynamic.Interface, ...) error
- func DeleteServiceAndWait(ctx context.Context, k8s kubernetes.Interface, serviceName, namespace string, ...) error
- func DeleteServicesWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string, ...) error
- func DeploymentWaitForReplicas(ctx context.Context, timeout time.Duration, k8s kubernetes.Interface, ...) error
- func DrainNode(ctx context.Context, k8s kubernetes.Interface, node *corev1.Node) error
- func EnsureNodeWithE2ELabelIsDeleted(ctx context.Context, k8s kubernetes.Interface, nodeName string) error
- func ExecPodWithRetries(ctx context.Context, config *restclient.Config, k8s kubernetes.Interface, ...) (stdout, stderr string, err error)
- func FetchLogs(ctx context.Context, k8s kubernetes.Interface, name, namespace string, ...) (string, error)
- func FindNodeWithLabel(ctx context.Context, k8s kubernetes.Interface, labelKey, labelValue string, ...) (string, error)
- func GetDaemonSet(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, ...) (*appsv1.DaemonSet, error)
- func GetNginxPodName(name string) string
- func GetNodeInternalIP(node *corev1.Node) string
- func GetPodLogsWithRetries(ctx context.Context, k8s kubernetes.Interface, name, namespace string) (logs string, err error)
- func IsPreviousVersionSupported(kubernetesVersion string) (bool, error)
- func LabelHybridNodesForTopology(ctx context.Context, k8s kubernetes.Interface, logger logr.Logger) error
- func ListDeploymentsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string) (*appsv1.DeploymentList, error)
- func ListNodesWithLabels(ctx context.Context, k8s kubernetes.Interface, labelSelector string) (*corev1.NodeList, error)
- func ListPodsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string) (*corev1.PodList, error)
- func ListServicesWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string) (*corev1.ServiceList, error)
- func NetworkUnavailableCondition(node *corev1.Node) *corev1.NodeCondition
- func NewServiceAccount(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, ...) error
- func NodeNetworkAvailable(node *corev1.Node) bool
- func PatchNode(ctx context.Context, k8s kubernetes.Interface, nodeName string, ...) error
- func PreviousVersion(kubernetesVersion string) (string, error)
- func RemoveDaemonSetAntiAffinity(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, ...) error
- func RemoveDeploymentAntiAffinity(ctx context.Context, k8s kubernetes.Interface, name, namespace string, ...) error
- func TestPodToPodConnectivity(ctx context.Context, config *restclient.Config, k8s kubernetes.Interface, ...) error
- func TestServiceConnectivityWithRetries(ctx context.Context, config *restclient.Config, k8s kubernetes.Interface, ...) error
- func UncordonNode(ctx context.Context, k8s kubernetes.Interface, node *corev1.Node) error
- func UpsertManifestsWithRetries(ctx context.Context, k8s dynamic.Interface, ...) error
- func VerifyCoreDNSDistribution(ctx context.Context, k8s kubernetes.Interface, timeout time.Duration, ...) error
- func WaitForDaemonSetPodToBeRunning(ctx context.Context, k8s kubernetes.Interface, ...) error
- func WaitForHybridNodeToBeNotReady(ctx context.Context, k8s kubernetes.Interface, nodeName string, ...) error
- func WaitForHybridNodeToBeReady(ctx context.Context, k8s kubernetes.Interface, nodeName string, ...) (*corev1.Node, error)
- func WaitForNamespaceToBeDeleted(ctx context.Context, k8s kubernetes.Interface, name string) error
- func WaitForNode(ctx context.Context, k8s kubernetes.Interface, nodeName string, ...) (*corev1.Node, error)
- func WaitForNodeToHaveVersion(ctx context.Context, k8s kubernetes.Interface, nodeName, targetVersion string, ...) (*corev1.Node, error)
- func WaitForPodToBeCompleted(ctx context.Context, k8s kubernetes.Interface, name, namespace string) error
- func WaitForPodsToBeRunning(ctx context.Context, k8s kubernetes.Interface, listOptions metav1.ListOptions, ...) error
- func WaitForPodsToBeRunningWithTimeout(ctx context.Context, k8s kubernetes.Interface, listOptions metav1.ListOptions, ...) error
- func WaitForServiceReady(ctx context.Context, k8s kubernetes.Interface, serviceName, namespace string, ...) error
- func YamlToUnstructured(rawyaml []byte) ([]unstructured.Unstructured, error)
- type ConformanceOption
- type ConformanceTest
- type VerifyNode
Constants ¶
const (
MaxCoreDNSRedistributionAttempts = 5
)
const (
MinimumVersion = "1.30"
)
Variables ¶
This section is empty.
Functions ¶
func CSIVolumeHandleFromPVC ¶ added in v1.0.18
func CSIVolumeHandleFromPVC(ctx context.Context, k8s kubernetes.Interface, namespace, pvcName string) (string, error)
CSIVolumeHandleFromPVC returns the CSI volume handle for the PV bound to the given PVC.
func CheckForNodeWithE2ELabel ¶ added in v1.0.4
func CheckNamespaceExists ¶ added in v1.0.11
CheckNamespaceExists checks if a namespace exists
func ConfigureCoreDNSAntiAffinity ¶ added in v1.0.11
func ConfigureCoreDNSAntiAffinity(ctx context.Context, k8s kubernetes.Interface, logger logr.Logger) error
ConfigureCoreDNSAntiAffinity configures CoreDNS deployment with preferred anti-affinity rules
func ConfigureKubeDNSTrafficDistribution ¶ added in v1.0.11
func ConfigureKubeDNSTrafficDistribution(ctx context.Context, k8s kubernetes.Interface, logger logr.Logger) error
ConfigureKubeDNSTrafficDistribution configures kube-dns service for traffic distribution
func CordonNode ¶
func CountCoreDNSDistribution ¶ added in v1.0.11
func CountCoreDNSDistribution(ctx context.Context, k8s kubernetes.Interface, pods *corev1.PodList, logger logr.Logger) (hybridCount, cloudCount int)
CountCoreDNSDistribution returns count of CoreDNS pods on hybrid vs cloud nodes
func CreateDeployment ¶ added in v1.0.10
func CreateDeployment( ctx context.Context, k8s kubernetes.Interface, name, namespace, region string, nodeSelector map[string]string, targetPort int32, replicas int32, logger logr.Logger, dnsSuffix, ecrAccount string, additionalLabels ...map[string]string, ) (*appsv1.Deployment, error)
CreateDeployment creates a deployment with the specified configuration
func CreateNamespace ¶ added in v1.0.8
func CreateNginxPodInNode ¶
func CreateResourceFromYAML ¶ added in v1.0.15
func CreateResourceFromYAML(ctx context.Context, logger logr.Logger, dynamicClient dynamic.Interface, yamlContent string) (*unstructured.Unstructured, error)
CreateResourceFromYAML creates a Kubernetes resource from YAML content
func CreateService ¶ added in v1.0.10
func CreateService( ctx context.Context, k8s kubernetes.Interface, name, namespace string, selector map[string]string, servicePort, targetPort int32, logger logr.Logger, additionalLabels ...map[string]string, ) (*corev1.Service, error)
CreateService creates a service with the specified configuration
func DaemonSetWaitForReady ¶ added in v1.0.8
func DeleteDeploymentAndWait ¶ added in v1.0.10
func DeleteDeploymentAndWait(ctx context.Context, k8s kubernetes.Interface, deploymentName, namespace string, logger logr.Logger) error
DeleteDeploymentAndWait deletes a deployment and waits for it to be fully removed
func DeleteDeploymentsWithLabels ¶ added in v1.0.10
func DeleteDeploymentsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string, logger logr.Logger) error
DeleteDeploymentsWithLabels deletes all deployments in a namespace that match the given label selector
func DeleteManifestsWithRetries ¶ added in v1.0.7
func DeleteManifestsWithRetries(ctx context.Context, k8s dynamic.Interface, manifests []unstructured.Unstructured) error
func DeleteNamespace ¶ added in v1.0.8
func DeleteNode ¶
func DeletePodsWithLabels ¶ added in v1.0.10
func DeletePodsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string, logger logr.Logger) error
DeletePodsWithLabels deletes all pods in a namespace that match the given label selector
func DeleteResource ¶ added in v1.0.15
func DeleteResource(ctx context.Context, logger logr.Logger, dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace, name string) error
DeleteResource deletes a Kubernetes resource
func DeleteServiceAndWait ¶ added in v1.0.10
func DeleteServiceAndWait(ctx context.Context, k8s kubernetes.Interface, serviceName, namespace string, logger logr.Logger) error
DeleteServiceAndWait deletes a service and waits for it to be fully removed
func DeleteServicesWithLabels ¶ added in v1.0.10
func DeleteServicesWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string, logger logr.Logger) error
DeleteServicesWithLabels deletes all services in a namespace that match the given label selector
func DeploymentWaitForReplicas ¶ added in v1.0.7
func EnsureNodeWithE2ELabelIsDeleted ¶ added in v1.0.4
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 FindNodeWithLabel ¶ added in v1.0.10
func FindNodeWithLabel(ctx context.Context, k8s kubernetes.Interface, labelKey, labelValue string, logger logr.Logger) (string, error)
FindNodeWithLabel finds a node that has the specified label key-value pair
func GetDaemonSet ¶ added in v1.0.2
func GetDaemonSet(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, namespace, name string) (*appsv1.DaemonSet, error)
GetDaemonSet returns a daemonset by name in a specific namespace It will wait for the daemonset to exist up to 3 minutes
func GetNginxPodName ¶
func GetNodeInternalIP ¶ added in v1.0.4
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 LabelHybridNodesForTopology ¶ added in v1.0.11
func LabelHybridNodesForTopology(ctx context.Context, k8s kubernetes.Interface, logger logr.Logger) error
LabelHybridNodesForTopology adds topology.kubernetes.io/zone=onprem label to hybrid nodes
func ListDeploymentsWithLabels ¶ added in v1.0.10
func ListDeploymentsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string) (*appsv1.DeploymentList, error)
ListDeploymentsWithLabels lists deployments in a namespace that match the given label selector
func ListNodesWithLabels ¶ added in v1.0.10
func ListNodesWithLabels(ctx context.Context, k8s kubernetes.Interface, labelSelector string) (*corev1.NodeList, error)
ListNodesWithLabels lists nodes that match the given label selector using robust retry
func ListPodsWithLabels ¶ added in v1.0.10
func ListPodsWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string) (*corev1.PodList, error)
ListPodsWithLabels lists pods in a namespace that match the given label selector
func ListServicesWithLabels ¶ added in v1.0.10
func ListServicesWithLabels(ctx context.Context, k8s kubernetes.Interface, namespace, labelSelector string) (*corev1.ServiceList, error)
ListServicesWithLabels lists services in a namespace that match the given label selector
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
NewServiceAccount creates a new service account in the given namespace, if it does not already exist.
func NodeNetworkAvailable ¶ added in v1.0.5
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 PatchNode ¶ added in v1.0.10
func PatchNode(ctx context.Context, k8s kubernetes.Interface, nodeName string, patchData []byte, logger logr.Logger) error
PatchNode patches a node with the given patch data
func PreviousVersion ¶
func RemoveDaemonSetAntiAffinity ¶ added in v1.0.13
func RemoveDaemonSetAntiAffinity(ctx context.Context, logger logr.Logger, k8s kubernetes.Interface, namespace, name string) error
RemoveDaemonSetAntiAffinity removes node affinity rules from a daemonset that would prevent pods from being scheduled on hybrid nodes. This is useful to test EKS add-on before anti-affinity rule for hybrid nodes is removed. Once anti-affinity rule is removed, then caller no longer needs to call this method.
func RemoveDeploymentAntiAffinity ¶ added in v1.0.13
func RemoveDeploymentAntiAffinity(ctx context.Context, k8s kubernetes.Interface, name, namespace string, logger logr.Logger) error
RemoveDeploymentAntiAffinity removes node affinity rules from a deployment that would prevent pods from being scheduled on hybrid nodes. This is useful to test EKS add-on before anti-affinity rule for hybrid nodes is removed. Once anti-affinity rule is removed, then caller no longer needs to call this method.
func TestPodToPodConnectivity ¶ added in v1.0.10
func TestPodToPodConnectivity(ctx context.Context, config *restclient.Config, k8s kubernetes.Interface, clientPodName, targetPodName, namespace string, logger logr.Logger) error
TestPodToPodConnectivity tests direct pod-to-pod connectivity using HTTP
func TestServiceConnectivityWithRetries ¶ added in v1.0.10
func TestServiceConnectivityWithRetries(ctx context.Context, config *restclient.Config, k8s kubernetes.Interface, clientPodName, serviceName, namespace string, port int32, logger logr.Logger) error
TestServiceConnectivityWithRetries tests service connectivity using short name with 5-minute retry window
func UncordonNode ¶
func UpsertManifestsWithRetries ¶ added in v1.0.7
func UpsertManifestsWithRetries(ctx context.Context, k8s dynamic.Interface, manifests []unstructured.Unstructured) error
Creates, or Updates existing CR, foreach manifest Retries each up to 5 times
func VerifyCoreDNSDistribution ¶ added in v1.0.11
func VerifyCoreDNSDistribution(ctx context.Context, k8s kubernetes.Interface, timeout time.Duration, maxDeletions int, logger logr.Logger) error
VerifyCoreDNSDistribution waits for CoreDNS pods to be distributed across node types
func WaitForDaemonSetPodToBeRunning ¶ added in v1.0.4
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
WaitForNamespaceToBeDeleted waits for a namespace to be deleted up to 3 minutes
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 WaitForPodToBeCompleted ¶ added in v1.0.10
func WaitForPodToBeCompleted(ctx context.Context, k8s kubernetes.Interface, name, namespace string) error
WaitForPodToBeCompleted waits until the pod is in Completed phase.
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 with default timeout.
func WaitForPodsToBeRunningWithTimeout ¶ added in v1.0.14
func WaitForPodsToBeRunningWithTimeout(ctx context.Context, k8s kubernetes.Interface, listOptions metav1.ListOptions, namespace string, logger logr.Logger, timeout time.Duration) error
WaitForPodsToBeRunningWithTimeout waits until a pod is in running phase and all containers are ready. It will return an error if any of the pods have already exited.
func WaitForServiceReady ¶ added in v1.0.10
func WaitForServiceReady(ctx context.Context, k8s kubernetes.Interface, serviceName, namespace string, logger logr.Logger) error
WaitForServiceReady waits for service endpoints to be ready
func YamlToUnstructured ¶ added in v1.0.7
func YamlToUnstructured(rawyaml []byte) ([]unstructured.Unstructured, error)
YamlToUnstructured takes a YAML and converts it to a list of Unstructured objects.
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)
type VerifyNode ¶
type VerifyNode struct {
ClientConfig *rest.Config
K8s clientgo.Interface
Logger logr.Logger
Region string
DNSSuffix string
EcrAccount string
NodeName string
NodeIP string
}
VerifyNode checks that a node is healthy, can run pods, extract logs and run commands on them.