Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E: add frr-k8s-external deployment entry #500

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down Expand Up @@ -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() }}
Expand Down Expand Up @@ -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() }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
25 changes: 15 additions & 10 deletions test/e2e/functional/tests/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
UseMetallbResourcesFromFile = false
OperatorNameSpace = consts.DefaultOperatorNameSpace
isOpenshift = false
frrk8sNamespace = OperatorNameSpace
)

func init() {
Expand All @@ -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() {
Expand Down Expand Up @@ -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)})
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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)
}
}

Expand All @@ -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),
)

})
Expand Down
Loading