Documentation ¶
Overview ¶
Index ¶
- Constants
- Variables
- func CheckDeploymentCleanedUp(ctx context.Context, t *testing.T, client klient.Client)
- func CheckImageRemoved(ctx context.Context, t *testing.T, nodes []string, images ...string)
- func CheckImagesExist(t *testing.T, nodes []string, images ...string)
- func ContainerNotPresentOnNode(nodeName, containerName string) func() (bool, error)
- func CreateExclusionList(namespace string, list string) env.Func
- func DeleteImageListsAndJobs(kubeConfig string) error
- func DeleteStringFromSlice(strings []string, s string) []string
- func DeployEraserConfig(kubeConfig, namespace, fileName string) error
- func DeployEraserHelm(namespace string, args ...string) env.Func
- func DeployEraserManifest(namespace, fileName string) env.Func
- func DeployOtelCollector(namespace string) env.Func
- func DockerPullImage(image string) (string, error)
- func DockerTagImage(image, tag string) (string, error)
- func GetClusterNodes(t *testing.T) []string
- func GetImageJob(ctx context.Context, cfg *envconf.Config) (eraserv1.ImageJob, error)
- func GetPodLogs(t *testing.T) error
- func Helm(args []string) (string, error)
- func HelmDeployLatestEraserRelease(namespace string, extraArgs ...string) env.Func
- func HelmInstall(kubeconfigPath, namespace string, args []string) error
- func HelmUninstall(kubeconfigPath, namespace string, args []string) error
- func HelmUpgrade(kubeconfigPath, namespace string, args []string) error
- func ImagejobNotInCluster(kubeconfigPath string) func() (bool, error)
- func IsNotFound(err error) bool
- func Kubectl(args []string) (string, error)
- func KubectlApply(kubeconfigPath, namespace string, args []string) error
- func KubectlBackground(args []string) error
- func KubectlCurlPod(kubeconfigPath, namespace string) (string, error)
- func KubectlDelete(kubeconfigPath, namespace string, args []string) error
- func KubectlDescribe(kubeconfigPath, podName, namespace string) (string, error)
- func KubectlExecCurl(kubeconfigPath, podName string, endpoint, namespace string) (string, error)
- func KubectlGet(kubeconfigPath string, otherArgs ...string) (string, error)
- func KubectlLogs(kubeconfigPath, podName, containerName, namespace string, extraArgs ...string) (string, error)
- func KubectlWait(kubeconfigPath, podName, namespace string) (string, error)
- func ListNodeContainers(nodeName string) (string, error)
- func ListNodeImages(nodeName string) (string, error)
- func LoadImageToCluster(clusterName, imageRef, tarballPath string) env.Func
- func MakeDeploy(env map[string]string) env.Func
- func NewDeployment(namespace, name string, replicas int32, labels map[string]string, ...) *appsv1.Deployment
- func NewPod(namespace, image, name, nodeName string) *corev1.Pod
- func NumPodsPresentForLabel(ctx context.Context, client klient.Client, num int, label string) func() (bool, error)
- func UpgradeEraserHelm(namespace string, args ...string) env.Func
- type HelmPath
- type HelmSet
- type Images
- type RepoTag
Constants ¶
View Source
const ( KindClusterName = "eraser-e2e-test" ProviderResource = "eraser.yaml" Alpine = "alpine" Nginx = "nginx" NginxLatest = "ghcr.io/eraser-dev/eraser/e2e-test/nginx:latest" NginxAliasOne = "ghcr.io/eraser-dev/eraser/e2e-test/nginx:one" NginxAliasTwo = "ghcr.io/eraser-dev/eraser/e2e-test/nginx:two" Redis = "redis" Caddy = "caddy" Prune = "imagelist" ImagePullSecret = "testsecret" FilterNodeName = "eraser-e2e-test-worker" FilterNodeSelector = "kubernetes.io/hostname=eraser-e2e-test-worker" FilterLabelKey = "eraser.sh/cleanup.filter" FilterLabelValue = "true" )
View Source
const ( CollectorEnable = HelmPath("runtimeConfig.components.collector.enabled") CollectorImageRepo = HelmPath("runtimeConfig.components.collector.image.repo") CollectorImageTag = HelmPath("runtimeConfig.components.collector.image.tag") ScannerConfig = HelmPath("runtimeConfig.components.scanner.config") ScannerEnable = HelmPath("runtimeConfig.components.scanner.enabled") ScannerImageRepo = HelmPath("runtimeConfig.components.scanner.image.repo") ScannerImageTag = HelmPath("runtimeConfig.components.scanner.image.tag") RemoverImageRepo = HelmPath("runtimeConfig.components.remover.image.repo") RemoverImageTag = HelmPath("runtimeConfig.components.remover.image.tag") ManagerImageRepo = HelmPath("deploy.image.repo") ManagerImageTag = HelmPath("deploy.image.tag") ImagePullSecrets = HelmPath("runtimeConfig.manager.pullSecrets") OTLPEndpoint = HelmPath("runtimeConfig.manager.otlpEndpoint") CleanupOnSuccessDelay = HelmPath("runtimeConfig.manager.imageJob.cleanup.delayOnSuccess") FilterNodesType = HelmPath("runtimeConfig.manager.nodeFilter.type") ScheduleImmediate = HelmPath("runtimeConfig.manager.scheduling.beginImmediately") CustomRuntimeAddress = HelmPath("runtimeConfig.manager.runtime.address") CustomRuntimeName = HelmPath("runtimeConfig.manager.runtime.name") CollectorLabel = "collector" ManualLabel = "manual" ImageJobTypeLabelKey = "eraser.sh/type" ManagerLabelKey = "control-plane" ManagerLabelValue = "controller-manager" )
Variables ¶
View Source
var ( Testenv env.Environment RemoverImage = os.Getenv("REMOVER_IMAGE") ManagerImage = os.Getenv("MANAGER_IMAGE") CollectorImage = os.Getenv("COLLECTOR_IMAGE") ScannerImage = os.Getenv("SCANNER_IMAGE") VulnerableImage = os.Getenv("VULNERABLE_IMAGE") NonVulnerableImage = os.Getenv("NON_VULNERABLE_IMAGE") EOLImage = os.Getenv("EOL_IMAGE") BusyboxImage = os.Getenv("BUSYBOX_IMAGE") CollectorDummyImage = os.Getenv("COLLECTOR_IMAGE_DUMMY") RemoverTarballPath = os.Getenv("REMOVER_TARBALL_PATH") ManagerTarballPath = os.Getenv("MANAGER_TARBALL_PATH") CollectorTarballPath = os.Getenv("COLLECTOR_TARBALL_PATH") ScannerTarballPath = os.Getenv("SCANNER_TARBALL_PATH") ProjectAbsDir = os.Getenv("PROJECT_ABSOLUTE_PATH") E2EPath = filepath.Join(ProjectAbsDir, "test", "e2e") TestDataPath = filepath.Join(E2EPath, "test-data") KindConfigPath = filepath.Join(E2EPath, "kind-config.yaml") KindConfigCustomRuntimePath = filepath.Join(E2EPath, "kind-config-custom-runtime.yaml") HelmEmptyValuesPath = filepath.Join(TestDataPath, "helm-empty-values.yaml") ChartPath = filepath.Join(ProjectAbsDir, providerResourceChartDir) DeployPath = filepath.Join(ProjectAbsDir, providerResourceDeployDir) OTELCollectorConfigPath = filepath.Join(TestDataPath, "otelcollector.yaml") EraserV1Alpha1ImagelistUpdatedPath = filepath.Join(TestDataPath, "eraser_v1alpha1_imagelist_updated.yaml") EraserV1Alpha1ImagelistPath = filepath.Join(TestDataPath, "eraser_v1alpha1_imagelist.yaml") EraserV1ImagelistPath = filepath.Join(TestDataPath, "eraser_v1_imagelist.yaml") ImagelistAlpinePath = filepath.Join(TestDataPath, "imagelist_alpine.yaml") NodeVersion = os.Getenv("NODE_VERSION") ModifiedNodeImage = os.Getenv("MODIFIED_NODE_IMAGE") TestNamespace = envconf.RandomName("test-ns", 16) EraserNamespace = pkgUtil.GetNamespace() TestLogDir = os.Getenv("TEST_LOGDIR") ParsedImages *Images Timeout = time.Minute * 5 ImagePullSecretJSON = fmt.Sprintf(`["%s"]`, ImagePullSecret) ScannerConfigNoDeleteFailedJSON = `` /* 330-byte string literal not displayed */ ManagerAdditionalArgs = HelmSet{ // contains filtered or unexported fields } )
Functions ¶
func CheckImageRemoved ¶
func DeleteImageListsAndJobs ¶
func DeleteStringFromSlice ¶
func DeployEraserConfig ¶
deploy eraser config.
func DeployEraserManifest ¶
func DeployOtelCollector ¶
func DockerPullImage ¶
func DockerTagImage ¶
func GetClusterNodes ¶
This lists nodes in the cluster, filtering out the control-plane.
func GetImageJob ¶
func GetPodLogs ¶
func HelmInstall ¶
HelmInstall executes "helm install" given a list of arguments.
func HelmUninstall ¶
HelmUninstall executes "helm uninstall" given a list of arguments.
func HelmUpgrade ¶
HelmUpgrade executes "helm upgrade" given a list of arguments.
func ImagejobNotInCluster ¶
func IsNotFound ¶
func KubectlApply ¶
KubectlApply executes "kubectl apply" given a list of arguments.
func KubectlBackground ¶
func KubectlCurlPod ¶
KubectlDescribe executes "kubectl describe" given a list of arguments.
func KubectlDelete ¶
KubectlDelete executes "kubectl delete" given a list of arguments.
func KubectlDescribe ¶
KubectlDescribe executes "kubectl describe" given a list of arguments.
func KubectlExecCurl ¶
func KubectlGet ¶
KubectlGet executes "kubectl get" given a list of arguments.
func KubectlLogs ¶
func KubectlLogs(kubeconfigPath, podName, containerName, namespace string, extraArgs ...string) (string, error)
KubectlLogs executes "kubectl logs" given a list of arguments.
func KubectlWait ¶
func ListNodeContainers ¶
func ListNodeImages ¶
func LoadImageToCluster ¶
func NewDeployment ¶
func NumPodsPresentForLabel ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.