Skip to content

ci: Enhance the GHA #15

ci: Enhance the GHA

ci: Enhance the GHA #15

name: Profiles/KFAM Integration Tests
on:
pull_request:
paths:
- components/profile-controller/**
- components/access-management/**
- releasing/version/VERSION
- .github/workflows/profiles_kfam_integration_test.yaml
branches:
- main
- v*-branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
cancel-in-progress: true
env:
PROFILE_IMG: ghcr.io/kubeflow/kubeflow/profile-controller
KFAM_IMG: ghcr.io/kubeflow/kubeflow/kfam
TAG: integration-test
jobs:
integration-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install KinD
run: ./testing/gh-actions/install_kind.sh
- name: Create KinD Cluster
run: kind create cluster --config testing/gh-actions/kind-1-25.yaml
- name: Install kustomize
run: ./testing/gh-actions/install_kustomize.sh
- name: Install Istio
run: ./testing/gh-actions/install_istio.sh
- name: Create Kubeflow Namespace
run: kubectl create namespace kubeflow
- name: Make Scripts Executable
run: chmod +x testing/gh-actions/*.sh
- name: Deploy Profile Controller Component
run: |
./testing/gh-actions/deploy_component.sh \
"profile-controller" \
"components/profile-controller" \
"${PROFILE_IMG}" \
"${TAG}" \
"config" \
"overlays/kubeflow"
- name: Wait for Profile Controller to be Ready
run: |
kubectl wait --for=condition=Ready pods -n kubeflow -l kustomize.component=profiles --timeout=300s
kubectl wait --for=condition=Available deployment -n kubeflow profiles-deployment --timeout=300s
- name: Deploy KFAM Component
run: |
./testing/gh-actions/deploy_component.sh \
"access-management" \
"components/access-management" \
"${KFAM_IMG}" \
"${TAG}" \
"kfam/manifests" \
"cluster-scoped-cluster-admin"
- name: Wait for KFAM to be Ready (with fallback deployment)
run: |
# Wait for KFAM pods or create fallback deployment
if ! kubectl wait --for=condition=Ready pods -n kubeflow -l app=kfam --timeout=120s; then
echo "Creating fallback KFAM deployment..."
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: kfam
namespace: kubeflow
labels:
app: kfam
spec:
replicas: 1
selector:
matchLabels:
app: kfam
template:
metadata:
labels:
app: kfam
spec:
containers:
- name: kfam
image: ${KFAM_IMG}:${TAG}
ports:
- containerPort: 8081
env:
- name: CLUSTER_ADMIN
value: "true"
- name: USERID_HEADER
value: "kubeflow-userid"
- name: USERID_PREFIX
value: ""
---
apiVersion: v1
kind: Service
metadata:
name: kfam
namespace: kubeflow
spec:
selector:
app: kfam
ports:
- port: 8081
targetPort: 8081
EOF
kubectl wait --for=condition=Ready pods -n kubeflow -l app=kfam --timeout=180s
fi
- name: Test Profile CRD Installation
run: |
kubectl get crd profiles.kubeflow.org
kubectl describe crd profiles.kubeflow.org
- name: Create Test Profile with Resource Quotas
run: |
./testing/gh-actions/test_profile.sh create test-profile-user [email protected]
- name: Validate Test Profile Resources
run: |
./testing/gh-actions/test_profile.sh validate test-profile-user
- name: Test Profile Update
run: |
./testing/gh-actions/test_profile.sh update test-profile-user
- name: Create Simple Test Profile
run: |
./testing/gh-actions/test_profile.sh create-simple simple-profile [email protected]
- name: Validate Simple Profile Resources
run: |
./testing/gh-actions/test_profile.sh validate simple-profile
- name: Test KFAM Service Health
run: |
kubectl port-forward -n kubeflow service/kfam 8081:8081 &
sleep 10
./testing/gh-actions/test_service.sh test-kfam kfam kubeflow 8081
- name: Test KFAM API with User Context
run: |
./testing/gh-actions/test_service.sh test-api-with-user kfam kubeflow 8081 80 [email protected] test-profile-user
- name: Test Profile Status and Conditions
run: |
kubectl get profile test-profile-user -o yaml
kubectl get profile simple-profile -o yaml
- name: List All Profiles
run: |
./testing/gh-actions/test_profile.sh list
- name: Check KFAM Logs
run: |
kubectl logs -n kubeflow -l app=kfam --tail=50
- name: Check Profile Controller Logs
run: |
kubectl logs -n kubeflow -l kustomize.component=profiles --tail=50
- name: Check for Errors in Logs
run: |
kubectl logs -n kubeflow -l app=kfam --tail=100 | grep -i error || echo "No errors found in KFAM logs"
kubectl logs -n kubeflow -l kustomize.component=profiles --tail=100 | grep -i error || echo "No errors found in Profile Controller logs"
- name: Stop Port Forward
run: |
./testing/gh-actions/test_service.sh stop-port-forward kfam kubeflow 8081
- name: Cleanup Test Resources
run: |
./testing/gh-actions/test_profile.sh delete test-profile-user
./testing/gh-actions/test_profile.sh delete simple-profile