diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 70d2249c9..0ecfb0331 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -88,7 +88,7 @@ jobs: run: | export KUBECONFIG=${HOME}/.kube/config make test-validation - make test-e2e + SKIP="FRR-K8s-external" make test-e2e - name: Collect Logs if: ${{ failure() }} @@ -125,7 +125,7 @@ jobs: run: | export KUBECONFIG=${HOME}/.kube/config make test-validation - make test-e2e + SKIP="FRR-K8s-external" make test-e2e - name: Collect Logs if: ${{ failure() }} @@ -182,7 +182,7 @@ jobs: run: | export KUBECONFIG=${HOME}/.kube/config make test-validation - make test-e2e + SKIP="FRR-K8s-external" make test-e2e - name: Collect Logs if: ${{ failure() }} @@ -218,7 +218,7 @@ jobs: cd ${GITHUB_WORKSPACE}/metallboperator-latest export KUBECONFIG=${HOME}/.kube/config make test-validation - make test-e2e + SKIP="FRR-K8s-external" make test-e2e - name: Checkout uses: actions/checkout@v4 @@ -367,7 +367,7 @@ jobs: run: | export KUBECONFIG=${HOME}/.kube/config make test-validation - make test-e2e + SKIP="FRR-K8s-external" make test-e2e kubectl wait -n metallb-system --for=delete pod -l "component in (speaker,controller,frr-k8s,frr-k8s-webhook-server)" --timeout=180s - name: Deploy MetalLB resource diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 98b2433bb..42b73ec21 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -48,7 +48,7 @@ jobs: run: | export KUBECONFIG=${HOME}/.kube/config make test-validation - SKIP="frr-k8s" make test-e2e + SKIP="FRR-K8s-external" make test-e2e - name: Archive E2E Tests logs if: ${{ failure() }} diff --git a/test/e2e/functional/tests/e2e.go b/test/e2e/functional/tests/e2e.go index ad22e5883..2254ca4c2 100644 --- a/test/e2e/functional/tests/e2e.go +++ b/test/e2e/functional/tests/e2e.go @@ -30,6 +30,7 @@ var ( UseMetallbResourcesFromFile = false OperatorNameSpace = consts.DefaultOperatorNameSpace isOpenshift = false + frrk8sNamespace = OperatorNameSpace ) func init() { @@ -43,6 +44,9 @@ func init() { if os.Getenv("IS_OPENSHIFT") != "" { isOpenshift = true } + if ns := os.Getenv("FRRK8S_EXTERNAL_NAMESPACE"); ns != "" { + frrk8sNamespace = ns + } } var _ = Describe("metallb", func() { @@ -81,8 +85,8 @@ var _ = Describe("metallb", func() { }) DescribeTable("with BGP type", func(bgpType metallbv1beta1.BGPType) { - if isOpenshift && bgpType == metallbv1beta1.NativeMode { - Skip("Native mode not supported with openshift") + if isOpenshift && bgpType != metallbv1beta1.FRRK8sExternalMode { + Skip("only frr-k8s-external is supported on OpenShift") } checkControllerBGPMode := func(mode metallbv1beta1.BGPType) { bgpTypeMatcher := ContainElement(corev1.EnvVar{Name: "METALLB_BGP_TYPE", Value: string(mode)}) @@ -255,24 +259,24 @@ var _ = Describe("metallb", func() { } By("checking frr-k8s daemonset is in running state") Eventually(func() error { - daemonset, err := testclient.Client.DaemonSets(metallb.Namespace).Get(context.Background(), consts.FRRK8SDaemonsetName, metav1.GetOptions{}) + daemonset, err := testclient.Client.DaemonSets(frrk8sNamespace).Get(context.Background(), consts.FRRK8SDaemonsetName, metav1.GetOptions{}) if err != nil { return err } - pods, err := testclient.Client.Pods(OperatorNameSpace).List(context.Background(), metav1.ListOptions{ + pods, err := testclient.Client.Pods(frrk8sNamespace).List(context.Background(), metav1.ListOptions{ LabelSelector: "component=frr-k8s"}) if err != nil { return err } if len(pods.Items) != int(daemonset.Status.DesiredNumberScheduled) { - return fmt.Errorf("daemonset %s pods are not ready, expected %d generations got %d pods", consts.MetalLBDaemonsetName, int(daemonset.Status.DesiredNumberScheduled), len(pods.Items)) + return fmt.Errorf("daemonset %s pods are not ready, expected %d generations got %d pods", consts.FRRK8SDaemonsetName, int(daemonset.Status.DesiredNumberScheduled), len(pods.Items)) } for _, pod := range pods.Items { if pod.Status.Phase != corev1.PodRunning { - return fmt.Errorf("daemonset %s pod %s is not running, expected status %s got %s", consts.MetalLBDaemonsetName, pod.Name, corev1.PodRunning, pod.Status.Phase) + return fmt.Errorf("daemonset %s pod %s is not running, expected status %s got %s", consts.FRRK8SDaemonsetName, pod.Name, corev1.PodRunning, pod.Status.Phase) } } @@ -281,24 +285,24 @@ var _ = Describe("metallb", func() { By("checking frr-k8s webhook deployment is in running state") Eventually(func() error { - deploy, err := testclient.Client.Deployments(metallb.Namespace).Get(context.Background(), consts.FRRK8SWebhookDeploymentName, metav1.GetOptions{}) + deploy, err := testclient.Client.Deployments(frrk8sNamespace).Get(context.Background(), consts.FRRK8SWebhookDeploymentName, metav1.GetOptions{}) if err != nil { return err } - pods, err := testclient.Client.Pods(OperatorNameSpace).List(context.Background(), metav1.ListOptions{ + pods, err := testclient.Client.Pods(frrk8sNamespace).List(context.Background(), metav1.ListOptions{ LabelSelector: "component=frr-k8s-webhook-server"}) if err != nil { return err } if len(pods.Items) != int(deploy.Status.Replicas) { - return fmt.Errorf("deployment %s pods are not ready, expected %d replicas got %d pods", consts.MetalLBOperatorDeploymentName, deploy.Status.Replicas, len(pods.Items)) + return fmt.Errorf("deployment %s pods are not ready, expected %d replicas got %d pods", consts.FRRK8SWebhookDeploymentName, deploy.Status.Replicas, len(pods.Items)) } for _, pod := range pods.Items { if pod.Status.Phase != corev1.PodRunning { - return fmt.Errorf("deployment %s pod %s is not running, expected status %s got %s", consts.MetalLBOperatorDeploymentName, pod.Name, corev1.PodRunning, pod.Status.Phase) + return fmt.Errorf("deployment %s pod %s is not running, expected status %s got %s", consts.FRRK8SWebhookDeploymentName, pod.Name, corev1.PodRunning, pod.Status.Phase) } } @@ -309,6 +313,7 @@ var _ = Describe("metallb", func() { Entry("Native Mode", metallbv1beta1.NativeMode), Entry("FRR Mode", metallbv1beta1.FRRMode), Entry("FRR-K8s Mode", metallbv1beta1.FRRK8sMode), + Entry("FRR-K8s-external Mode", metallbv1beta1.FRRK8sExternalMode), ) })