kubernetes

package
v1.5.17 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DelegatedSubnetIDLabel = "kubernetes.azure.com/podnetwork-delegationguid"
	SubnetNameLabel        = "kubernetes.azure.com/podnetwork-subnet"

	// RetryAttempts is the number of times to retry a test.
	RetryAttempts       = 90
	RetryDelay          = 10 * time.Second
	DeleteRetryAttempts = 12
	DeleteRetryDelay    = 5 * time.Second
)
View Source
const (
	EnvInstallCNS = "INSTALL_CNS"
)

Variables

View Source
var (
	ErrUnsupportedCNSScenario = errors.New("unsupported CNS scenario")
	ErrPathNotFound           = errors.New("failed to get the absolute path to directory")
	ErrNoCNSScenarioDefined   = errors.New("no CNSScenario set to true as env var")
)
View Source
var Kubeconfig = flag.String("test-kubeconfig", filepath.Join(homedir.HomeDir(), ".kube", "config"), "(optional) absolute path to the kubeconfig file")

Functions

func AddNodeLabels

func AddNodeLabels(ctx context.Context, nodes corev1.NodeInterface, nodeName string, labels map[string]string) (*apiv1.Node, error)

AddNodeLabels adds or replaces labels on a node.

func CreateLabelSelector

func CreateLabelSelector(key string, selector *string) string

return a label selector

func ExecCmdOnPod

func ExecCmdOnPod(ctx context.Context, clientset *kubernetes.Clientset, namespace, podName string, cmd []string, config *rest.Config) ([]byte, error)

func ExportLogsByLabelSelector

func ExportLogsByLabelSelector(ctx context.Context, clientset *kubernetes.Clientset, namespace, labelselector, logDir string) error

func GetNodeList

func GetNodeList(ctx context.Context, clientset *kubernetes.Clientset) (*corev1.NodeList, error)

func GetNodeListByLabelSelector

func GetNodeListByLabelSelector(ctx context.Context, clientset *kubernetes.Clientset, labelSelector string) (*corev1.NodeList, error)

func GetPodsByNode

func GetPodsByNode(ctx context.Context, clientset *kubernetes.Clientset, namespace, labelselector, nodeName string) (*corev1.PodList, error)

func GetPodsIpsByNode

func GetPodsIpsByNode(ctx context.Context, clientset *kubernetes.Clientset, namespace, labelselector, nodeName string) ([]string, error)

func HasWindowsNodes

func HasWindowsNodes(ctx context.Context, clientset *kubernetes.Clientset) (bool, error)

func InstallCNSDaemonset

func InstallCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, logDir string) (func() error, error)

func InstallIPMasqAgent

func InstallIPMasqAgent(ctx context.Context, clientset *kubernetes.Clientset) error

func Int32ToPtr

func Int32ToPtr(i int32) *int32

func MustCreateDaemonset

func MustCreateDaemonset(ctx context.Context, daemonsets typedappsv1.DaemonSetInterface, ds appsv1.DaemonSet)

func MustCreateDeployment

func MustCreateDeployment(ctx context.Context, deployments typedappsv1.DeploymentInterface, d appsv1.Deployment)

func MustCreateNamespace

func MustCreateNamespace(ctx context.Context, clienset *kubernetes.Clientset, namespace string)

func MustDeleteDaemonset

func MustDeleteDaemonset(ctx context.Context, daemonsets typedappsv1.DaemonSetInterface, ds appsv1.DaemonSet)

func MustDeleteDeployment

func MustDeleteDeployment(ctx context.Context, deployments typedappsv1.DeploymentInterface, d appsv1.Deployment)

func MustDeleteNamespace

func MustDeleteNamespace(ctx context.Context, clienset *kubernetes.Clientset, namespace string)

func MustDeletePod

func MustDeletePod(ctx context.Context, podI typedcorev1.PodInterface, pod corev1.Pod)

func MustGetClientset

func MustGetClientset() *kubernetes.Clientset

func MustGetRestConfig

func MustGetRestConfig() *rest.Config

func MustLabelSwiftNodes

func MustLabelSwiftNodes(ctx context.Context, clientset *kubernetes.Clientset, delegatedSubnetID, delegatedSubnetName string)

func MustParseDaemonSet

func MustParseDaemonSet(path string) appsv1.DaemonSet

func MustParseDeployment

func MustParseDeployment(path string) appsv1.Deployment

func MustRestartDaemonset

func MustRestartDaemonset(ctx context.Context, clientset *kubernetes.Clientset, namespace, daemonsetName string) error

func MustScaleDeployment

func MustScaleDeployment(ctx context.Context,
	deploymentsClient typedappsv1.DeploymentInterface,
	deployment appsv1.Deployment,
	clientset *kubernetes.Clientset,
	namespace,
	podLabelSelector string,
	replicas int,
	skipWait bool,
)

func MustSetUpClusterRBAC

func MustSetUpClusterRBAC(ctx context.Context, clientset *kubernetes.Clientset, clusterRolePath, clusterRoleBindingPath, serviceAccountPath string) func()

func MustSetUpRBAC

func MustSetUpRBAC(ctx context.Context, clientset *kubernetes.Clientset, rolePath, roleBindingPath string)

func MustSetupConfigMap

func MustSetupConfigMap(ctx context.Context, clientset *kubernetes.Clientset, configMapPath string)

func MustUpdateReplica

func MustUpdateReplica(ctx context.Context, deploymentsClient typedappsv1.DeploymentInterface, deploymentName string, replicas int32)

func NamespaceExists

func NamespaceExists(ctx context.Context, clientset *kubernetes.Clientset, namespace string) (bool, error)

func RestartCNSDaemonset

func RestartCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset) error

func WaitForDeploymentToDelete

func WaitForDeploymentToDelete(ctx context.Context, deploymentsClient typedappsv1.DeploymentInterface, d appsv1.Deployment) error

func WaitForPodDaemonset

func WaitForPodDaemonset(ctx context.Context, clientset *kubernetes.Clientset, namespace, daemonsetName, podLabelSelector string) error

func WaitForPodDeployment

func WaitForPodDeployment(ctx context.Context, clientset *kubernetes.Clientset, namespace, deploymentName, podLabelSelector string, replicas int) error

func WaitForPodsDelete

func WaitForPodsDelete(ctx context.Context, clientset *kubernetes.Clientset, namespace, labelselector string) error

func WaitForPodsRunning

func WaitForPodsRunning(ctx context.Context, clientset *kubernetes.Clientset, namespace, labelselector string) error

Types

type CNSScenario

type CNSScenario string
const (
	EnvInstallAzilium          CNSScenario = "INSTALL_AZILIUM"
	EnvInstallAzureVnet        CNSScenario = "INSTALL_AZURE_VNET"
	EnvInstallOverlay          CNSScenario = "INSTALL_OVERLAY"
	EnvInstallAzureCNIOverlay  CNSScenario = "INSTALL_AZURE_CNI_OVERLAY"
	EnvInstallDualStackOverlay CNSScenario = "INSTALL_DUALSTACK_OVERLAY"
)

Jump to

Keyboard shortcuts

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