Documentation ¶
Index ¶
- Constants
- Variables
- func CMDSuccess() types.GomegaMatcher
- func CanRunK8sVersion(ciliumVersion, k8sVersionStr string) (bool, error)
- func CountValues(key string, data []string) (int, int)
- func CreateLogFile(filename string, data []byte) error
- func CreateReportDirectory() (string, error)
- func CreateVM(scope string) error
- func CurlFail(endpoint string, optionalValues ...interface{}) string
- func CurlWithHTTPCode(endpoint string, optionalValues ...interface{}) string
- func DNSDeployment(base string) string
- func DestroyVM(scope string) error
- func DoesNotExistNodeWithoutCilium() bool
- func DoesNotHaveHosts(count int) func() bool
- func DoesNotRunOnNetNext() bool
- func ExistNodeWithoutCilium() bool
- func Fail(description string, callerSkip ...int)
- func GenerateManifestForEndpoints(endpointCount int, manifestPath string) (string, int, error)
- func GenerateNamespaceForTest() string
- func GetAppPods(apps []string, namespace string, kubectl *Kubectl, appFmt string) map[string]string
- func GetBadLogMessages() map[string][]string
- func GetCiliumNamespace(integration string) string
- func GetCurrentIntegration() string
- func GetCurrentK8SEnv() string
- func GetNodeWithoutCilium() string
- func GetScope() (string, error)
- func GetScopeWithVersion() string
- func GetVagrantSSHMetadata(vmName string) ([]byte, error)
- func HelmOverride(option string) string
- func HoldEnvironment(description ...string)
- func IsIntegration(integration string) bool
- func IsRunningOnJenkins() bool
- func K8s1VMName() string
- func K8s2VMName() string
- func MakeUID() string
- func ManifestGet(base, manifestFilename string) string
- func NativeRoutingEnabled() bool
- func Netcat(endpoint string, optionalValues ...interface{}) string
- func Netperf(endpoint string, perfTest PerfTest, options string) string
- func Ping(endpoint string) string
- func Ping6(endpoint string) string
- func PythonBind(addr string, port uint16, proto string) string
- func RenderTemplateToFile(filename string, tmplt string, perm os.FileMode) error
- func ReportDirectoryPath() string
- func RunsOnNetNext() bool
- func RunsWithKubeProxy() bool
- func RunsWithoutKubeProxy() bool
- func SSHAgent() ssh.AuthMethod
- func Sleep(delay time.Duration)
- func Status(key string) map[string]string
- func TimestampFilename(name string) string
- func WithContext(ctx context.Context, f func(ctx context.Context) (bool, error), ...) error
- func WithTimeout(body func() bool, msg string, config *TimeoutConfig) error
- func WriteOrAppendToFile(filename string, data []byte, perm os.FileMode) error
- func Wrk(endpoint string) string
- type ApplyOptions
- type BeSuccesfulMatcher
- type Buffer
- type CmdRes
- func (res *CmdRes) ByLines() []string
- func (res *CmdRes) CombineOutput() *bytes.Buffer
- func (res *CmdRes) CountLines() int
- func (res *CmdRes) ExpectContains(data string, optionalDescription ...interface{}) bool
- func (res *CmdRes) ExpectDoesNotContain(data string, optionalDescription ...interface{}) bool
- func (res *CmdRes) ExpectDoesNotMatchRegexp(regexp string, optionalDescription ...interface{}) bool
- func (res *CmdRes) ExpectEqual(expected string, optionalDescription ...interface{}) bool
- func (res *CmdRes) ExpectFail(optionalDescription ...interface{}) bool
- func (res *CmdRes) ExpectFailWithError(data string, optionalDescription ...interface{}) bool
- func (res *CmdRes) ExpectSuccess(optionalDescription ...interface{}) bool
- func (res *CmdRes) Filter(filter string) (*FilterBuffer, error)
- func (res *CmdRes) FindResults(filter string) ([]reflect.Value, error)
- func (res *CmdRes) GetCmd() string
- func (res *CmdRes) GetDebugMessage() string
- func (res *CmdRes) GetErr(context string) error
- func (res *CmdRes) GetError() error
- func (res *CmdRes) GetExitCode() int
- func (res *CmdRes) GetStdErr() string
- func (res *CmdRes) GetStdOut() string
- func (res *CmdRes) IntOutput() (int, error)
- func (res *CmdRes) KVOutput() map[string]string
- func (res *CmdRes) Output() *Buffer
- func (res *CmdRes) OutputPrettyPrint() string
- func (res *CmdRes) Reset()
- func (res *CmdRes) SendToLog(quietMode bool)
- func (res *CmdRes) SingleOut() string
- func (res *CmdRes) Unmarshal(data interface{}) error
- func (res *CmdRes) WaitUntilFinish()
- func (res *CmdRes) WaitUntilMatch(substr string) error
- func (res *CmdRes) WaitUntilMatchRegexp(expr string) error
- func (res *CmdRes) WasSuccessful() bool
- type ExecOptions
- type Executor
- type FilterBuffer
- type Kubectl
- func (kub *Kubectl) Action(action ResourceLifeCycleAction, filePath string, namespace ...string) *CmdRes
- func (kub *Kubectl) Apply(options ApplyOptions) *CmdRes
- func (kub *Kubectl) ApplyDefault(filePath string) *CmdRes
- func (kub *Kubectl) BackgroundReport(commands ...string) (context.CancelFunc, error)
- func (kub *Kubectl) CepGet(namespace string, pod string) *cnpv2.EndpointStatus
- func (kub *Kubectl) CiliumCheckReport(ctx context.Context)
- func (kub *Kubectl) CiliumClusterwidePolicyAction(filepath string, action ResourceLifeCycleAction, timeout time.Duration) (string, error)
- func (kub *Kubectl) CiliumEndpointIPv6(pod string, endpoint string) map[string]string
- func (kub *Kubectl) CiliumEndpointWaitReady() error
- func (kub *Kubectl) CiliumEndpointsList(ctx context.Context, pod string) *CmdRes
- func (kub *Kubectl) CiliumEndpointsStatus(pod string) map[string]string
- func (kub *Kubectl) CiliumExec(pod string, cmd string) *CmdRes
- func (kub *Kubectl) CiliumExecContext(ctx context.Context, pod string, cmd string) *CmdRes
- func (kub *Kubectl) CiliumExecUntilMatch(pod, cmd, substr string) error
- func (kub *Kubectl) CiliumInstall(filename string, options map[string]string) error
- func (kub *Kubectl) CiliumInstallVersion(ciliumFilename, dsPatchName, cmPatchName, versionTag string) error
- func (kub *Kubectl) CiliumIsPolicyLoaded(pod string, policyCmd string) bool
- func (kub *Kubectl) CiliumNodesWait() (bool, error)
- func (kub *Kubectl) CiliumPolicyAction(namespace, filepath string, action ResourceLifeCycleAction, ...) (string, error)
- func (kub *Kubectl) CiliumPolicyRevision(pod string) (int, error)
- func (kub *Kubectl) CiliumPreFlightCheck() error
- func (kub *Kubectl) CiliumReport(namespace string, commands ...string)
- func (kub *Kubectl) CiliumServiceAdd(pod string, id int64, frontend string, backends []string, ...) error
- func (kub *Kubectl) CiliumServiceDel(pod string, id int64) error
- func (kub *Kubectl) CiliumUninstall(filename string, options map[string]string) error
- func (kub *Kubectl) CopyFileToPod(namespace string, pod string, fromFile, toFile string) *CmdRes
- func (kub *Kubectl) Create(filePath string) *CmdRes
- func (kub *Kubectl) CreateResource(resource, resourceName string) *CmdRes
- func (kub *Kubectl) CreateSecret(secretType, name, namespace, args string) *CmdRes
- func (kub *Kubectl) Delete(filePath string) *CmdRes
- func (kub *Kubectl) DeleteCiliumDS() error
- func (kub *Kubectl) DeleteETCDOperator()
- func (kub *Kubectl) DeleteResource(resource, resourceName string) *CmdRes
- func (kub *Kubectl) DeployPatch(original, patchFileName string) error
- func (kub *Kubectl) DeployPatchStdIn(original, patch string) error
- func (kub *Kubectl) DumpCiliumCommandOutput(ctx context.Context, namespace string)
- func (kub *Kubectl) EtcdOperatorReport(ctx context.Context, reportCmds map[string]string)
- func (kub *Kubectl) ExecInFirstPod(ctx context.Context, namespace, selector, cmd string, options ...ExecOptions) (result *CmdRes, err error)
- func (kub *Kubectl) ExecInHostNetNS(ctx context.Context, node, cmd string) (result *CmdRes, err error)
- func (kub *Kubectl) ExecInPods(ctx context.Context, namespace, selector, cmd string, wait bool, ...) (results map[string]*CmdRes, err error)
- func (kub *Kubectl) ExecKafkaPodCmd(namespace string, pod string, arg string) error
- func (kub *Kubectl) ExecPodCmd(namespace string, pod string, cmd string, options ...ExecOptions) *CmdRes
- func (kub *Kubectl) ExecPodCmdBackground(ctx context.Context, namespace string, pod string, cmd string, ...) *CmdRes
- func (kub *Kubectl) ExecPodCmdContext(ctx context.Context, namespace string, pod string, cmd string, ...) *CmdRes
- func (kub *Kubectl) ExecPodContainerCmd(namespace, pod, container, cmd string, options ...ExecOptions) *CmdRes
- func (kub *Kubectl) GatherCiliumCoreDumps(ctx context.Context, ciliumPod string)
- func (kub *Kubectl) GatherLogs(ctx context.Context)
- func (kub *Kubectl) GeneratePodLogGatheringCommands(ctx context.Context, reportCmds map[string]string)
- func (kub *Kubectl) Get(namespace string, command string) *CmdRes
- func (kub *Kubectl) GetAllPods(ctx context.Context, options ...ExecOptions) ([]v1.Pod, error)
- func (kub *Kubectl) GetCNP(namespace string, cnp string) *cnpv2.CiliumNetworkPolicy
- func (kub *Kubectl) GetCiliumHostIPv4(ctx context.Context, node string) (string, error)
- func (kub *Kubectl) GetCiliumPodOnNode(namespace string, node string) (string, error)
- func (kub *Kubectl) GetCiliumPodOnNodeWithLabel(namespace string, label string) (string, error)
- func (kub *Kubectl) GetCiliumPods(namespace string) ([]string, error)
- func (kub *Kubectl) GetCiliumPodsContext(ctx context.Context, namespace string) ([]string, error)
- func (kub *Kubectl) GetEndpoints(namespace string, filter string) *CmdRes
- func (kub *Kubectl) GetFilePath(filename string) string
- func (kub *Kubectl) GetFromAllNS(kind string) *CmdRes
- func (kub *Kubectl) GetLoadBalancerIP(namespace string, service string, timeout time.Duration) (string, error)
- func (kub *Kubectl) GetNodeIPByLabel(label string) (string, error)
- func (kub *Kubectl) GetNodeInfo(label string) (nodeName, nodeIP string)
- func (kub *Kubectl) GetNodeNameByLabel(label string) (string, error)
- func (kub *Kubectl) GetNodeNameByLabelContext(ctx context.Context, label string) (string, error)
- func (kub *Kubectl) GetNumCiliumNodes() int
- func (kub *Kubectl) GetPodNames(namespace string, label string) ([]string, error)
- func (kub *Kubectl) GetPodNamesContext(ctx context.Context, namespace string, label string) ([]string, error)
- func (kub *Kubectl) GetPodOnNodeWithOffset(nodeName string, podFilter string, callOffset int) (string, string)
- func (kub *Kubectl) GetPods(namespace string, filter string) *CmdRes
- func (kub *Kubectl) GetPodsIPs(namespace string, filter string) (map[string]string, error)
- func (kub *Kubectl) GetPodsNodes(namespace string, filter string) (map[string]string, error)
- func (kub *Kubectl) GetServiceHostPort(namespace string, service string) (string, int, error)
- func (kub *Kubectl) GetSvcIP(ctx context.Context, namespace, name string) (string, error)
- func (kub *Kubectl) HelmAddCiliumRepo() *CmdRes
- func (kub *Kubectl) HelmTemplate(chartDir, namespace, filename string, options map[string]string) *CmdRes
- func (kub *Kubectl) KubeDNSPreFlightCheck() error
- func (kub *Kubectl) LabelNodes()
- func (kub *Kubectl) LoadedPolicyInFirstAgent() (string, error)
- func (kub *Kubectl) Logs(namespace string, pod string) *CmdRes
- func (kub *Kubectl) MonitorStart(namespace, pod, filename string) func() error
- func (kub *Kubectl) NamespaceCreate(name string) *CmdRes
- func (kub *Kubectl) NamespaceDelete(name string) *CmdRes
- func (kub *Kubectl) NamespaceLabel(namespace string, label string) *CmdRes
- func (kub *Kubectl) NodeCleanMetadata() error
- func (kub *Kubectl) PprofReport()
- func (kub *Kubectl) RunHelm(action, repo, helmName, version, namespace string, options map[string]string) (*CmdRes, error)
- func (kub *Kubectl) ValidateListOfErrorsInLogs(duration time.Duration, blacklist map[string][]string)
- func (kub *Kubectl) ValidateNoErrorsInLogs(duration time.Duration)
- func (kub *Kubectl) WaitCleanAllTerminatingPods(timeout time.Duration) error
- func (kub *Kubectl) WaitForCEPIdentity(ns, podName string) error
- func (kub *Kubectl) WaitForCRDCount(filter string, count int, timeout time.Duration) error
- func (kub *Kubectl) WaitForCiliumInitContainerToFinish() error
- func (kub *Kubectl) WaitForKubeDNSEntry(serviceName, serviceNamespace string) error
- func (kub *Kubectl) WaitForServiceEndpoints(namespace string, filter string, service string, timeout time.Duration) error
- func (kub *Kubectl) WaitKubeDNS() error
- func (kub *Kubectl) WaitPolicyDeleted(pod string, policyName string) error
- func (kub *Kubectl) WaitforNPods(namespace string, filter string, minRequired int, timeout time.Duration) error
- func (kub *Kubectl) WaitforNPodsRunning(namespace string, filter string, minRequired int, timeout time.Duration) error
- func (kub *Kubectl) WaitforPods(namespace string, filter string, timeout time.Duration) error
- type LocalExecutor
- func (s *LocalExecutor) BasePath() string
- func (s *LocalExecutor) CloseSSHClient()
- func (s *LocalExecutor) Exec(cmd string, options ...ExecOptions) *CmdRes
- func (s *LocalExecutor) ExecContext(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
- func (s *LocalExecutor) ExecContextShort(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
- func (s *LocalExecutor) ExecInBackground(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
- func (s *LocalExecutor) ExecMiddle(cmd string, options ...ExecOptions) *CmdRes
- func (s *LocalExecutor) ExecShort(cmd string, options ...ExecOptions) *CmdRes
- func (s *LocalExecutor) ExecWithSudo(cmd string, options ...ExecOptions) *CmdRes
- func (s *LocalExecutor) ExecuteContext(ctx context.Context, command string, stdout io.Writer, stderr io.Writer) error
- func (s *LocalExecutor) IsLocal() bool
- func (s *LocalExecutor) Logger() *logrus.Entry
- func (s *LocalExecutor) String() string
- type ManifestValues
- type PerfTest
- type ResourceLifeCycleAction
- type SSHClient
- func (cli *SSHClient) GetHostPort() string
- func (client *SSHClient) RunCommand(cmd *SSHCommand) error
- func (client *SSHClient) RunCommandContext(ctx context.Context, cmd *SSHCommand) error
- func (client *SSHClient) RunCommandInBackground(ctx context.Context, cmd *SSHCommand) error
- func (client *SSHClient) String() string
- type SSHCommand
- type SSHConfig
- type SSHConfigs
- type SSHMeta
- func (s *SSHMeta) AddIPToLoopbackDevice(ip string) *CmdRes
- func (s *SSHMeta) BasePath() string
- func (s *SSHMeta) BpfLBList(noDuplicates bool) (map[string][]string, error)
- func (s *SSHMeta) CloseSSHClient()
- func (s *SSHMeta) ContainerCreate(name, image, net, options string, cmdParams ...string) *CmdRes
- func (s *SSHMeta) ContainerExec(name string, cmd string, optionalArgs ...string) *CmdRes
- func (s *SSHMeta) ContainerInspect(name string) *CmdRes
- func (s *SSHMeta) ContainerInspectNet(name string) (map[string]string, error)
- func (s *SSHMeta) ContainerInspectOtherNet(name string, network string) (map[string]string, error)
- func (s *SSHMeta) ContainerRm(name string) *CmdRes
- func (s *SSHMeta) ContainerRun(name, image, net, options string, cmdParams ...string) *CmdRes
- func (s *SSHMeta) DumpCiliumCommandOutput()
- func (s *SSHMeta) EndpointGet(id string) *models.Endpoint
- func (s *SSHMeta) EndpointSetConfig(id, option, value string) bool
- func (s *SSHMeta) Exec(cmd string, options ...ExecOptions) *CmdRes
- func (s *SSHMeta) ExecCilium(cmd string) *CmdRes
- func (s *SSHMeta) ExecContext(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
- func (s *SSHMeta) ExecContextShort(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
- func (s *SSHMeta) ExecInBackground(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
- func (s *SSHMeta) ExecMiddle(cmd string, options ...ExecOptions) *CmdRes
- func (s *SSHMeta) ExecShort(cmd string, options ...ExecOptions) *CmdRes
- func (s *SSHMeta) ExecWithSudo(cmd string, options ...ExecOptions) *CmdRes
- func (s *SSHMeta) ExecuteContext(ctx context.Context, cmd string, stdout io.Writer, stderr io.Writer) error
- func (s *SSHMeta) FlushGlobalConntrackTable() *CmdRes
- func (s *SSHMeta) GatherDockerLogs()
- func (s *SSHMeta) GatherLogs()
- func (s *SSHMeta) GetAllEndpointsIds() (map[string]string, error)
- func (s *SSHMeta) GetCopy() *SSHMeta
- func (s *SSHMeta) GetEndpointMutableConfigurationOption(endpointID, optionName string) (string, error)
- func (s *SSHMeta) GetEndpointsIDMap() (map[string]string, error)
- func (s *SSHMeta) GetEndpointsIdentityIds() (map[string]string, error)
- func (s *SSHMeta) GetEndpointsIds() (map[string]string, error)
- func (s *SSHMeta) GetEndpointsNames() ([]string, error)
- func (s *SSHMeta) GetFilePath(filename string) string
- func (s *SSHMeta) GetFullPath(name string) string
- func (s *SSHMeta) IsLocal() bool
- func (s *SSHMeta) ListEndpoints() *CmdRes
- func (s *SSHMeta) Logger() *logrus.Entry
- func (s *SSHMeta) ManifestsPath() string
- func (s *SSHMeta) MonitorStart() func() error
- func (s *SSHMeta) NetworkCreate(name string, subnet string) *CmdRes
- func (s *SSHMeta) NetworkCreateWithOptions(name string, subnet string, ipv6 bool, opts string) *CmdRes
- func (s *SSHMeta) NetworkDelete(name string) *CmdRes
- func (s *SSHMeta) NetworkGet(name string) *CmdRes
- func (s *SSHMeta) PolicyDel(id string) *CmdRes
- func (s *SSHMeta) PolicyDelAll() *CmdRes
- func (s *SSHMeta) PolicyEndpointsSummary() (map[string]int, error)
- func (s *SSHMeta) PolicyGet(id string) *CmdRes
- func (s *SSHMeta) PolicyGetAll() *CmdRes
- func (s *SSHMeta) PolicyGetRevision() (int, error)
- func (s *SSHMeta) PolicyImport(path string) error
- func (s *SSHMeta) PolicyImportAndWait(path string, timeout time.Duration) (int, error)
- func (s *SSHMeta) PolicyRenderAndImport(policy string) (int, error)
- func (s *SSHMeta) PolicyWait(revisionNum int) *CmdRes
- func (s *SSHMeta) PprofReport()
- func (s *SSHMeta) RemoveIPFromLoopbackDevice(ip string) *CmdRes
- func (s *SSHMeta) ReportFailed(commands ...string)
- func (s *SSHMeta) RestartCilium() error
- func (s *SSHMeta) SampleContainersActions(mode string, networkName string, createOptions ...string)
- func (s *SSHMeta) ServiceAdd(id int, frontend string, backends []string) *CmdRes
- func (s *SSHMeta) ServiceDel(id int) *CmdRes
- func (s *SSHMeta) ServiceDelAll() *CmdRes
- func (s *SSHMeta) ServiceGet(id int) *CmdRes
- func (s *SSHMeta) ServiceGetFrontendAddress(id int) (string, error)
- func (s *SSHMeta) ServiceGetIds() ([]string, error)
- func (s *SSHMeta) ServiceIsSynced(id int) (bool, error)
- func (s *SSHMeta) ServiceList() *CmdRes
- func (s *SSHMeta) SetAndWaitForEndpointConfiguration(endpointID, optionName, expectedValue string) error
- func (s *SSHMeta) SetPolicyEnforcement(status string) *CmdRes
- func (s *SSHMeta) SetPolicyEnforcementAndWait(status string) bool
- func (s *SSHMeta) SetUpCilium() error
- func (s *SSHMeta) SetUpCiliumInIpvlanMode(ipvlanMasterDevice string) error
- func (s *SSHMeta) SetUpCiliumWithOptions(ciliumOpts string) error
- func (s *SSHMeta) SetUpCiliumWithSockops() error
- func (s *SSHMeta) String() string
- func (s *SSHMeta) ValidateEndpointsAreCorrect(dockerNetwork string) error
- func (s *SSHMeta) ValidateNoErrorsInLogs(duration time.Duration)
- func (s *SSHMeta) WaitEndpointsDeleted() bool
- func (s *SSHMeta) WaitEndpointsReady() bool
- func (s *SSHMeta) WaitUntilReady(timeout time.Duration) error
- type SSHMetaError
- type TimeoutConfig
Constants ¶
const ( //CiliumPath is the path where cilium test code is located. CiliumPath = "/src/github.com/cilium/cilium/test" // K8sManifestBase tells ginkgo suite where to look for manifests K8sManifestBase = "k8sT/manifests" // VM / Test suite constants. K8s = "k8s" K8s1 = "k8s1" K8s2 = "k8s2" K8s3 = "k8s3" Runtime = "runtime" Enabled = "enabled" Disabled = "disabled" Total = "total" Public = "public" Private = "private" Name = "Name" // PolicyEnforcement represents the PolicyEnforcement configuration option // for the Cilium agent. PolicyEnforcement = "PolicyEnforcement" // PolicyEnforcementDefault represents the default PolicyEnforcement mode // for Cilium. PolicyEnforcementDefault = "default" // PolicyEnforcementAlways represents the PolicyEnforcement mode // for Cilium in which traffic is denied by default even when no policy // is imported. PolicyEnforcementAlways = "always" // PolicyEnforcementNever represents the PolicyEnforcement mode // for Cilium in which traffic is always allowed even if there is a policy // selecting endpoints. PolicyEnforcementNever = "never" // CiliumDockerNetwork is the name of the Docker network which Cilium manages. CiliumDockerNetwork = "cilium-net" // HostDockerNetwork is the name of the host network driver. HostDockerNetwork = "host" // WorldDockerNetwork is the name of the docker network that is *not* // managed by Cilium, intended to be treated as "world" for identity // purposes (for policy tests). WorldDockerNetwork = "world" // Names of commonly used containers in tests. Httpd1 = "httpd1" Httpd2 = "httpd2" Httpd3 = "httpd3" App1 = "app1" App2 = "app2" App3 = "app3" Client = "client" Server = "server" Host = "host" WorldHttpd1 = "WorldHttpd1" // Container lifecycle actions. Create = "create" Delete = "delete" // IP Address families. IPv4 = "IPv4" IPv6 = "IPv6" // LogPerm is the permission for files that are created by this framework // that contain logs, outputs of Cilium CLI commands, etc. LogPerm = os.FileMode(0666) OptionConntrackAccounting = "ConntrackAccounting" OptionConntrackLocal = "ConntrackLocal" OptionConntrack = "Conntrack" OptionDebug = "Debug" OptionDropNotify = "DropNotification" OptionTraceNotify = "TraceNotification" OptionNAT46 = "NAT46" OptionIngressPolicy = "IngressPolicy" OptionEgressPolicy = "EgressPolicy" OptionIngress = "ingress" OptionEgress = "egress" OptionNone = "none" OptionDisabled = "Disabled" OptionEnabled = "Enabled" StateTerminating = "Terminating" StateRunning = "Running" PingCount = 5 // CurlConnectTimeout is the timeout for the connect() call that curl // invokes CurlConnectTimeout = 5 // CurlMaxTimeout is the hard timeout. It starts when curl is invoked // and interrupts curl regardless of whether curl is currently // connecting or transferring data. CurlMaxTimeout should be at least 5 // seconds longer than CurlConnectTimeout to provide some time to // actually transfer data. CurlMaxTimeout = 8 DefaultNamespace = "default" KubeSystemNamespace = "kube-system" CiliumNamespaceDefault = KubeSystemNamespace CiliumNamespaceGKE = "cilium" TestResultsPath = "test_results/" RunDir = "/var/run/cilium" LibDir = "/var/lib/cilium" DaemonName = "cilium" CiliumBugtool = "cilium-bugtool" CiliumDockerDaemonName = "cilium-docker" AgentDaemon = "cilium-agent" GeneratedHTMLManifest = "html.yaml" GeneratedServerManifest = "server.yaml" GeneratedClientManifest = "client.yaml" KubectlCreate = ResourceLifeCycleAction("create") KubectlDelete = ResourceLifeCycleAction("delete") KubectlApply = ResourceLifeCycleAction("apply") KubectlPolicyNameLabel = k8sConst.PolicyLabelName KubectlPolicyNameSpaceLabel = k8sConst.PolicyLabelNamespace // CiliumStableHelmChartVersion should be the chart version that points // to the v1.X branch CiliumStableHelmChartVersion = "1.6-dev" CiliumStableVersion = "v1.6" CiliumLatestHelmChartVersion = "1.7.90" CiliumLatestImageVersion = "latest" MonitorLogFileName = "monitor.log" // CiliumTestLog is the filename where the cilium logs that happens during // the test are saved. CiliumTestLog = "cilium-test.log" // FakeIPv4WorldAddress is an IP which is used in some datapath tests // for simulating external IPv4 connectivity. FakeIPv4WorldAddress = "192.168.254.254" // FakeIPv6WorldAddress is an IP which is used in some datapath tests // for simulating external IPv6 connectivity. FakeIPv6WorldAddress = "fdff::ff" // DockerBridgeIP is the IP on the docker0 bridge DockerBridgeIP = "172.17.0.1" // PrivateIface is the name of interface which is used to communicate with // other cluster nodes // FIXME Determine dynamically the iface PrivateIface = "enp0s8" NACKreceived = "NACK received for version" // from https://github.com/cilium/cilium/issues/4003 RunInitFailed = "JoinEP: " // from https://github.com/cilium/cilium/pull/5052 RemovingMapMsg = "Removing map to allow for property upgrade" // from https://github.com/cilium/cilium/pull/10626 // HelmTemplate is the location of the Helm templates to install Cilium HelmTemplate = "../install/kubernetes/cilium" )
const ( // KubectlCmd Kubernetes controller command KubectlCmd = "kubectl" // DNSHelperTimeout is a predefined timeout value for K8s DNS commands. It // must be larger than 5 minutes because kubedns has a hardcoded resync // period of 5 minutes. We have experienced test failures because kubedns // needed this time to recover from a connection problem to kube-apiserver. // The kubedns resyncPeriod is defined at // https://github.com/kubernetes/dns/blob/80fdd88276adba36a87c4f424b66fdf37cd7c9a8/pkg/dns/dns.go#L53 DNSHelperTimeout = 7 * time.Minute // CIIntegrationFlannel contains the constant to be used when flannel is // used in the CI. CIIntegrationFlannel = "flannel" // CIIntegrationEKS contains the constants to be used when running tests on EKS. CIIntegrationEKS = "eks" // CIIntegrationGKE contains the constants to be used when running tests on GKE. CIIntegrationGKE = "gke" // CIIntegrationMicrok8s contains the constant to be used when running tests on microk8s. CIIntegrationMicrok8s = "microk8s" // CIIntegrationMicrok8s is the value to set CNI_INTEGRATION when running with minikube. CIIntegrationMinikube = "minikube" LogGathererSelector = "k8s-app=cilium-test-logs" CiliumSelector = "k8s-app=cilium" )
const ( // TCP_RR represents a netperf test for TCP Request/Response performance. // For more information, consult : http://www.cs.kent.edu/~farrell/dist/ref/Netperf.html TCP_RR = PerfTest("TCP_RR") // TCP_STREAM represents a netperf test for TCP throughput performance. // For more information, consult : http://www.cs.kent.edu/~farrell/dist/ref/Netperf.html TCP_STREAM = PerfTest("TCP_STREAM") // TCP_CRR represents a netperf test that connects and sends single request/response // For more information, consult : http://www.cs.kent.edu/~farrell/dist/ref/Netperf.html TCP_CRR = PerfTest("TCP_CRR") // UDP_RR represents a netperf test for UDP Request/Response performance. // For more information, consult : http://www.cs.kent.edu/~farrell/dist/ref/Netperf.html UDP_RR = PerfTest("UDP_RR") )
const CiliumConfigMapPatch = "cilium-cm-patch.yaml"
CiliumConfigMapPatch is the default Cilium ConfigMap patch to be used in all tests.
const CiliumConfigMapPatchKvstoreAllocator = "cilium-cm-kvstore-allocator-patch.yaml"
CiliumConfigMapPatchKvstoreAllocator is equivalent to CiliumConfigMapPatch except it uses the kvstore-based allocator instead of the CRD-based allocator.
const CiliumDefaultDSPatch = "cilium-ds-patch.yaml"
CiliumDefaultDSPatch is the default Cilium DaemonSet patch to be used in all tests.
const ( // MaxRetries is the number of times that a loop should iterate until a // specified condition is not met MaxRetries = 30 )
const (
// ReservedIdentityHealth is equivalent to pkg/identity.ReservedIdentityHealth
ReservedIdentityHealth = 4
)
Re-definitions of stable constants in the API. The re-definition is on purpose to validate these values in the API. They may never change
Variables ¶
var ( // HelperTimeout is a predefined timeout value for commands. HelperTimeout = 4 * time.Minute // ShortCommandTimeout is a timeout for commands which should not take a // long time to execute. ShortCommandTimeout = 10 * time.Second // MidCommandTimeout is a timeout for commands which may take a bit longer // than ShortCommandTimeout, but less time than HelperTimeout to execute. MidCommandTimeout = 30 * time.Second // CiliumStartTimeout is a predefined timeout value for Cilium startup. CiliumStartTimeout = 100 * time.Second // CheckLogs newtes a new buffer where all the warnings and checks that // happens during the test are saved. This buffer will be printed in the // test output inside <checks> labels. CheckLogs = ginkgoext.NewWriter(new(bytes.Buffer)) )
var ( // CiliumNamespace is where cilium should run. In some deployments this cannot // be kube-system. CiliumNamespace = GetCiliumNamespace(GetCurrentIntegration()) // LogGathererNamespace is where log-gatherer should run. It follows cilium // for simplicity. LogGathererNamespace = CiliumNamespace )
var ( IsCiliumV1_5 = versioncheck.MustCompile(">=1.4.90 <1.6.0") IsCiliumV1_6 = versioncheck.MustCompile(">=1.5.90 <1.7.0") IsCiliumV1_7 = versioncheck.MustCompile(">=1.6.90 <1.8.0") IsCiliumV1_8 = versioncheck.MustCompile(">=1.7.90 <1.9.0") )
var ( //LocalExecutorLogs is a buffer where all commands sent over ssh are saved. LocalExecutorLogs = ginkgoext.NewWriter(new(Buffer)) )
var NightlyStableUpgradesFrom = map[string]string{"1.6": "1.6-dev", "1.7": "1.7-dev"}
NightlyStableUpgradesFrom maps the cilium image versions to the helm charts that will be used to run update tests in the Nightly test.
var ( //SSHMetaLogs is a buffer where all commands sent over ssh are saved. SSHMetaLogs = ginkgoext.NewWriter(new(Buffer)) )
var UserDefinedScope string
UserDefinedScope in case that the test scope is defined by the user instead of the focus string.
Functions ¶
func CMDSuccess ¶
func CMDSuccess() types.GomegaMatcher
CMDSuccess return a new Matcher that expects a CmdRes is a successful run command.
func CanRunK8sVersion ¶
CanRunK8sVersion returns true if the givel ciliumVersion can run in the given Kubernetes version. If any version is unparsable, an error is returned.
func CountValues ¶
CountValues returns the count of the occurrences of key in data, as well as the length of data.
func CreateLogFile ¶
CreateLogFile creates the ReportDirectory if it is not present, writes the given data to the given filename.
func CreateReportDirectory ¶
CreateReportDirectory creates and returns the directory path to export all report commands that need to be run in the case that a test has failed. If the directory cannot be created it'll return an error
func CreateVM ¶
CreateVM creates a new vagrant server.Receives a scope which indicates the target server that needs to be created. In case of any error on vagrant [provision|up|ssh-config] error will be returned.
func CurlFail ¶
CurlFail returns the string representing the curl command with `-s` and `--fail` options enabled to curl the specified endpoint. It takes a variadic optinalValues argument. This is passed on to fmt.Sprintf() and uses into the curl message
func CurlWithHTTPCode ¶
CurlWithHTTPCode retunrs the string representation of the curl command which only outputs the HTTP code returned by its execution against the specified endpoint. It takes a variadic optinalValues argument. This is passed on to fmt.Sprintf() and uses into the curl message
func DNSDeployment ¶
DNSDeployment returns the manifest to install dns engine on the server.
func DestroyVM ¶
DestroyVM destroys all running Vagrant VMs in the provided scope. It returns an error if deletion of either the VMs fails
func DoesNotExistNodeWithoutCilium ¶
func DoesNotExistNodeWithoutCilium() bool
DoesNotExistNodeWithoutCilium is the complement function of ExistNodeWithoutCilium
func DoesNotHaveHosts ¶
DoesNotHaveHosts returns a function which returns true if a CI job has less VMs than the given count.
func DoesNotRunOnNetNext ¶ added in v1.6.1
func DoesNotRunOnNetNext() bool
DoesNotRunOnNetNext is the complement function of RunsOnNetNext.
func ExistNodeWithoutCilium ¶
func ExistNodeWithoutCilium() bool
ExistNodeWithoutCilium returns true if there is a node in a cluster which does not run cilium.
func Fail ¶
Fail is a Ginkgo failure handler which raises a SIGSTOP for the test process when there is a failure, so that developers can debug the live environment. It is only triggered if the developer provides a commandline flag.
func GenerateManifestForEndpoints ¶ added in v1.5.0
GenerateManifestForEndpoints generates k8s manifests that will create endpointCount Cilium endpoints when applied. 1/3 of endpoints are servers, the rest are clients. returns lastServer index Saves generated manifest to manifestPath, also returns it via string
func GenerateNamespaceForTest ¶
func GenerateNamespaceForTest() string
GenerateNamespaceForTest generates a namespace based off of the current test which is running. Note: Namespaces can only be 63 characters long (to comply with DNS). We ensure that the namespace here is shorter than that, but keep it unique by hashing the complete name.
func GetAppPods ¶
GetAppPods fetches app pod names for a namespace. For Http based tests, we identify pods with format id=<pod_name>, while for Kafka based tests, we identify pods with the format app=<pod_name>.
func GetBadLogMessages ¶
GetBadLogMessages returns a deep copy of badLogMessages to allow removing messages for specific tests.
func GetCiliumNamespace ¶ added in v1.7.0
GetCiliumNamespace returns the namespace into which cilium should be installed for this integration.
func GetCurrentIntegration ¶
func GetCurrentIntegration() string
GetCurrentIntegration returns CI integration set up to run against Cilium.
func GetCurrentK8SEnv ¶
func GetCurrentK8SEnv() string
GetCurrentK8SEnv returns the value of K8S_VERSION from the OS environment.
func GetNodeWithoutCilium ¶ added in v1.7.0
func GetNodeWithoutCilium() string
GetNodeWithoutCilium returns a name of a node which does not run cilium.
func GetScopeWithVersion ¶
func GetScopeWithVersion() string
GetScopeWithVersion returns the scope of the running test. If the scope is k8s, then it returns k8s scope along with the version of k8s that is running.
func GetVagrantSSHMetadata ¶
GetVagrantSSHMetadata returns a string containing the output of `vagrant ssh-config` for the provided Vagrant of name vmName. Returns an error if `vagrant ssh-config` fails to execute.
func HelmOverride ¶
HelmOverride returns the value of a Helm override option for the currently enabled CNI_INTEGRATION
func HoldEnvironment ¶
func HoldEnvironment(description ...string)
HoldEnvironment prints the current test status, then pauses the test execution. Developers who are writing tests may wish to invoke this function directly from test code to assist troubleshooting and test development.
func IsIntegration ¶
IsIntegration returns true when integration matches the configuration of this test run
func IsRunningOnJenkins ¶
func IsRunningOnJenkins() bool
IsRunningOnJenkins detects if the currently running Ginkgo application is most likely running in a Jenkins environment. Returns true if certain environment variables that are present in Jenkins jobs are set, false otherwise.
func K8s1VMName ¶
func K8s1VMName() string
K8s1VMName is the name of the Kubernetes master node when running K8s tests.
func K8s2VMName ¶
func K8s2VMName() string
K8s2VMName is the name of the Kubernetes worker node when running K8s tests.
func ManifestGet ¶
ManifestGet returns the full path of the given manifest corresponding to the Kubernetes version being tested, if such a manifest exists, if not it returns the global manifest file. The paths are checked in order: 1- base_path/integration/filename 2- base_path/k8s_version/integration/filename 3- base_path/k8s_version/filename 4- base_path/filename
func NativeRoutingEnabled ¶
func NativeRoutingEnabled() bool
NativeRoutingEnabled returns true when native routing is enabled for a particular CNI_INTEGRATION
func Netcat ¶
Netcat returns the string representing the netcat command to the specified endpoint. It takes a variadic optionalValues arguments, This is passed to fmt.Sprintf uses in the netcat message
func Netperf ¶
Netperf returns the string representing the netperf command to use when testing connectivity between endpoints.
func Ping6 ¶
Ping6 returns the string representing the ping6 command to ping6 the specified endpoint.
func PythonBind ¶
PythonBind returns the string representing a python3 command which will try to bind a socket on the given address and port. Python is available in the log-gatherer pod.
func RenderTemplateToFile ¶ added in v1.5.0
RenderTemplateToFile renders a text/template string into a target filename with specific persmisions. Returns eturn an error if the template cannot be validated or the file cannot be created.
func ReportDirectoryPath ¶
func ReportDirectoryPath() string
ReportDirectoryPath determines the directory path for exporting report commands in the case of test failure.
func RunsOnNetNext ¶ added in v1.5.0
func RunsOnNetNext() bool
RunsOnNetNext checks whether a test case is running on the net next machine which means running on the latest (probably) unreleased kernel
func RunsWithKubeProxy ¶
func RunsWithKubeProxy() bool
RunsWithKubeProxy returns true if cilium runs together with k8s' kube-proxy.
func RunsWithoutKubeProxy ¶
func RunsWithoutKubeProxy() bool
RunsWithoutKubeProxy is the complement function of RunsWithKubeProxy.
func SSHAgent ¶
func SSHAgent() ssh.AuthMethod
SSHAgent returns the ssh.Authmethod using the Public keys. Returns nil if a connection to SSH_AUTH_SHOCK does not succeed.
func TimestampFilename ¶
TimestampFilename appends a "timestamp" to the name. The goal is to make this name unique to avoid collisions in tests. The nanosecond precision should be more than enough for that.
func WithContext ¶
func WithContext(ctx context.Context, f func(ctx context.Context) (bool, error), freq time.Duration) error
WithContext executes body with the given frequency. The function f is executed until bool returns true or the given context signalizes Done. `f` should stop if context is canceled.
func WithTimeout ¶
func WithTimeout(body func() bool, msg string, config *TimeoutConfig) error
WithTimeout executes body using the time interval specified in config until the timeout in config is reached. Returns an error if the timeout is exceeded for body to execute successfully.
func WriteOrAppendToFile ¶
WriteOrAppendToFile writes data to a file named by filename. If the file does not exist, WriteFile creates it with permissions perm; otherwise WriteFile appends the data to the file
Types ¶
type ApplyOptions ¶
type ApplyOptions struct { FilePath string Namespace string Force bool DryRun bool Output string Piped string }
ApplyOptions stores options for kubectl apply command
type BeSuccesfulMatcher ¶
type BeSuccesfulMatcher struct{}
BeSuccesfulMatcher a new Ginkgo matcher for CmdRes struct
func (*BeSuccesfulMatcher) FailureMessage ¶
func (matcher *BeSuccesfulMatcher) FailureMessage(actual interface{}) (message string)
FailureMessage it returns a pretty printed error message in the case of the command was not successful.
func (*BeSuccesfulMatcher) Match ¶
func (matcher *BeSuccesfulMatcher) Match(actual interface{}) (success bool, err error)
Match validates that the given interface will be a `*CmdRes` struct and it was successful. In case of not a valid CmdRes will return an error. If the command was not successful it returns false.
func (*BeSuccesfulMatcher) NegatedFailureMessage ¶
func (matcher *BeSuccesfulMatcher) NegatedFailureMessage(actual interface{}) (message string)
NegatedFailureMessage returns a pretty printed error message in case of the command is tested with a negative
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
A Buffer is a variable-sized buffer of bytes with Read and Write methods. The zero value for Buffer is an empty buffer ready to use.
func (*Buffer) Bytes ¶
Bytes returns a slice of length b.Len() holding the unread portion of the buffer. The slice is valid for use only until the next buffer modification (that is, only until the next call to a method like Read, Write, Reset, or Truncate). The slice aliases the buffer content at least until the next buffer modification, so immediate changes to the slice will affect the result of future reads.
func (*Buffer) Len ¶
Len returns the number of bytes of the unread portion of the buffer; b.Len() == len(b.Bytes()).
func (*Buffer) Reset ¶
func (buf *Buffer) Reset()
Reset resets the buffer to be empty, but it retains the underlying storage for use by future writes. Reset is the same as Truncate(0).
type CmdRes ¶
type CmdRes struct {
// contains filtered or unexported fields
}
CmdRes contains a variety of data which results from running a command.
func (*CmdRes) ByLines ¶
ByLines returns res's stdout split by the newline character and, if the stdout contains `\r\n`, it will be split by carriage return and new line characters.
func (*CmdRes) CombineOutput ¶
CombineOutput returns the combined output of stdout and stderr for res.
func (*CmdRes) CountLines ¶
CountLines return the number of lines in the stdout of res.
func (*CmdRes) ExpectContains ¶
ExpectContains asserts a string into the stdout of the response of executed command. It accepts an optional parameter that can be used to annotate failure messages.
func (*CmdRes) ExpectDoesNotContain ¶
ExpectDoesNotContain asserts that a string is not contained in the stdout of the executed command. It accepts an optional parameter that can be used to annotate failure messages.
func (*CmdRes) ExpectDoesNotMatchRegexp ¶
ExpectDoesNotMatchRegexp asserts that the stdout of the executed command doesn't match the regexp. It accepts an optional parameter that can be used to annotate failure messages.
func (*CmdRes) ExpectEqual ¶
ExpectEqual asserts whether cmdRes.Output().String() and expected are equal. It accepts an optional parameter that can be used to annotate failure messages.
func (*CmdRes) ExpectFail ¶
ExpectFail asserts whether res failed to execute. It accepts an optional parameter that can be used to annotate failure messages.
func (*CmdRes) ExpectFailWithError ¶
ExpectFailWithError asserts whether res failed to execute with the error output containing the given data. It accepts an optional parameter that can be used to annotate failure messages.
func (*CmdRes) ExpectSuccess ¶
ExpectSuccess asserts whether res executed successfully. It accepts an optional parameter that can be used to annotate failure messages.
func (*CmdRes) Filter ¶
func (res *CmdRes) Filter(filter string) (*FilterBuffer, error)
Filter returns the contents of res's stdout filtered using the provided JSONPath filter in a buffer. Returns an error if the unmarshalling of the contents of res's stdout fails.
func (*CmdRes) FindResults ¶
FindResults filters res's stdout using the provided JSONPath filter. It returns an array of the values that match the filter, and an error if the unmarshalling of the stdout of res fails. TODO - what exactly is the need for this vs. Filter function below?
func (*CmdRes) GetDebugMessage ¶
GetDebugMessage returns executed command and its output
func (*CmdRes) GetErr ¶
GetErr returns error created from program output if command is not successful
func (*CmdRes) GetExitCode ¶
GetExitCode returns res's exitcode.
func (*CmdRes) KVOutput ¶
KVOutput returns a map of the stdout of res split based on the separator '='. For example, the following strings would be split as follows:
a=1 b=2 c=3
func (*CmdRes) OutputPrettyPrint ¶
OutputPrettyPrint returns a string with the ExitCode, stdout and stderr in a pretty format.
func (*CmdRes) SendToLog ¶
SendToLog writes to `TestLogWriter` the debug message for the running command, if the quietMode argument is true will print only the command and the exitcode.
func (*CmdRes) SingleOut ¶
SingleOut returns res's stdout as a string without any newline characters
func (*CmdRes) Unmarshal ¶
Unmarshal unmarshalls res's stdout into data. It assumes that the stdout of res is in JSON format. Returns an error if the unmarshalling fails.
func (*CmdRes) WaitUntilFinish ¶
func (res *CmdRes) WaitUntilFinish()
WaitUntilFinish waits until the command context completes correctly
func (*CmdRes) WaitUntilMatch ¶
WaitUntilMatch waits until the given substring is present in the `CmdRes.stdout` If the timeout is reached it will return an error.
func (*CmdRes) WaitUntilMatchRegexp ¶
WaitUntilMatchRegexp waits until the `CmdRes.stdout` matches the given regexp. If the timeout is reached it will return an error.
func (*CmdRes) WasSuccessful ¶
WasSuccessful returns true if cmd completed successfully.
type ExecOptions ¶
type ExecOptions struct {
SkipLog bool
}
ExecOptions options to execute Exec and ExecWithContext
type Executor ¶
type Executor interface { IsLocal() bool CloseSSHClient() Exec(cmd string, options ...ExecOptions) *CmdRes ExecContext(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes ExecContextShort(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes ExecInBackground(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes ExecMiddle(cmd string, options ...ExecOptions) *CmdRes ExecShort(cmd string, options ...ExecOptions) *CmdRes ExecWithSudo(cmd string, options ...ExecOptions) *CmdRes ExecuteContext(ctx context.Context, cmd string, stdout io.Writer, stderr io.Writer) error String() string BasePath() string Logger() *logrus.Entry // contains filtered or unexported methods }
Executor executes commands
type FilterBuffer ¶
FilterBuffer structs that extends buffer methods
func (*FilterBuffer) ByLines ¶
func (buf *FilterBuffer) ByLines() []string
ByLines returns buf string plit by the newline characters
func (*FilterBuffer) KVOutput ¶
func (buf *FilterBuffer) KVOutput() map[string]string
KVOutput returns a map of the buff string split based on the separator '='. For example, the following strings would be split as follows:
a=1 b=2 c=3
type Kubectl ¶
type Kubectl struct { Executor // contains filtered or unexported fields }
Kubectl is a wrapper around an SSHMeta. It is used to run Kubernetes-specific commands on the node which is accessible via the SSH metadata stored in its SSHMeta.
func CreateKubectl ¶
CreateKubectl initializes a Kubectl helper with the provided vmName and log It marks the test as Fail if cannot get the ssh meta information or cannot execute a `ls` on the virtual machine.
func (*Kubectl) Action ¶
func (kub *Kubectl) Action(action ResourceLifeCycleAction, filePath string, namespace ...string) *CmdRes
Action performs the specified ResourceLifeCycleAction on the Kubernetes manifest located at path filepath in the given namespace
func (*Kubectl) Apply ¶
func (kub *Kubectl) Apply(options ApplyOptions) *CmdRes
Apply applies the Kubernetes manifest located at path filepath.
func (*Kubectl) ApplyDefault ¶
ApplyDefault applies give filepath with other options set to default
func (*Kubectl) BackgroundReport ¶ added in v1.5.0
func (kub *Kubectl) BackgroundReport(commands ...string) (context.CancelFunc, error)
BackgroundReport dumps the result of the given commands on cilium pods each five seconds.
func (*Kubectl) CepGet ¶ added in v1.5.0
func (kub *Kubectl) CepGet(namespace string, pod string) *cnpv2.EndpointStatus
CepGet returns the endpoint model for the given pod name in the specified namespaces. If the pod is not present it returns nil
func (*Kubectl) CiliumCheckReport ¶
CiliumCheckReport prints a few checks on the Junit output to provide more context to users. The list of checks that prints are the following: - Number of Kubernetes and Cilium policies installed. - Policy enforcement status by endpoint. - Controller, health, kvstore status.
func (*Kubectl) CiliumClusterwidePolicyAction ¶
func (kub *Kubectl) CiliumClusterwidePolicyAction(filepath string, action ResourceLifeCycleAction, timeout time.Duration) (string, error)
CiliumClusterwidePolicyAction applies a clusterwide policy action as described in action argument. It then wait till timeout Duration for the policy to be applied to all the cilium endpoints.
func (*Kubectl) CiliumEndpointIPv6 ¶
CiliumEndpointIPv6 returns the IPv6 address of each endpoint which matches the given endpoint selector.
func (*Kubectl) CiliumEndpointWaitReady ¶
CiliumEndpointWaitReady waits until all endpoints managed by all Cilium pod are ready. Returns an error if the Cilium pods cannot be retrieved via Kubernetes, or endpoints are not ready after a specified timeout
func (*Kubectl) CiliumEndpointsList ¶
CiliumEndpointsList returns the result of `cilium endpoint list` from the specified pod.
func (*Kubectl) CiliumEndpointsStatus ¶ added in v1.5.0
CiliumEndpointsStatus returns a mapping of a pod name to it is corresponding endpoint's status
func (*Kubectl) CiliumExec ¶ added in v1.5.0
CiliumExec runs cmd in the specified Cilium pod. Deprecated: use CiliumExecContext instead
func (*Kubectl) CiliumExecContext ¶
CiliumExecContext runs cmd in the specified Cilium pod with the given context.
func (*Kubectl) CiliumExecUntilMatch ¶
CiliumExecUntilMatch executes the specified command repeatedly for the specified Cilium pod until the given substring is present in stdout. If the timeout is reached it will return an error.
func (*Kubectl) CiliumInstall ¶
CiliumInstall installs Cilium with the provided Helm options.
func (*Kubectl) CiliumInstallVersion ¶ added in v1.5.0
func (kub *Kubectl) CiliumInstallVersion(ciliumFilename, dsPatchName, cmPatchName, versionTag string) error
CiliumInstallVersion installs all Cilium descriptors into kubernetes for a given Cilium Version tag. dsPatchName corresponds to the DaemonSet patch that will be applied to the original Cilium DaemonSet descriptor of that given Cilium Version tag. cmPatchName corresponds to the ConfigMap patch that will be applied to the original Cilium ConfigMap descriptor of that given Cilium Version tag. Returns an error if any patch or if any original descriptors files were not found.
func (*Kubectl) CiliumIsPolicyLoaded ¶
CiliumIsPolicyLoaded returns true if the policy is loaded in the given cilium Pod. it returns false in case that the policy is not in place
func (*Kubectl) CiliumNodesWait ¶
CiliumNodesWait waits until all nodes in the Kubernetes cluster are annotated with Cilium annotations. Its runtime is bounded by a maximum of `HelperTimeout`. When a node is annotated with said annotations, it indicates that the tunnels in the nodes are set up and that cross-node traffic can be tested. Returns an error if the timeout is exceeded for waiting for the nodes to be annotated.
func (*Kubectl) CiliumPolicyAction ¶
func (kub *Kubectl) CiliumPolicyAction(namespace, filepath string, action ResourceLifeCycleAction, timeout time.Duration) (string, error)
CiliumPolicyAction performs the specified action in Kubernetes for the policy stored in path filepath and waits up until timeout seconds for the policy to be applied in all Cilium endpoints. Returns an error if the policy is not imported before the timeout is exceeded.
func (*Kubectl) CiliumPolicyRevision ¶
CiliumPolicyRevision returns the policy revision in the specified Cilium pod. Returns an error if the policy revision cannot be retrieved.
func (*Kubectl) CiliumPreFlightCheck ¶
CiliumPreFlightCheck specify that it checks that various subsystems within Cilium are in a good state. If one of the multiple preflight fails it'll return an error.
func (*Kubectl) CiliumReport ¶
CiliumReport report the cilium pod to the log and appends the logs for the given commands.
func (*Kubectl) CiliumServiceAdd ¶
func (kub *Kubectl) CiliumServiceAdd(pod string, id int64, frontend string, backends []string, svcType, trafficPolicy string) error
CiliumServiceAdd adds the given service on a 'pod' running Cilium
func (*Kubectl) CiliumServiceDel ¶
CiliumServiceDel deletes the service with 'id' on a 'pod' running Cilium
func (*Kubectl) CiliumUninstall ¶ added in v1.6.0
CiliumUninstall uninstalls Cilium with the provided Helm options.
func (*Kubectl) CopyFileToPod ¶
CopyFileToPod copies a file to a pod's file-system.
func (*Kubectl) CreateResource ¶
CreateResource is a wrapper around `kubernetes create <resource> <resourceName>.
func (*Kubectl) CreateSecret ¶
CreateSecret is a wrapper around `kubernetes create secret <resourceName>.
func (*Kubectl) DeleteCiliumDS ¶
func (*Kubectl) DeleteETCDOperator ¶ added in v1.5.0
func (kub *Kubectl) DeleteETCDOperator()
DeleteETCDOperator delete the etcd-operator from the cluster pointed by kub.
func (*Kubectl) DeleteResource ¶
DeleteResource is a wrapper around `kubernetes delete <resource> resourceName>.
func (*Kubectl) DeployPatch ¶
DeployPatch deploys the original kubernetes descriptor with the given patch.
func (*Kubectl) DeployPatchStdIn ¶
DeployPatchStdIn deploys the original kubernetes descriptor with the given patch.
func (*Kubectl) DumpCiliumCommandOutput ¶
DumpCiliumCommandOutput runs a variety of commands (CiliumKubCLICommands) and writes the results to TestResultsPath
func (*Kubectl) EtcdOperatorReport ¶ added in v1.5.0
EtcdOperatorReport dump etcd pods data into the report directory to be able to debug etcd operator status in case of fail test.
func (*Kubectl) ExecInFirstPod ¶
func (kub *Kubectl) ExecInFirstPod(ctx context.Context, namespace, selector, cmd string, options ...ExecOptions) (result *CmdRes, err error)
ExecInFirstPod runs given command in one pod that matches given selector and namespace An error is returned if no pods can be found
func (*Kubectl) ExecInHostNetNS ¶
func (kub *Kubectl) ExecInHostNetNS(ctx context.Context, node, cmd string) (result *CmdRes, err error)
ExecInHostNetNS runs given command in a pod running in a host network namespace
func (*Kubectl) ExecInPods ¶
func (kub *Kubectl) ExecInPods(ctx context.Context, namespace, selector, cmd string, wait bool, options ...ExecOptions) (results map[string]*CmdRes, err error)
ExecInPods runs given command on all pods in given namespace that match selector and returns map pod-name->CmdRes
func (*Kubectl) ExecKafkaPodCmd ¶
ExecKafkaPodCmd executes shell command with arguments arg in the specified pod residing in the specified namespace. It returns the stdout of the command that was executed. The kafka producer and consumer scripts do not return error if command leads to TopicAuthorizationException or any other error. Hence the function needs to also take into account the stderr messages returned.
func (*Kubectl) ExecPodCmd ¶
func (kub *Kubectl) ExecPodCmd(namespace string, pod string, cmd string, options ...ExecOptions) *CmdRes
ExecPodCmd executes command cmd in the specified pod residing in the specified namespace. It returns a pointer to CmdRes with all the output
func (*Kubectl) ExecPodCmdBackground ¶
func (kub *Kubectl) ExecPodCmdBackground(ctx context.Context, namespace string, pod string, cmd string, options ...ExecOptions) *CmdRes
ExecPodCmdBackground executes command cmd in background in the specified pod residing in the specified namespace. It returns a pointer to CmdRes with all the output
To receive the output of this function, the caller must invoke either kub.WaitUntilFinish() or kub.WaitUntilMatch() then subsequently fetch the output out of the result.
func (*Kubectl) ExecPodCmdContext ¶
func (kub *Kubectl) ExecPodCmdContext(ctx context.Context, namespace string, pod string, cmd string, options ...ExecOptions) *CmdRes
ExecPodCmdContext synchronously executes command cmd in the specified pod residing in the specified namespace. It returns a pointer to CmdRes with all the output.
func (*Kubectl) ExecPodContainerCmd ¶
func (kub *Kubectl) ExecPodContainerCmd(namespace, pod, container, cmd string, options ...ExecOptions) *CmdRes
ExecPodContainerCmd executes command cmd in the specified container residing in the specified namespace and pod. It returns a pointer to CmdRes with all the output
func (*Kubectl) GatherCiliumCoreDumps ¶
GatherCiliumCoreDumps copies core dumps if are present in the /tmp folder into the test report folder for further analysis.
func (*Kubectl) GatherLogs ¶
GatherLogs dumps kubernetes pods, services, DaemonSet to the testResultsPath directory
func (*Kubectl) GeneratePodLogGatheringCommands ¶
func (kub *Kubectl) GeneratePodLogGatheringCommands(ctx context.Context, reportCmds map[string]string)
GeneratePodLogGatheringCommands generates the commands to gather logs for all pods in the Kubernetes cluster, and maps the commands to the filename in which they will be stored in reportCmds.
func (*Kubectl) GetAllPods ¶
GetAllPods returns a slice of all pods present in Kubernetes cluster, along with an error if the pods could not be retrieved via `kubectl`, or if the pod objects are unable to be marshaled from JSON.
func (*Kubectl) GetCNP ¶
func (kub *Kubectl) GetCNP(namespace string, cnp string) *cnpv2.CiliumNetworkPolicy
GetCNP retrieves the output of `kubectl get cnp` in the given namespace for the given CNP and return a CNP struct. If the CNP does not exists or cannot unmarshal the Json output will return nil.
func (*Kubectl) GetCiliumHostIPv4 ¶ added in v1.6.4
GetCiliumHostIPv4 retrieves cilium_host IPv4 addr of the given node.
func (*Kubectl) GetCiliumPodOnNode ¶
GetCiliumPodOnNode returns the name of the Cilium pod that is running on / in the specified node / namespace.
func (*Kubectl) GetCiliumPodOnNodeWithLabel ¶ added in v1.7.0
GetCiliumPodOnNodeWithLabel returns the name of the Cilium pod that is running on node with cilium.io/ci-node label
func (*Kubectl) GetCiliumPods ¶
GetCiliumPods returns a list of all Cilium pods in the specified namespace, and an error if the Cilium pods were not able to be retrieved.
func (*Kubectl) GetCiliumPodsContext ¶
GetCiliumPodsContext returns a list of all Cilium pods in the specified namespace, and an error if the Cilium pods were not able to be retrieved.
func (*Kubectl) GetEndpoints ¶
GetEndpoints gets all of the endpoints in the given namespace that match the provided filter.
func (*Kubectl) GetFilePath ¶
GetFilePath is a utility function which returns path to give fale relative to BasePath
func (*Kubectl) GetFromAllNS ¶
GetFromAllNS retrieves provided Kubernetes objects from all namespaces
func (*Kubectl) GetLoadBalancerIP ¶
func (kub *Kubectl) GetLoadBalancerIP(namespace string, service string, timeout time.Duration) (string, error)
GetLoadBalancerIP waits until a loadbalancer IP addr has been assigned for the given service, and then returns the IP addr.
func (*Kubectl) GetNodeIPByLabel ¶
GetNodeIPByLabel returns the IP of the node with cilium.io/ci-node=label. An error is returned if a node cannot be found.
func (*Kubectl) GetNodeInfo ¶
GetNodeInfo provides the node name and IP address based on the label (eg helpers.K8s1 or helpers.K8s2)
func (*Kubectl) GetNodeNameByLabel ¶
GetNodeNameByLabel returns the names of the node with a matching cilium.io/ci-node label
func (*Kubectl) GetNodeNameByLabelContext ¶
GetNodeNameByLabelContext returns the names of all nodes with a matching label
func (*Kubectl) GetNumCiliumNodes ¶
GetNumCiliumNodes returns the number of Kubernetes nodes running cilium
func (*Kubectl) GetPodNames ¶
GetPodNames returns the names of all of the pods that are labeled with label in the specified namespace, along with an error if the pod names cannot be retrieved.
func (*Kubectl) GetPodNamesContext ¶
func (kub *Kubectl) GetPodNamesContext(ctx context.Context, namespace string, label string) ([]string, error)
GetPodNamesContext returns the names of all of the pods that are labeled with label in the specified namespace, along with an error if the pod names cannot be retrieved.
func (*Kubectl) GetPodOnNodeWithOffset ¶ added in v1.7.3
func (*Kubectl) GetPods ¶
GetPods gets all of the pods in the given namespace that match the provided filter.
func (*Kubectl) GetPodsIPs ¶
GetPodsIPs returns a map with pod name as a key and pod IP name as value. It only gets pods in the given namespace that match the provided filter. It returns an error if pods cannot be retrieved correctly
func (*Kubectl) GetPodsNodes ¶
GetPodsNodes returns a map with pod name as a key and node name as value. It only gets pods in the given namespace that match the provided filter. It returns an error if pods cannot be retrieved correctly
func (*Kubectl) GetServiceHostPort ¶
GetServiceHostPort returns the host and the first port for the given service name. It will return an error if service cannot be retrieved.
func (*Kubectl) GetSvcIP ¶
GetSvcIP returns the cluster IP for the given service. If the service does not contain a cluster IP, the function keeps retrying until it has or the context timesout.
func (*Kubectl) HelmAddCiliumRepo ¶
HelmAddCiliumRepo installs the repository that contain Cilium helm charts.
func (*Kubectl) HelmTemplate ¶
func (kub *Kubectl) HelmTemplate(chartDir, namespace, filename string, options map[string]string) *CmdRes
HelmTemplate renders given helm template. TODO: use go helm library for that
func (*Kubectl) KubeDNSPreFlightCheck ¶
KubeDNSPreFlightCheck makes sure that kube-dns is plumbed into Cilium.
func (*Kubectl) LabelNodes ¶ added in v1.7.0
func (kub *Kubectl) LabelNodes()
LabelNodes labels nodes in vagrant env. If you are running tests on different cluster you need to label your nodes by yourself
func (*Kubectl) LoadedPolicyInFirstAgent ¶
LoadedPolicyInFirstAgent returns the policy as loaded in the first cilium agent that is found in the cluster
func (*Kubectl) Logs ¶
Logs returns a CmdRes with containing the resulting metadata from the execution of `kubectl logs <pod> -n <namespace>`.
func (*Kubectl) MonitorStart ¶
MonitorStart runs cilium monitor in the background and dumps the contents into a log file for later debugging
func (*Kubectl) NamespaceCreate ¶
NamespaceCreate creates a new Kubernetes namespace with the given name
func (*Kubectl) NamespaceDelete ¶
NamespaceDelete deletes a given Kubernetes namespace
func (*Kubectl) NamespaceLabel ¶
NamespaceLabel sets a label in a Kubernetes namespace
func (*Kubectl) NodeCleanMetadata ¶ added in v1.5.0
NodeCleanMetadata annotates each node in the Kubernetes cluster with the annotation.V4CIDRName and annotation.V6CIDRName annotations. It returns an error if the nodes cannot be retrieved via the Kubernetes API.
func (*Kubectl) PprofReport ¶
func (kub *Kubectl) PprofReport()
PprofReport runs pprof on cilium nodes each 5 minutes and saves the data into the test folder saved with pprof suffix.
func (*Kubectl) RunHelm ¶
func (kub *Kubectl) RunHelm(action, repo, helmName, version, namespace string, options map[string]string) (*CmdRes, error)
RunHelm runs the helm command with the given options.
func (*Kubectl) ValidateListOfErrorsInLogs ¶
func (kub *Kubectl) ValidateListOfErrorsInLogs(duration time.Duration, blacklist map[string][]string)
ValidateListOfErrorsInLogs is similar to ValidateNoErrorsInLogs, but takes a blacklist of bad log messages instead of using the default list.
func (*Kubectl) ValidateNoErrorsInLogs ¶
ValidateNoErrorsInLogs checks that cilium logs since the given duration (By default `CurrentGinkgoTestDescription().Duration`) do not contain any of the known-bad messages (e.g., `deadlocks` or `segmentation faults`). In case of any of these messages, it'll mark the test as failed.
func (*Kubectl) WaitCleanAllTerminatingPods ¶ added in v1.5.0
WaitCleanAllTerminatingPods waits until all nodes that are in `Terminating` state are deleted correctly in the platform. In case of excedding the given timeout (in seconds) it returns an error
func (*Kubectl) WaitForCEPIdentity ¶
WaitForCEPIdentity waits for a particular CEP to have an identity present.
func (*Kubectl) WaitForCRDCount ¶
func (*Kubectl) WaitForCiliumInitContainerToFinish ¶
WaitForCiliumInitContainerToFinish waits for all Cilium init containers to finish
func (*Kubectl) WaitForKubeDNSEntry ¶
WaitForKubeDNSEntry waits until the given DNS entry exists in the kube-dns service. If the container is not ready after timeout it returns an error. The name's format query should be `${name}.${namespace}`. If `svc.cluster.local` is not present, it appends to the given name and it checks the service's FQDN.
func (*Kubectl) WaitForServiceEndpoints ¶
func (kub *Kubectl) WaitForServiceEndpoints(namespace string, filter string, service string, timeout time.Duration) error
WaitForServiceEndpoints waits up until timeout seconds have elapsed for all endpoints in the specified namespace that match the provided JSONPath filter. Returns true if all pods achieve the aforementioned desired state within timeout seconds. Returns false and an error if the command failed or the timeout was exceeded.
func (*Kubectl) WaitKubeDNS ¶
WaitKubeDNS waits until the kubeDNS pods are ready. In case of exceeding the default timeout it returns an error.
func (*Kubectl) WaitPolicyDeleted ¶
WaitPolicyDeleted waits for policy policyName to be deleted from the cilium-agent running in pod. Returns an error if policyName was unable to be deleted after some amount of time.
func (*Kubectl) WaitforNPods ¶
func (kub *Kubectl) WaitforNPods(namespace string, filter string, minRequired int, timeout time.Duration) error
WaitforNPods waits up until timeout seconds have elapsed for at least minRequired pods in the specified namespace that match the provided JSONPath filter to have their containterStatuses equal to "ready". Returns no error if minRequired pods achieve the aforementioned desired state within timeout seconds. Returns an error if the command failed or the timeout was exceeded. When minRequired is 0, the function will derive required pod count from number of pods in the cluster for every iteration.
func (*Kubectl) WaitforNPodsRunning ¶
func (kub *Kubectl) WaitforNPodsRunning(namespace string, filter string, minRequired int, timeout time.Duration) error
WaitforNPodsRunning waits up until timeout duration has elapsed for at least minRequired pods in the specified namespace that match the provided JSONPath filter to have their containterStatuses equal to "running". Returns no error if minRequired pods achieve the aforementioned desired state within timeout seconds. Returns an error if the command failed or the timeout was exceeded. When minRequired is 0, the function will derive required pod count from number of pods in the cluster for every iteration.
func (*Kubectl) WaitforPods ¶
WaitforPods waits up until timeout seconds have elapsed for all pods in the specified namespace that match the provided JSONPath filter to have their containterStatuses equal to "ready". Returns true if all pods achieve the aforementioned desired state within timeout seconds. Returns false and an error if the command failed or the timeout was exceeded.
type LocalExecutor ¶
type LocalExecutor struct {
// contains filtered or unexported fields
}
LocalExecutor executes commands, implements Executor interface
func CreateLocalExecutor ¶
func CreateLocalExecutor(env []string) *LocalExecutor
CreateLocalExecutor returns a local executor
func (*LocalExecutor) BasePath ¶
func (s *LocalExecutor) BasePath() string
func (*LocalExecutor) CloseSSHClient ¶
func (s *LocalExecutor) CloseSSHClient()
CloseSSHClient is a no-op
func (*LocalExecutor) Exec ¶
func (s *LocalExecutor) Exec(cmd string, options ...ExecOptions) *CmdRes
Exec returns the results of executing the provided cmd via SSH.
func (*LocalExecutor) ExecContext ¶
func (s *LocalExecutor) ExecContext(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
ExecContext returns the results of executing the provided cmd via SSH.
func (*LocalExecutor) ExecContextShort ¶
func (s *LocalExecutor) ExecContextShort(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
ExecContextShort is a wrapper around ExecContext which creates a child context with a timeout of ShortCommandTimeout.
func (*LocalExecutor) ExecInBackground ¶
func (s *LocalExecutor) ExecInBackground(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
ExecInBackground returns the results of running cmd in the specified context. The command will be executed in the background until context.Context is canceled or the command has finish its execution.
func (*LocalExecutor) ExecMiddle ¶
func (s *LocalExecutor) ExecMiddle(cmd string, options ...ExecOptions) *CmdRes
ExecMiddle runs command with the provided options. It will take up to MidCommandTimeout seconds to run the command before it times out.
func (*LocalExecutor) ExecShort ¶
func (s *LocalExecutor) ExecShort(cmd string, options ...ExecOptions) *CmdRes
ExecShort runs command with the provided options. It will take up to ShortCommandTimeout seconds to run the command before it times out.
func (*LocalExecutor) ExecWithSudo ¶
func (s *LocalExecutor) ExecWithSudo(cmd string, options ...ExecOptions) *CmdRes
ExecWithSudo returns the result of executing the provided cmd via SSH using sudo.
func (*LocalExecutor) ExecuteContext ¶
func (s *LocalExecutor) ExecuteContext(ctx context.Context, command string, stdout io.Writer, stderr io.Writer) error
ExecuteContext executes the given `cmd` and writes the cmd's stdout and stderr into the given io.Writers. Returns an error if context Deadline() is reached or if there was an error executing the command.
func (*LocalExecutor) IsLocal ¶
func (s *LocalExecutor) IsLocal() bool
IsLocal returns true if commands are executed on the Ginkgo host
func (*LocalExecutor) Logger ¶
func (s *LocalExecutor) Logger() *logrus.Entry
Logger returns logger for executor
func (*LocalExecutor) String ¶
func (s *LocalExecutor) String() string
type ManifestValues ¶ added in v1.5.0
type ManifestValues struct {
Index int
}
ManifestValues wraps manifest index
type PerfTest ¶
type PerfTest string
PerfTest represents a type of test to run when running `netperf`.
type ResourceLifeCycleAction ¶
type ResourceLifeCycleAction string
ResourceLifeCycleAction represents an action performed upon objects in Kubernetes.
type SSHClient ¶
type SSHClient struct { Config *ssh.ClientConfig // ssh client configuration information. Host string // Ip/Host from the target virtualserver Port int // Port to connect to the target server // contains filtered or unexported fields }
SSHClient stores the information needed to SSH into a remote location for running tests.
func GetSSHClient ¶
GetSSHClient initializes an SSHClient for the specified host/port/user combination.
func (*SSHClient) GetHostPort ¶
GetHostPort returns the host port representation of the ssh client
func (*SSHClient) RunCommand ¶
func (client *SSHClient) RunCommand(cmd *SSHCommand) error
RunCommand runs a SSHCommand using SSHClient client. The returned error is nil if the command runs, has no problems copying stdin, stdout, and stderr, and exits with a zero exit status.
func (*SSHClient) RunCommandContext ¶
func (client *SSHClient) RunCommandContext(ctx context.Context, cmd *SSHCommand) error
RunCommandContext runs an SSH command in a similar way to RunCommand but with a context. If context is canceled it will return the error of that given context.
func (*SSHClient) RunCommandInBackground ¶
func (client *SSHClient) RunCommandInBackground(ctx context.Context, cmd *SSHCommand) error
RunCommandInBackground runs an SSH command in a similar way to RunCommandContext, but with a context which allows the command to be cancelled at any time. When cancel is called the error of the command is returned instead the context error.
type SSHCommand ¶
type SSHCommand struct { // TODO: path is not a clear name - rename to something more clear. Path string Env []string Stdin io.Reader Stdout io.Writer Stderr io.Writer }
SSHCommand stores the data associated with executing a command. TODO: this is poorly named in that it's not related to a command only ran over SSH - rename this.
type SSHConfig ¶
type SSHConfig struct {
// contains filtered or unexported fields
}
SSHConfig contains metadata for an SSH session.
func (*SSHConfig) GetSSHAgent ¶
func (cfg *SSHConfig) GetSSHAgent() ssh.AuthMethod
GetSSHAgent returns the ssh.AuthMethod corresponding to SSHConfig cfg.
func (*SSHConfig) GetSSHClient ¶
GetSSHClient initializes an SSHClient based on the provided SSHConfig
type SSHConfigs ¶
SSHConfigs maps the name of a host (VM) to its corresponding SSHConfiguration
func ImportSSHconfig ¶
func ImportSSHconfig(config []byte) (SSHConfigs, error)
ImportSSHconfig imports the SSH configuration stored at the provided path. Returns an error if the SSH configuration could not be instantiated.
type SSHMeta ¶
type SSHMeta struct {
// contains filtered or unexported fields
}
SSHMeta contains metadata to SSH into a remote location to run tests
func CreateSSHMeta ¶
CreateSSHMeta returns an SSHMeta with the specified host, port, and user, as well as an according SSHClient.
func GetVagrantSSHMeta ¶
GetVagrantSSHMeta returns a SSHMeta initialized based on the provided SSH-config target.
func InitRuntimeHelper ¶
InitRuntimeHelper returns SSHMeta helper for running the runtime tests on the provided VM target and using logger 'log'. It marks the test as Fail if it cannot get the ssh meta information or cannot execute a `ls` on the virtual machine.
func (*SSHMeta) AddIPToLoopbackDevice ¶
AddIPToLoopbackDevice adds the specified IP (assumed to be in form <ip>/<mask>) to the loopback device on s.
func (*SSHMeta) BpfLBList ¶
BpfLBList returns the output of `cilium bpf lb list -o json` as a map Key will be the frontend address and the value is an array with all backend addresses
func (*SSHMeta) CloseSSHClient ¶
func (s *SSHMeta) CloseSSHClient()
CloseSSHClient closes all of the connections made by the SSH Client for this SSHMeta.
func (*SSHMeta) ContainerCreate ¶
ContainerCreate is a wrapper for `docker run`. It runs an instance of the specified Docker image with the provided network, name, options and container startup commands.
func (*SSHMeta) ContainerExec ¶
ContainerExec executes cmd in the container with the provided name along with any other additional arguments needed.
func (*SSHMeta) ContainerInspect ¶
ContainerInspect runs `docker inspect` for the container with the provided name.
func (*SSHMeta) ContainerInspectNet ¶
ContainerInspectNet returns a map of Docker networking information fields and their associated values for the container of the provided name. An error is returned if the networking information could not be retrieved.
func (*SSHMeta) ContainerInspectOtherNet ¶
ContainerInspectOtherNet returns a map of Docker networking information fields and their associated values for the container of the provided name, on the specified docker network. An error is returned if the networking information could not be retrieved.
func (*SSHMeta) ContainerRm ¶
ContainerRm is a wrapper around `docker rm -f`. It forcibly removes the Docker container of the provided name.
func (*SSHMeta) ContainerRun ¶
ContainerRun is a wrapper to a one execution docker run container. It runs an instance of the specific Docker image with the provided network, name and options.
func (*SSHMeta) DumpCiliumCommandOutput ¶
func (s *SSHMeta) DumpCiliumCommandOutput()
DumpCiliumCommandOutput runs a variety of Cilium CLI commands and dumps their output to files. These files are gathered as part of each Jenkins job for postmortem debugging of build failures.
func (*SSHMeta) EndpointGet ¶
EndpointGet returns the output of `cilium endpoint get` for the provided endpoint ID.
func (*SSHMeta) EndpointSetConfig ¶
EndpointSetConfig sets the provided configuration option to the provided value for the endpoint with the endpoint ID id. It returns true if the configuration update command returned successfully.
func (*SSHMeta) Exec ¶
func (s *SSHMeta) Exec(cmd string, options ...ExecOptions) *CmdRes
Exec returns the results of executing the provided cmd via SSH.
func (*SSHMeta) ExecCilium ¶
ExecCilium runs a Cilium CLI command and returns the resultant cmdRes.
func (*SSHMeta) ExecContext ¶
ExecContext returns the results of executing the provided cmd via SSH.
func (*SSHMeta) ExecContextShort ¶
ExecContextShort is a wrapper around ExecContext which creates a child context with a timeout of ShortCommandTimeout.
func (*SSHMeta) ExecInBackground ¶
ExecInBackground returns the results of running cmd via SSH in the specified context. The command will be executed in the background until context.Context is canceled or the command has finish its execution.
func (*SSHMeta) ExecMiddle ¶
func (s *SSHMeta) ExecMiddle(cmd string, options ...ExecOptions) *CmdRes
ExecMiddle runs command with the provided options. It will take up to MidCommandTimeout seconds to run the command before it times out.
func (*SSHMeta) ExecShort ¶
func (s *SSHMeta) ExecShort(cmd string, options ...ExecOptions) *CmdRes
ExecShort runs command with the provided options. It will take up to ShortCommandTimeout seconds to run the command before it times out.
func (*SSHMeta) ExecWithSudo ¶
func (s *SSHMeta) ExecWithSudo(cmd string, options ...ExecOptions) *CmdRes
ExecWithSudo returns the result of executing the provided cmd via SSH using sudo.
func (*SSHMeta) ExecuteContext ¶
func (s *SSHMeta) ExecuteContext(ctx context.Context, cmd string, stdout io.Writer, stderr io.Writer) error
ExecuteContext executes the given `cmd` and writes the cmd's stdout and stderr into the given io.Writers. Returns an error if context Deadline() is reached or if there was an error executing the command.
func (*SSHMeta) FlushGlobalConntrackTable ¶
FlushGlobalConntrackTable flushes the global connection tracking table.
func (*SSHMeta) GatherDockerLogs ¶
func (s *SSHMeta) GatherDockerLogs()
GatherDockerLogs dumps docker containers logs output to the directory testResultsPath
func (*SSHMeta) GatherLogs ¶
func (s *SSHMeta) GatherLogs()
GatherLogs dumps Cilium, Cilium Docker, key-value store logs, and gops output to the directory testResultsPath
func (*SSHMeta) GetAllEndpointsIds ¶
GetAllEndpointsIds returns a mapping of all Docker container name to to its corresponding endpoint ID, and an error if the list of endpoints cannot be retrieved via the Cilium CLI.
func (*SSHMeta) GetEndpointMutableConfigurationOption ¶
func (s *SSHMeta) GetEndpointMutableConfigurationOption(endpointID, optionName string) (string, error)
GetEndpointMutableConfigurationOption returns the value of the mutable configuration option optionName for the endpoint with ID endpointID, or an error if optionName's corresponding value cannot be retrieved for the endpoint.
func (*SSHMeta) GetEndpointsIDMap ¶
GetEndpointsIDMap returns a mapping of an endpoint ID to Docker container name, and an error if the list of endpoints cannot be retrieved via the Cilium CLI.
func (*SSHMeta) GetEndpointsIdentityIds ¶
GetEndpointsIdentityIds returns a mapping of a Docker container name to it's corresponding endpoint's security identity, it will return an error if the list of endpoints cannot be retrieved via the Cilium CLI.
func (*SSHMeta) GetEndpointsIds ¶
GetEndpointsIds returns a mapping of a Docker container name to to its corresponding endpoint ID, and an error if the list of endpoints cannot be retrieved via the Cilium CLI.
func (*SSHMeta) GetEndpointsNames ¶
GetEndpointsNames returns the container-name field of each Cilium endpoint.
func (*SSHMeta) GetFilePath ¶
GetFilePath is a utility function which returns path to give fale relative to BasePath
func (*SSHMeta) GetFullPath ¶
GetFullPath returns the path of file name prepended with the absolute path where manifests (YAMLs containing policies, DaemonSets, etc.) are stored.
func (*SSHMeta) ListEndpoints ¶
ListEndpoints returns the CmdRes resulting from executing `cilium endpoint list -o json`.
func (*SSHMeta) ManifestsPath ¶
ManifestsPath returns the path of the directory where manifests (YAMLs containing policies, DaemonSets, etc.) are stored for the runtime tests. TODO: this can just be a constant; there's no need to have a function.
func (*SSHMeta) MonitorStart ¶
MonitorStart starts the monitor command in background and returns a callback function wich stops the monitor when the user needs. When the callback is called the command will stop and monitor's output is saved on `monitorLogFileName` file.
func (*SSHMeta) NetworkCreate ¶
NetworkCreate creates a Docker network of the provided name with the specified subnet. It is a wrapper around `docker network create`.
func (*SSHMeta) NetworkCreateWithOptions ¶
func (s *SSHMeta) NetworkCreateWithOptions(name string, subnet string, ipv6 bool, opts string) *CmdRes
NetworkCreateWithOptions creates a Docker network of the provided name with the specified subnet, with custom specified options. It is a wrapper around `docker network create`.
func (*SSHMeta) NetworkDelete ¶
NetworkDelete deletes the Docker network of the provided name. It is a wrapper around `docker network rm`.
func (*SSHMeta) NetworkGet ¶
NetworkGet returns all of the Docker network configuration for the provided network. It is a wrapper around `docker network inspect`.
func (*SSHMeta) PolicyDelAll ¶
PolicyDelAll deletes all policy rules currently imported into Cilium.
func (*SSHMeta) PolicyEndpointsSummary ¶
PolicyEndpointsSummary returns the count of whether policy enforcement is enabled, disabled, and the total number of endpoints, and an error if the Cilium endpoint metadata cannot be retrieved via the API.
func (*SSHMeta) PolicyGet ¶
PolicyGet runs `cilium policy get <id>`, where id is the name of a specific policy imported into Cilium. It returns the resultant CmdRes from running the aforementioned command.
func (*SSHMeta) PolicyGetAll ¶
PolicyGetAll gets all policies that are imported in the Cilium agent.
func (*SSHMeta) PolicyGetRevision ¶
PolicyGetRevision retrieves the current policy revision number in the Cilium agent.
func (*SSHMeta) PolicyImport ¶
PolicyImport imports a new policy into Cilium.
func (*SSHMeta) PolicyImportAndWait ¶
PolicyImportAndWait validates and imports a new policy into Cilium and waits until the policy revision number increments. Returns an error if the policy is invalid or could not be imported.
func (*SSHMeta) PolicyRenderAndImport ¶
PolicyRenderAndImport receives an string with a policy, renders it in the test root directory and imports the policy to cilium. It returns the new policy id. Returns an error if the file cannot be created or if the policy cannot be imported
func (*SSHMeta) PolicyWait ¶
PolicyWait executes `cilium policy wait`, which waits until all endpoints are updated to the given policy revision.
func (*SSHMeta) PprofReport ¶
func (s *SSHMeta) PprofReport()
PprofReport runs pprof each 5 minutes and saves the data into the test folder saved with pprof suffix.
func (*SSHMeta) RemoveIPFromLoopbackDevice ¶
RemoveIPFromLoopbackDevice removes the specified IP (assumed to be in form <ip>/<mask>) from the loopback device on s.
func (*SSHMeta) ReportFailed ¶
ReportFailed gathers relevant Cilium runtime data and logs for debugging purposes.
func (*SSHMeta) RestartCilium ¶
RestartCilium reloads cilium on this host, then waits for it to become ready again.
func (*SSHMeta) SampleContainersActions ¶
SampleContainersActions creates or deletes various containers used for testing Cilium and adds said containers to the provided Docker network.
func (*SSHMeta) ServiceAdd ¶
ServiceAdd creates a new Cilium service with the provided ID, frontend, backends. Returns the result of creating said service.
func (*SSHMeta) ServiceDel ¶
ServiceDel is a wrapper around `cilium service delete <id>`. It returns the result of deleting said service.
func (*SSHMeta) ServiceDelAll ¶
ServiceDelAll is a wrapper around `cilium service delete --all`. It returns the result of the command.
func (*SSHMeta) ServiceGet ¶
ServiceGet is a wrapper around `cilium service get <id>`. It returns the result of retrieving said service.
func (*SSHMeta) ServiceGetFrontendAddress ¶
ServiceGetFrontendAddress returns a string with the frontend address and port. It returns an error if the ID cannot be retrieved.
func (*SSHMeta) ServiceGetIds ¶
ServiceGetIds returns an array with the IDs of all Cilium services. Returns an error if the IDs cannot be retrieved
func (*SSHMeta) ServiceIsSynced ¶
ServiceIsSynced checks that the Cilium service with the specified id has its metadata match that of the load balancer BPF maps
func (*SSHMeta) ServiceList ¶
ServiceList returns the output of `cilium service list`
func (*SSHMeta) SetAndWaitForEndpointConfiguration ¶
func (s *SSHMeta) SetAndWaitForEndpointConfiguration(endpointID, optionName, expectedValue string) error
SetAndWaitForEndpointConfiguration waits for the endpoint configuration to become a certain value
func (*SSHMeta) SetPolicyEnforcement ¶
SetPolicyEnforcement sets the PolicyEnforcement configuration value for the Cilium agent to the provided status.
func (*SSHMeta) SetPolicyEnforcementAndWait ¶
SetPolicyEnforcementAndWait and wait sets the PolicyEnforcement configuration value for the Cilium agent to the provided status, and then waits for all endpoints running in s to be ready. Returns whether setting of the configuration value was unsuccessful / if the endpoints go into ready state.
func (*SSHMeta) SetUpCilium ¶
SetUpCilium sets up Cilium as a systemd service with a hardcoded set of options. It returns an error if any of the operations needed to start Cilium fails.
func (*SSHMeta) SetUpCiliumInIpvlanMode ¶ added in v1.5.0
SetUpCiliumInIpvlanMode starts cilium-agent in the ipvlan mode
func (*SSHMeta) SetUpCiliumWithOptions ¶
SetUpCiliumWithOptions sets up Cilium as a systemd service with a given set of options. It returns an error if any of the operations needed to start Cilium fail.
func (*SSHMeta) SetUpCiliumWithSockops ¶ added in v1.5.0
func (*SSHMeta) ValidateEndpointsAreCorrect ¶
ValidateEndpointsAreCorrect is a function that validates that all Docker container that are in the given docker network are correct as cilium endpoints.
func (*SSHMeta) ValidateNoErrorsInLogs ¶
ValidateNoErrorsInLogs checks in cilium logs since the given duration (By default `CurrentGinkgoTestDescription().Duration`) do not contain `panic`, `deadlocks` or `segmentation faults` messages . In case of any of these messages, it'll mark the test as failed.
func (*SSHMeta) WaitEndpointsDeleted ¶
WaitEndpointsDeleted waits up until timeout reached for all endpoints to be deleted. Returns true if all endpoints have been deleted before HelperTimeout is exceeded, false otherwise.
func (*SSHMeta) WaitEndpointsReady ¶
WaitEndpointsReady waits up until timeout reached for all endpoints to not be in any regenerating or waiting-for-identity state. Returns true if all endpoints regenerate before HelperTimeout is exceeded, false otherwise.
func (*SSHMeta) WaitUntilReady ¶
WaitUntilReady waits until the output of `cilium status` returns with code zero. Returns an error if the output of `cilium status` returns a nonzero return code after the specified timeout duration has elapsed.
type SSHMetaError ¶
type SSHMetaError struct {
// contains filtered or unexported fields
}
SSHMetaError is a custom error that executes a callback function when its Error() function is invoked
func NewSSHMetaError ¶
func NewSSHMetaError(errorString string, callback func() string) *SSHMetaError
NewSSHMetaError returns a new SSHMetaError with the given string and a callback function
func (*SSHMetaError) Error ¶
func (e *SSHMetaError) Error() string
func (*SSHMetaError) String ¶
func (e *SSHMetaError) String() string
type TimeoutConfig ¶
type TimeoutConfig struct { Ticker time.Duration // Check interval Timeout time.Duration // Limit for how long to spend in the command }
TimeoutConfig represents the configuration for the timeout of a command.
func (*TimeoutConfig) Validate ¶
func (c *TimeoutConfig) Validate() error
Validate ensuires that the parameters for the TimeoutConfig are reasonable for running in tests.