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() string
- func DestroyVM(scope string) error
- func Fail(description string, callerSkip ...int)
- func GenerateManifestForEndpoints(endpointCount int, manifestPath string) (string, int, error)
- func GetAppPods(apps []string, namespace string, kubectl *Kubectl, appFmt string) map[string]string
- func GetCurrentIntegration() string
- func GetCurrentK8SEnv() string
- func GetFilePath(filename string) string
- func GetK8sDescriptor(descriptorFilename string) string
- func GetScope() (string, error)
- func GetScopeWithVersion() string
- func GetVagrantSSHMetadata(vmName string) ([]byte, error)
- func HoldEnvironment(description ...string)
- func IsRunningOnJenkins() bool
- func K8s1VMName() string
- func K8s2VMName() string
- func MakeUID() string
- func ManifestGet(manifestFilename string) string
- func Netcat(endpoint string, optionalValues ...interface{}) string
- func Netperf(endpoint string, perfTest PerfTest) string
- func Ping(endpoint string) string
- func Ping6(endpoint string) string
- func RenderTemplateToFile(filename string, tmplt string, perm os.FileMode) error
- func RunsOnNetNext() bool
- func SSHAgent() ssh.AuthMethod
- func Sleep(delay time.Duration)
- func Status(key string) map[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
- 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) 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) 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 FilterBuffer
- type Kubectl
- func (kub *Kubectl) Action(action ResourceLifeCycleAction, filePath string) *CmdRes
- func (kub *Kubectl) Apply(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()
- 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) CiliumExecAll(cmd string) error
- 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(dsPatchName, cmPatchName string) error
- func (kub *Kubectl) CiliumInstallVersion(dsPatchName, cmPatchName, versionTag string) error
- func (kub *Kubectl) CiliumIsPolicyLoaded(pod string, policyCmd string) bool
- func (kub *Kubectl) CiliumNodesWait() (bool, error)
- func (kub *Kubectl) CiliumOperatorInstall(versionTag string) 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) CiliumPreFlightInstall(patchName string) error
- func (kub *Kubectl) CiliumReport(namespace string, commands ...string)
- func (kub *Kubectl) Create(filePath string) *CmdRes
- func (kub *Kubectl) CreateResource(resource, resourceName string) *CmdRes
- func (kub *Kubectl) Delete(filePath string) *CmdRes
- func (kub *Kubectl) DeleteETCDOperator() error
- func (kub *Kubectl) DeleteResource(resource, resourceName string) *CmdRes
- func (kub *Kubectl) DeployETCDOperator() error
- func (kub *Kubectl) DeployPatch(original, patch string) error
- func (kub *Kubectl) DumpCiliumCommandOutput(namespace string)
- func (kub *Kubectl) EtcdOperatorReport(reportCmds map[string]string)
- 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) ExecPodCmdContext(ctx context.Context, namespace string, pod string, cmd string) *CmdRes
- func (kub *Kubectl) GatherCiliumCoreDumps(ciliumPod string)
- func (kub *Kubectl) GatherLogs()
- func (kub *Kubectl) GeneratePodLogGatheringCommands(reportCmds map[string]string)
- func (kub *Kubectl) Get(namespace string, command string) *CmdRes
- func (kub *Kubectl) GetAllPods(options ...ExecOptions) ([]v1.Pod, error)
- func (kub *Kubectl) GetCNP(namespace string, cnp string) *cnpv2.CiliumNetworkPolicy
- func (kub *Kubectl) GetCiliumPodOnNode(namespace string, node string) (string, error)
- func (kub *Kubectl) GetCiliumPods(namespace string) ([]string, error)
- func (kub *Kubectl) GetEndpoints(namespace string, filter string) *CmdRes
- func (kub *Kubectl) GetFromAllNS(kind string) *CmdRes
- func (kub *Kubectl) GetNumNodes() int
- func (kub *Kubectl) GetPodNames(namespace string, label string) ([]string, error)
- 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) KubeDNSPreFlightCheck() error
- func (kub *Kubectl) Logs(namespace string, pod string) *CmdRes
- func (kub *Kubectl) MicroscopeStart(microscopeOptions ...string) (error, func() error)
- 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) NodeCleanMetadata() error
- func (kub *Kubectl) PprofReport()
- 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) WaitforPods(namespace string, filter string, timeout time.Duration) error
- 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) BpfLBList(legacy bool, noDuplicates bool) (map[string][]string, error)
- func (s *SSHMeta) BpfLBMapsAreSynced() error
- 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) 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) EndpointStatusLog(id string) *models.EndpointStatusLog
- 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) ExecInBackground(ctx context.Context, 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) GetFullPath(name string) string
- func (s *SSHMeta) ListEndpoints() *CmdRes
- func (s *SSHMeta) ManifestsPath() string
- func (s *SSHMeta) MonitorStart() func() error
- func (s *SSHMeta) NetworkCreate(name string, subnet 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(template string) error
- func (s *SSHMeta) SetUpCiliumWithSockops() error
- func (s *SSHMeta) String() string
- func (s *SSHMeta) ValidateNoErrorsInLogs(duration time.Duration)
- func (s *SSHMeta) WaitEndpointRegenerated(id string) bool
- 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" K8s1Ip = "192.168.36.11" K8s2 = "k8s2" K8s2Ip = "192.168.36.12" 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" // 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" // 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" 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 CiliumStableVersion = "v1.4" CiliumStableImageVersion = "cilium/cilium:" + CiliumStableVersion CiliumDeveloperImage = "k8s1:5000/cilium/cilium-dev:latest" MonitorLogFileName = "monitor.log" // CiliumTestLog is the filename where the cilium logs that happens during // the test are saved. CiliumTestLog = "cilium-test.log" // IPv4Host is an IP which is used in some datapath tests for simulating external IPv4 connectivity. IPv4Host = "192.168.254.254" // IPv6Host is an IP which is used in some datapath tests for simulating external IPv6 connectivity. IPv6Host = "fdff::ff" NACKreceived = "NACK received for version" // from https://github.com/cilium/cilium/issues/4003 RunInitFailed = "JoinEP: " // from https://github.com/cilium/cilium/pull/5052 )
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 // EnableMicroscope is true when microscope should be enabled EnableMicroscope = false // CIIntegrationFlannel contains the constant to be used when flannel is // used in the CI. CIIntegrationFlannel = "flannel" )
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") // 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 CiliumDefaultDSPatch = "cilium-ds-patch.yaml"
CiliumDefaultDSPatch is the default Cilium DaemonSet patch to be used in all tests.
const CiliumDefaultPreFlight = "cilium-pre-flight.yaml"
CiliumDefaultPreFlight is the default Cilium Pre-flight DaemonSet descriptor to be used in all tests.
const CiliumDefaultPreFlightPatch = "cilium-pre-flight-patch.yaml"
CiliumDefaultPreFlightPatch is the default Cilium Pre-flight 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 = 5 * time.Minute // CiliumStartTimeout is a predefined timeout value for Cilium startup. CiliumStartTimeout = 100 * time.Second // CiliumBasePath is the absolute path to the cilium source repository // in the guest VMs CiliumBasePath = "/home/vagrant/go/src/github.com/cilium/cilium" // BasePath is the path in the Vagrant VMs to which the test directory // is mounted BasePath = path.Join(CiliumBasePath, "test") // 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 ( CiliumV1_0 = versioncheck.MustCompile(">=v1.0,<v1.1") CiliumV1_1 = versioncheck.MustCompile(">=v1.1,<v1.2") CiliumV1_2 = versioncheck.MustCompile(">=v1.2,<v1.3") CiliumV1_3 = versioncheck.MustCompile(">=v1.2.90,<v1.4") CiliumV1_4 = versioncheck.MustCompile(">=v1.3.90,<v1.5") CiliumV1_5 = versioncheck.MustCompile(">=v1.4.90,<v1.6") )
var NightlyStableUpgradesFrom = []string{"v1.3"}
NightlyStableUpgradesFrom the cilium images to update from in 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 ¶
func DNSDeployment() string
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 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 ¶
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 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 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 GetFilePath ¶
GetFilePath returns the absolute path of the provided filename
func GetK8sDescriptor ¶
GetK8sDescriptor returns the full path of the given descriptorFilename that exists in the descriptorsPath. If not found, the returned path will be empty.
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 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 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.
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 RenderTemplateToFile ¶
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 RunsOnNetNext ¶
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 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 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.
Types ¶
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) 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 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 { *SSHMeta // 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) *CmdRes
Action performs the specified ResourceLifeCycleAction on the Kubernetes manifest located at path filepath in the given namespace
func (*Kubectl) BackgroundReport ¶
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 ¶
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 ¶
func (kub *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) 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 ¶
CiliumEndpointsStatus returns a mapping of a pod name to it is corresponding endpoint's status
func (*Kubectl) CiliumExec ¶
CiliumExec runs cmd in the specified Cilium pod. Deprecated: use CiliumExecContext instead
func (*Kubectl) CiliumExecAll ¶
CiliumExecAll runs cmd in all cilium instances
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 all Cilium descriptors into kubernetes. dsPatchName corresponds to the DaemonSet patch that will be applied to the original Cilium DaemonSet descriptor. cmPatchName corresponds to the ConfigMap patch that will be applied to the original Cilium ConfigMap descriptor. Returns an error if any patch or if any original descriptors files were not found.
func (*Kubectl) CiliumInstallVersion ¶
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) CiliumOperatorInstall ¶
CiliumOperatorInstall install Cilium operator based on the version that it's needed.
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) CiliumPreFlightInstall ¶
CiliumPreFlightInstall install Cilium pre-flight DaemonSet.
func (*Kubectl) CiliumReport ¶
CiliumReport report the cilium pod to the log and appends the logs for the given commands.
func (*Kubectl) CreateResource ¶
CreateResource is a wrapper around `kubernetes create <resource> <resourceName>.
func (*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) DeployETCDOperator ¶
DeployETCDOperator deploys the etcd-operator k8s descriptors into the cluster pointer by kub.
func (*Kubectl) DeployPatch ¶
DeployPatch 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 ¶
EtcdOperatorReport dump etcd pods data into the report directory to be able to debug etcd operator status in case of fail test.
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) ExecPodCmdContext ¶
func (kub *Kubectl) ExecPodCmdContext(ctx context.Context, namespace string, pod string, cmd string) *CmdRes
ExecPodCmdContext executes command cmd in background in the specified pod residing in the specified namespace. 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 ¶
func (kub *Kubectl) GatherLogs()
GatherLogs dumps kubernetes pods, services, DaemonSet to the testResultsPath directory
func (*Kubectl) GeneratePodLogGatheringCommands ¶
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 ¶
func (kub *Kubectl) GetAllPods(options ...ExecOptions) ([]v1.Pod, error)
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) GetCiliumPodOnNode ¶
GetCiliumPodOnNode returns the name of the Cilium pod that is running on / in the specified node / namespace.
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) GetEndpoints ¶
GetEndpoints gets all of the endpoints in the given namespace that match the provided filter.
func (*Kubectl) GetFromAllNS ¶
GetFromAllNS retrieves provided Kubernetes objects from all namespaces
func (*Kubectl) GetNumNodes ¶
GetNumNodes returns the number of Kubernetes nodes running
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) 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) KubeDNSPreFlightCheck ¶
KubeDNSPreFlightCheck makes sure that kube-dns is plumbed into Cilium.
func (*Kubectl) Logs ¶
Logs returns a CmdRes with containing the resulting metadata from the execution of `kubectl logs <pod> -n <namespace>`.
func (*Kubectl) MicroscopeStart ¶
MicroscopeStart installs (if it is not installed) a new microscope pod, waits until pod is ready, and runs microscope in background. It returns an error in the case where microscope cannot be installed, or it is not ready after a timeout. It also returns a callback function to stop the monitor and save the output to `helpers.monitorLogFileName` file. Takes an optional list of arguments to pass to mircoscope.
func (*Kubectl) MonitorStart ¶ added in v1.5.2
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) NodeCleanMetadata ¶
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) 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 (*Kubectl) WaitCleanAllTerminatingPods ¶
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) 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 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) BpfLBMapsAreSynced ¶
BpfLBMapsAreSynced checks whether the v2 and legacy BPF maps contain the same endpoints.
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) 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) EndpointStatusLog ¶
func (s *SSHMeta) EndpointStatusLog(id string) *models.EndpointStatusLog
EndpointStatusLog returns the status log API model for the specified endpoint. Returns nil if no endpoint corresponds to the provided ID.
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) 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) 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) 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) 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 ¶
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 ¶
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) WaitEndpointRegenerated ¶
WaitEndpointRegenerated attempts up until MaxRetries are exceeded for the endpoint with the specified ID to be in "ready" state. Returns false if no such endpoint corresponds to the given id or if MaxRetries are exceeded.
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