Documentation ¶
Index ¶
- func AddOrRemoveCloudAccount(kubeCtl *KubeCtl, params k8stemplates.CloudAccountParameters, delete bool) error
- func CheckCloudResourceNetworkPolicies(kubeCtl *KubeCtl, k8sClient client.Client, kind, namespace string, ...) error
- func CheckDeploymentConfigured(k8sClient client.Client, name, namespace string) error
- func CheckRestart(kubctl *KubeCtl) error
- func CheckVirtualMachinePolicies(k8sClient client.Client, namespace string, num int) error
- func CollectAgentInfo(kubctl *KubeCtl, dir string) error
- func CollectCRDs(kubectl *KubeCtl, dir string) error
- func CollectControllerLogs(kubctl *KubeCtl, dir string) error
- func CollectSupportBundle(kubctl *KubeCtl, dir string, cloudVPC CloudVPC, withAgent bool, ...)
- func CollectVMAgentLog(cloudVPC CloudVPC, dir string, withWindows bool) error
- func ConfigANPApplyTo(kind, instanceName, vpc, tagKey, tagVal string) *k8stemplates.EntitySelectorParameters
- func ConfigANPToFrom(kind, instanceName, vpc, tagKey, tagVal, ipBlock, nsName string, ...) *k8stemplates.ToFromParameters
- func ConfigureEntitySelectorAndWait(kubeCtl *KubeCtl, k8sClient client.Client, ...) error
- func ConfigureK8s(kubeCtl *KubeCtl, params interface{}, yaml string, isDelete bool) error
- func DeleteHelmChart() error
- func ExecuteCmd(timeout time.Duration, cmds []string) (string, error)
- func ExecuteCmds(vpc CloudVPC, kubctl *KubeCtl, srcIDs []string, ns string, cmds [][]string, ...) error
- func ExecuteCurlCmds(vpc CloudVPC, kubctl *KubeCtl, srcIDs []string, ns string, destIPs []string, ...) error
- func GenerateNameFromText(fullText string, focus []string) string
- func GetPodsFromDeployment(k8sClient client.Client, name, namespace string) ([]string, error)
- func GetServiceClusterIPPort(k8sClient client.Client, name, namespace string) (string, int32, error)
- func GetVirtualMachinePolicy(k8sClient client.Client, id, namespace string) (*runtimev1alpha1.VirtualMachinePolicy, error)
- func InstallHelmChart(k8sClient client.Client, version string) error
- func NewK8sClient(scheme *runtime.Scheme, cluster string) (client.Client, error)
- func RestartOrWaitDeployment(k8sClient client.Client, name, namespace string, timeout time.Duration, ...) error
- func SetAgentConfig(c client.Client, ns *corev1.Namespace, ...) error
- func StartOrWaitDeployment(k8sClient client.Client, name, namespace string, replicas int32, ...) error
- func StopDeployment(k8sClient client.Client, name, namespace string, timeout time.Duration) (int32, error)
- func UpgradeHelmChart(k8sClient client.Client, toVersion string, chartDir string) error
- func WaitApiServer(k8sClient client.Client, timeout time.Duration) error
- type CloudVPC
- type KubeCtl
- func (c *KubeCtl) Apply(path string, content []byte) error
- func (c *KubeCtl) Cmd(inCmd string) (string, error)
- func (c *KubeCtl) Delete(path string, content []byte) error
- func (c *KubeCtl) IsPresent() error
- func (c *KubeCtl) Patch(path string, content []byte, kind, name string) error
- func (c *KubeCtl) PodCmd(pod *types.NamespacedName, podCmd []string, timeout time.Duration) (string, error)
- func (c *KubeCtl) SetContext(clusterCtx string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOrRemoveCloudAccount ¶ added in v0.5.0
func AddOrRemoveCloudAccount(kubeCtl *KubeCtl, params k8stemplates.CloudAccountParameters, delete bool) error
AddOrRemoveCloudAccount adds or removes CloudProviderAccount CR and Secret from a namespace.
func CheckCloudResourceNetworkPolicies ¶
func CheckCloudResourceNetworkPolicies(kubeCtl *KubeCtl, k8sClient client.Client, kind, namespace string, ids, anps []string, withAgent bool) error
CheckCloudResourceNetworkPolicies checks NetworkPolicies has been applied to cloud resources.
func CheckDeploymentConfigured ¶ added in v0.6.0
CheckDeploymentConfigured checks if the deployment is configured or not. Return nil if configured.
func CheckRestart ¶
CheckRestart returns error if nephe controller has restarted.
func CheckVirtualMachinePolicies ¶ added in v0.4.0
CheckVirtualMachinePolicies checks the number of vmp in a given namespace matches expected num and all in success state.
func CollectAgentInfo ¶
CollectAgentInfo collect ovs dump-flows from all bridges.
func CollectCRDs ¶
CollectCRDs collects related CRDs in the cluster.
func CollectControllerLogs ¶
CollectControllerLogs collect logs from controllers.
func CollectSupportBundle ¶
func CollectSupportBundle(kubctl *KubeCtl, dir string, cloudVPC CloudVPC, withAgent bool, withWindows bool)
CollectSupportBundle collect antrea and nephe logs.
func CollectVMAgentLog ¶ added in v0.2.0
CollectVMAgentLog collects VM agent log from all imported VMs.
func ConfigANPApplyTo ¶ added in v0.6.0
func ConfigANPApplyTo(kind, instanceName, vpc, tagKey, tagVal string) *k8stemplates.EntitySelectorParameters
ConfigANPApplyTo helper function to configure appliedTo in Antrea NetworkPolicy.
func ConfigANPToFrom ¶ added in v0.6.0
func ConfigANPToFrom(kind, instanceName, vpc, tagKey, tagVal, ipBlock, nsName string, ports []string, denyAll bool) *k8stemplates.ToFromParameters
ConfigANPToFrom helper function to configure to and from fields in Antrea NetworkPolicy.
func ConfigureEntitySelectorAndWait ¶
func ConfigureEntitySelectorAndWait(kubeCtl *KubeCtl, k8sClient client.Client, params k8stemplates.CloudEntitySelectorParameters, kind string, num int, namespace string, isDelete bool) error
ConfigureEntitySelectorAndWait configures EntitySelector for cloud resources, and wait for them to be imported.
func ConfigureK8s ¶
ConfigureK8s create or delete an configuration in yaml.
func DeleteHelmChart ¶ added in v0.6.0
func DeleteHelmChart() error
DeleteHelmChart uninstall helm chart from nephe-system namespace.
func ExecuteCmd ¶ added in v0.6.0
ExecuteCmd helper for command execution.
func ExecuteCmds ¶
func ExecuteCmds(vpc CloudVPC, kubctl *KubeCtl, srcIDs []string, ns string, cmds [][]string, oks []bool, retries int) error
ExecuteCmds excutes cmds on resource srcIDs in parallel, and returns error if oks mismatch.
func ExecuteCurlCmds ¶
func ExecuteCurlCmds(vpc CloudVPC, kubctl *KubeCtl, srcIDs []string, ns string, destIPs []string, port string, oks []bool, retries int) error
ExecuteCurlCmds executes curl on resource srcIDs in parallel, and returns error if oks mismatch.
func GenerateNameFromText ¶
GenerateNameFromText returns a name derived from test.FullContext. Stripping space and focus.
func GetPodsFromDeployment ¶
GetPodsFromDeployment returns Pods of Deployment.
func GetServiceClusterIPPort ¶
func GetServiceClusterIPPort(k8sClient client.Client, name, namespace string) (string, int32, error)
GetServiceClusterIPPort returns clusterIP and first port of a service.
func GetVirtualMachinePolicy ¶ added in v0.4.0
func GetVirtualMachinePolicy(k8sClient client.Client, id, namespace string) (*runtimev1alpha1.VirtualMachinePolicy, error)
GetVirtualMachinePolicy gets vmp corresponding to id and namespace.
func InstallHelmChart ¶ added in v0.6.0
InstallHelmChart install helm chart in nephe-system namespace.
func NewK8sClient ¶
NewK8sClient returns K8s client interface.
func RestartOrWaitDeployment ¶
func RestartOrWaitDeployment(k8sClient client.Client, name, namespace string, timeout time.Duration, restart bool) error
RestartOrWaitDeployment restarts an existing deployment.
func SetAgentConfig ¶ added in v0.2.0
func SetAgentConfig(c client.Client, ns *corev1.Namespace, cloudProviders, antreaVersion, kubeconfig, dir string, withWindows bool) error
SetAgentConfig configures the cluster, generates agent kubeconfigs and sets terraform env vars.
func StartOrWaitDeployment ¶
func StartOrWaitDeployment(k8sClient client.Client, name, namespace string, replicas int32, timeout time.Duration) error
StartOrWaitDeployment start a stopped deployment with number of replicas. Or wait for the deployment to complete if replicas is 0.
func StopDeployment ¶
func StopDeployment(k8sClient client.Client, name, namespace string, timeout time.Duration) (int32, error)
StopDeployment stops an deployment..
func UpgradeHelmChart ¶ added in v0.6.0
UpgradeHelmChart upgrade helm chart in nephe-system namespace.
Types ¶
type CloudVPC ¶
type CloudVPC interface { GetVPCID() string GetVPCName() string GetCRDVPCID() string GetVMs() []string GetVMIDs() []string GetVMNames() []string GetVMIPs() []string GetVMPrivateIPs() []string GetPrimaryNICs() []string GetNICs() []string GetTags() []map[string]string IsConfigured() bool VMCmd(vm string, vmCmd []string, timeout time.Duration) (string, error) Delete(duration time.Duration) error Reapply(duration time.Duration, withAgent bool) error GetCloudAccountParameters(name, namespace string, useInvalidCred bool) k8stemplates.CloudAccountParameters GetEntitySelectorParameters(name, namespace, kind string, vms []string) k8stemplates.CloudEntitySelectorParameters }
func NewCloudVPC ¶
func NewCloudVPC(provider runtimev1alpha1.CloudProvider) (CloudVPC, error)
type KubeCtl ¶
type KubeCtl struct {
// contains filtered or unexported fields
}
func NewKubeCtl ¶
func (*KubeCtl) PodCmd ¶
func (c *KubeCtl) PodCmd(pod *types.NamespacedName, podCmd []string, timeout time.Duration) (string, error)
PodCmd execute podCmd on pod.