From 80a0fde867b878d88ea3615a1b6a27a236f8c1b7 Mon Sep 17 00:00:00 2001 From: Tom Zaspel <40226087+tzabbi@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:47:39 +0200 Subject: [PATCH] fix dex-login-test (#2830) * fix dex-login-test: - set executable permission for python script - set shebang line in python script Signed-off-by: Tom Zaspel <40226087+tzabbi@users.noreply.github.com> * Add all required componentes which have to be installed to test dex login Signed-off-by: Tom Zaspel * Add kustomizeation file to deploy all required stuff to test dex login Signed-off-by: Tom Zaspel * Add statuscode response in dex login Signed-off-by: Tom Zaspel <40226087+tzabbi@users.noreply.github.com> --------- Signed-off-by: Tom Zaspel <40226087+tzabbi@users.noreply.github.com> Signed-off-by: Tom Zaspel --- .github/workflows/dex_test.yaml | 6 +- .../kustomization.yaml | 58 +++++++++++++++++++ tests/gh-actions/test_dex_login.py | 4 +- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 tests/gh-actions/deploy-dex-login-environment/kustomization.yaml mode change 100644 => 100755 tests/gh-actions/test_dex_login.py diff --git a/.github/workflows/dex_test.yaml b/.github/workflows/dex_test.yaml index 4bf8a22bff..8a9be13475 100644 --- a/.github/workflows/dex_test.yaml +++ b/.github/workflows/dex_test.yaml @@ -17,13 +17,9 @@ jobs: - name: Install KinD, Create KinD cluster and Install kustomize run: ./tests/gh-actions/install_KinD_create_KinD_cluster_install_kustomize.sh - - name: Install Istio - run: ./tests/gh-actions/install_istio.sh - - name: Build & Apply manifests run: | - cd common/dex - kustomize build overlays/istio | kubectl apply -f - + while ! kustomize build ./tests/gh-actions/deploy-dex-login-environment | kubectl apply -f -; do echo "Retrying to apply resources"; sleep 20; done kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout 180s - name: port forward diff --git a/tests/gh-actions/deploy-dex-login-environment/kustomization.yaml b/tests/gh-actions/deploy-dex-login-environment/kustomization.yaml new file mode 100644 index 0000000000..2fbf5ee86d --- /dev/null +++ b/tests/gh-actions/deploy-dex-login-environment/kustomization.yaml @@ -0,0 +1,58 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +sortOptions: + order: legacy + legacySortOptions: + orderFirst: + - Namespace + - ResourceQuota + - StorageClass + - CustomResourceDefinition + - MutatingWebhookConfiguration + - ServiceAccount + - PodSecurityPolicy + - NetworkPolicy + - Role + - ClusterRole + - RoleBinding + - ClusterRoleBinding + - ConfigMap + - Secret + - Endpoints + - Service + - LimitRange + - PriorityClass + - PersistentVolume + - PersistentVolumeClaim + - Deployment + - StatefulSet + - CronJob + - PodDisruptionBudget + orderLast: + - ValidatingWebhookConfiguration + +resources: +# Istio +- ../../../common/istio-1-22/istio-crds/base +- ../../../common/istio-1-22/istio-namespace/base +- ../../../common/istio-1-22/istio-install/overlays/oauth2-proxy +# oauth2-proxy +- ../../../common/oauth2-proxy/overlays/m2m-self-signed +# Dex +- ../../../common/dex/overlays/oauth2-proxy +- ../../../common/istio-1-22/cluster-local-gateway/base +# Kubeflow namespace +- ../../../common/kubeflow-namespace/base +# NetworkPolicies +- ../../../common/networkpolicies/base +# Kubeflow Roles +- ../../../common/kubeflow-roles/base +# Kubeflow Istio Resources +- ../../../common/istio-1-22/kubeflow-istio-resources/base +# Central Dashboard +- ../../../apps/centraldashboard/overlays/oauth2-proxy +# Profiles + KFAM +- ../../../apps/profiles/upstream/overlays/kubeflow +# User namespace +- ../../../common/user-namespace/base diff --git a/tests/gh-actions/test_dex_login.py b/tests/gh-actions/test_dex_login.py old mode 100644 new mode 100755 index b027d5ba92..b93c6ed5a9 --- a/tests/gh-actions/test_dex_login.py +++ b/tests/gh-actions/test_dex_login.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import re import requests import sys @@ -101,7 +103,7 @@ def get_istio_auth_session(url: str, username: str, password: str) -> dict: username=KUBEFLOW_USERNAME, password=KUBEFLOW_PASSWORD ) - +print(f"{resp}") if resp == 200: sys.exit(0) else: