check

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package check contains the check functions to test the network commands.

Index

Constants

View Source
const MaxRetries = 10

MaxRetries is the maximum number of retries for the command.

Variables

This section is empty.

Functions

func ExecCurl

func ExecCurl(ctx context.Context, pod *corev1.Pod, clset *kubernetes.Clientset,
	cfg *rest.Config, quiet bool, endpoint string, logger *pterm.Logger) (ok bool, err error)

ExecCurl executes a curl command.

func ExecNetcatTCPConnect

func ExecNetcatTCPConnect(ctx context.Context, pod *corev1.Pod,
	clset *kubernetes.Clientset, cfg *rest.Config, quiet bool, endpoint string, logger *pterm.Logger) (ok bool, err error)

ExecNetcatTCPConnect executes a netcat command.

func ForgePodTargetForConsumer

func ForgePodTargetForConsumer(ctx context.Context, cl *client.Client, totalReplicas int32, target Targets) error

ForgePodTargetForConsumer creates a target for the consumer cluster.

func ForgePodTargetForProvider

func ForgePodTargetForProvider(ctx context.Context, cl *client.Client, name string, totalReplicas int32, target Targets) error

ForgePodTargetForProvider creates a target for a specific cluster.

func GetLocalIPRemapped

func GetLocalIPRemapped(ctx context.Context, cl *client.Client) (map[string]string, error)

GetLocalIPRemapped gets the local IP remapped for the consumer and the providers.

func GetNodeAddress

func GetNodeAddress(node *corev1.Node) string

GetNodeAddress returns the address of the node.

func InitClientSet

func InitClientSet(cfg *rest.Config) (*kubernetes.Clientset, error)

InitClientSet initializes the clientset.

func PrintCheckResults

func PrintCheckResults(successCount, errorCount int32, logger *pterm.Logger)

PrintCheckResults prints the check results.

func RunCheckExternalToNodePortServiceWithClient

func RunCheckExternalToNodePortServiceWithClient(ctx context.Context, cl ctrlclient.Client,
	opts *flags.Options, totreplicas int32, httpclient *client.HTTPClient) (successCount, errorCount int32, err error)

RunCheckExternalToNodePortServiceWithClient runs all the checks from the external to the node port service.

func RunCheckPodToClusterIPService

func RunCheckPodToClusterIPService(ctx context.Context, cl *client.Client, cfg client.Configs, opts *flags.Options,
	totreplicas int32) (successCount, errorCount int32, err error)

RunCheckPodToClusterIPService runs all the checks from the pod to the cluster IP service.

func RunCheckToTargets

func RunCheckToTargets(ctx context.Context, cl ctrlclient.Client, cfg *rest.Config, opts *flags.Options,
	owner string, targets []string, hostnetwork bool, execFunc ExecFunc) (successCount, errorCount int32, err error)

RunCheckToTargets runs the checks to the targets.

func RunChecks

func RunChecks(ctx context.Context, cl *client.Client, cfg client.Configs, opts *flags.Options, totreplicas int32) error

RunChecks runs all the checks.

func RunChecksNodeToPod

func RunChecksNodeToPod(ctx context.Context, cl *client.Client, cfg client.Configs, opts *flags.Options,
	totreplicas int32) (successCount, errorCount int32, err error)

RunChecksNodeToPod runs the checks from the nodes to the pods.

func RunChecksPodToExternal

func RunChecksPodToExternal(ctx context.Context, cl *client.Client,
	cfg client.Configs, opts *flags.Options) (successCount, errorCount int32, err error)

RunChecksPodToExternal runs the checks from pod to an external target.

func RunChecksPodToExternalRemappedIP

func RunChecksPodToExternalRemappedIP(ctx context.Context, cl *client.Client,
	cfg client.Configs, opts *flags.Options) (successCount, errorCount int32, err error)

RunChecksPodToExternalRemappedIP runs all the checks from the pod to the external remapped IP.

func RunChecksPodToPod

func RunChecksPodToPod(ctx context.Context, cl *client.Client, cfg client.Configs, opts *flags.Options,
	totreplicas int32) (successCount, errorCount int32, err error)

RunChecksPodToPod runs the checks from the pods to the pods.

func RunsCheckExternalToLoadBalancerService

func RunsCheckExternalToLoadBalancerService(ctx context.Context, cl *client.Client, opts *flags.Options,
	totreplicas int32) (successCountTot, errorCountTot int32, err error)

RunsCheckExternalToLoadBalancerService runs all the checks from the external to the load balancer service.

func RunsCheckExternalToLoadBalancerServiceWithClient

func RunsCheckExternalToLoadBalancerServiceWithClient(ctx context.Context, cl ctrlclient.Client,
	opts *flags.Options, httpclient *client.HTTPClient, totreplicas int32) (successCount, errorCount int32, err error)

RunsCheckExternalToLoadBalancerServiceWithClient runs all the checks from the external to the load balancer service.

func RunsCheckExternalToNodePortService

func RunsCheckExternalToNodePortService(ctx context.Context, cl *client.Client, opts *flags.Options,
	totreplicas int32) (successCountTot, errorCountTot int32, err error)

RunsCheckExternalToNodePortService runs all the checks from the external to the node port service.

func RunsCheckPodToNodePortService

func RunsCheckPodToNodePortService(ctx context.Context, cl *client.Client, cfg client.Configs, opts *flags.Options,
	totreplicas int32) (successCountTot, errorCountTot int32, err error)

RunsCheckPodToNodePortService runs all the checks from the pod to the node port service.

func RunsCheckPodToNodePortServiceWithClient

func RunsCheckPodToNodePortServiceWithClient(ctx context.Context, cl ctrlclient.Client, cfg client.Configs, opts *flags.Options,
	totreplicas int32, name string) (successCount, errorCount int32, err error)

RunsCheckPodToNodePortServiceWithClient runs all the checks from the pod to the node port service.

Types

type ExecFunc

type ExecFunc func(ctx context.Context, pod *corev1.Pod, clset *kubernetes.Clientset,
	cfg *rest.Config, quiet bool, endpoint string, logger *pterm.Logger) (ok bool, err error)

ExecFunc is the function to execute.

type Targets

type Targets map[string][]string

Targets ia a map where the key is the name of the provider/consumer and the values are the endpoints from their point of view.

func ForgeIPTargets

func ForgeIPTargets(ctx context.Context, cl *client.Client) (Targets, error)

ForgeIPTargets forges the IP targets for the consumer and the providers.

func ForgePodTargets

func ForgePodTargets(ctx context.Context, cl *client.Client, totalReplicas int32) (Targets, error)

ForgePodTargets creates a map of targets for the pod-to-pod tests.

Jump to

Keyboard shortcuts

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