improve the tests with real KF profile namespaces #354
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Apply Katib manifests in KinD | |
on: | |
pull_request: | |
paths: | |
- tests/gh-actions/install_KinD_create_KinD_cluster_install_kustomize.sh | |
- tests/gh-actions/install_katib.sh | |
- .github/workflows/katib_test.yaml | |
- apps/katib/upstream/** | |
- tests/gh-actions/install_istio-cni.sh | |
- common/istio*/** | |
- tests/gh-actions/install_cert_manager.sh | |
- common/cert-manager/** | |
- experimental/security/PSS/* | |
env: | |
KF_PROFILE: kubeflow-user-example-com | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install KinD, Create KinD cluster and Install kustomize | |
run: ./tests/gh-actions/install_KinD_create_KinD_cluster_install_kustomize.sh | |
- name: Install kubectl | |
run: ./tests/gh-actions/install_kubectl.sh | |
- name: Create Kubeflow Namespace | |
run: kustomize build common/kubeflow-namespace/base | kubectl apply -f - | |
- name: Install Certificate Manager | |
run: ./tests/gh-actions/install_cert_manager.sh | |
- name: Install Istio CNI | |
run: ./tests/gh-actions/install_istio-cni.sh | |
- name: Install OAuth2 Proxy | |
run: ./tests/gh-actions/install_oauth2-proxy.sh | |
- name: Install Kubeflow Istio Resources | |
run: kustomize build common/istio-cni-1-24/kubeflow-istio-resources/base | kubectl apply -f - | |
- name: Install Multi-Tenancy | |
run: ./tests/gh-actions/install_multi_tenancy.sh | |
- name: Create KF Profile | |
run: ./tests/gh-actions/install_kubeflow_profile.sh | |
- name: Install Katib | |
run: ./tests/gh-actions/install_katib.sh | |
- name: Install Dependencies | |
run: pip install pytest kubernetes kfp==2.11.0 requests | |
- name: Port-forward the istio-ingress gateway | |
run: ./tests/gh-actions/port_forward_gateway.sh | |
- name: Run Katib Test | |
run: | | |
kubectl apply -f tests/gh-actions/kf-objects/katib_test.yaml | |
kubectl wait --for=condition=Running experiments.kubeflow.org -n $KF_PROFILE --all --timeout=300s | |
echo "Waiting for all Trials to be Completed..." | |
kubectl wait --for=condition=Created trials.kubeflow.org -n $KF_PROFILE --all --timeout=60s | |
kubectl get trials.kubeflow.org -n $KF_PROFILE | |
kubectl wait --for=condition=Succeeded trials.kubeflow.org -n $KF_PROFILE --all --timeout 600s | |
kubectl get trials.kubeflow.org -n $KF_PROFILE | |
- name: Test Authorized Katib Access | |
run: kubectl get experiments.kubeflow.org -n $KF_PROFILE --token="$(kubectl -n $KF_PROFILE create token default-editor)" | |
- name: Test Unauthorized Katib Access | |
run: | | |
kubectl create namespace test-unauthorized | |
kubectl create serviceaccount test-unauthorized -n test-unauthorized | |
UNAUTHORIZED_TOKEN=$(kubectl -n test-unauthorized create token test-unauthorized) | |
kubectl get experiments.kubeflow.org -n $KF_PROFILE --token="$UNAUTHORIZED_TOKEN" >/dev/null | |
- name: Apply Pod Security Standards baseline levels | |
run: ./tests/gh-actions/enable_baseline_PSS.sh | |
- name: Unapply applied baseline labels | |
run: | | |
NAMESPACES=("istio-system" "auth" "cert-manager" "oauth2-proxy" "kubeflow") | |
for NAMESPACE in "${NAMESPACES[@]}"; do | |
if kubectl get namespace "$NAMESPACE" >/dev/null 2>&1; then | |
kubectl label namespace $NAMESPACE pod-security.kubernetes.io/enforce- | |
fi | |
done | |
- name: Applying Pod Security Standards restricted levels | |
run: ./tests/gh-actions/enable_restricted_PSS.sh |