Skip to content
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
11 changes: 1 addition & 10 deletions .github/workflows/central_dashboard_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,7 @@ jobs:

- name: Create Test Profile for Dashboard Testing
run: |
cat <<EOF | kubectl apply -f -
apiVersion: kubeflow.org/v1
kind: Profile
metadata:
name: test-dashboard-profile
spec:
owner:
kind: User
name: [email protected]
EOF
kubectl apply -f testing/gh-actions/resources/profile-dashboard-test.yaml

for i in {1..60}; do
if kubectl get namespace test-dashboard-profile >/dev/null 2>&1; then
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/end_to_end_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ jobs:
kubectl get nodes
kubectl get pods -A

# Cleanup
- name: Cleanup Test Resources
run: |
./testing/gh-actions/test_poddefault.sh cleanup e2e-test
Expand Down
19 changes: 19 additions & 0 deletions testing/gh-actions/resources/poddefault-basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kubeflow.org/v1alpha1
kind: PodDefault
metadata:
name: ${PODDEFAULT_NAME}
namespace: ${NAMESPACE}
spec:
selector:
matchLabels:
${PODDEFAULT_NAME}: "true"
desc: "Test PodDefault for integration testing"
env:
- name: TEST_ENV_VAR
value: "test-value"
volumes:
- name: test-volume
emptyDir: {}
volumeMounts:
- name: test-volume
mountPath: /test-mount
12 changes: 12 additions & 0 deletions testing/gh-actions/resources/poddefault-invalid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kubeflow.org/v1alpha1
kind: PodDefault
metadata:
name: invalid-poddefault
namespace: ${NAMESPACE}
spec:
selector:
matchLabels:
invalid: "true"
volumeMounts:
- name: non-existent-volume
mountPath: /invalid
13 changes: 13 additions & 0 deletions testing/gh-actions/resources/poddefault-multi-selector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kubeflow.org/v1alpha1
kind: PodDefault
metadata:
name: ${PODDEFAULT_NAME}-2
namespace: ${NAMESPACE}
spec:
selector:
matchLabels:
test-multi: "true"
desc: "Second test PodDefault"
env:
- name: SECOND_ENV_VAR
value: "second-value"
13 changes: 13 additions & 0 deletions testing/gh-actions/resources/poddefault-test-pod-multi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
name: ${TEST_POD_NAME}-multi
namespace: ${NAMESPACE}
labels:
${PODDEFAULT_NAME}: "true"
test-multi: "true"
spec:
containers:
- name: test-container
image: busybox:latest
command: ["sleep", "300"]
12 changes: 12 additions & 0 deletions testing/gh-actions/resources/poddefault-test-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Pod
metadata:
name: ${TEST_POD_NAME}
namespace: ${NAMESPACE}
labels:
${PODDEFAULT_NAME}: "true"
spec:
containers:
- name: test-container
image: busybox:latest
command: ["sleep", "3600"]
8 changes: 8 additions & 0 deletions testing/gh-actions/resources/profile-dashboard-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kubeflow.org/v1
kind: Profile
metadata:
name: test-dashboard-profile
spec:
owner:
kind: User
name: [email protected]
8 changes: 8 additions & 0 deletions testing/gh-actions/resources/profile-simple.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kubeflow.org/v1
kind: Profile
metadata:
name: ${PROFILE_NAME}
spec:
owner:
kind: User
name: ${USER_EMAIL}
13 changes: 13 additions & 0 deletions testing/gh-actions/resources/profile-with-quota.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kubeflow.org/v1
kind: Profile
metadata:
name: ${PROFILE_NAME}
spec:
owner:
kind: User
name: ${USER_EMAIL}
resourceQuotaSpec:
hard:
cpu: "2"
memory: 2Gi
requests.nvidia.com/gpu: "1"
89 changes: 10 additions & 79 deletions testing/gh-actions/test_poddefault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,18 @@ case "$OPERATION" in
;;

"create-poddefault")
cat <<EOF | kubectl apply -f -
apiVersion: kubeflow.org/v1alpha1
kind: PodDefault
metadata:
name: ${PODDEFAULT_NAME}
namespace: ${NAMESPACE}
spec:
selector:
matchLabels:
${PODDEFAULT_NAME}: "true"
desc: "Test PodDefault for integration testing"
env:
- name: TEST_ENV_VAR
value: "test-value"
volumes:
- name: test-volume
emptyDir: {}
volumeMounts:
- name: test-volume
mountPath: /test-mount
EOF
export PODDEFAULT_NAME NAMESPACE
envsubst < "$(dirname "$0")/resources/poddefault-basic.yaml" | kubectl apply -f -
;;

"create-multi-poddefault")
cat <<EOF | kubectl apply -f -
apiVersion: kubeflow.org/v1alpha1
kind: PodDefault
metadata:
name: ${PODDEFAULT_NAME}-2
namespace: ${NAMESPACE}
spec:
selector:
matchLabels:
test-multi: "true"
desc: "Second test PodDefault"
env:
- name: SECOND_ENV_VAR
value: "second-value"
EOF
export PODDEFAULT_NAME NAMESPACE
envsubst < "$(dirname "$0")/resources/poddefault-multi-selector.yaml" | kubectl apply -f -
;;

"test-mutation")
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: ${TEST_POD_NAME}
namespace: ${NAMESPACE}
labels:
${PODDEFAULT_NAME}: "true"
spec:
containers:
- name: test-container
image: busybox:latest
command: ["sleep", "3600"]
EOF
export TEST_POD_NAME NAMESPACE PODDEFAULT_NAME
envsubst < "$(dirname "$0")/resources/poddefault-test-pod.yaml" | kubectl apply -f -

kubectl get pod "${TEST_POD_NAME}" -n "${NAMESPACE}" -o yaml | grep -q "TEST_ENV_VAR" || {
echo "ERROR: TEST_ENV_VAR not found in pod spec"
Expand All @@ -89,21 +45,8 @@ EOF
;;

"test-multi-mutation")
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: ${TEST_POD_NAME}-multi
namespace: ${NAMESPACE}
labels:
${PODDEFAULT_NAME}: "true"
test-multi: "true"
spec:
containers:
- name: test-container
image: busybox:latest
command: ["sleep", "300"]
EOF
export TEST_POD_NAME NAMESPACE PODDEFAULT_NAME
envsubst < "$(dirname "$0")/resources/poddefault-test-pod-multi.yaml" | kubectl apply -f -

kubectl get pod "${TEST_POD_NAME}-multi" -n "${NAMESPACE}" -o yaml | grep -q "TEST_ENV_VAR" || {
echo "ERROR: TEST_ENV_VAR not found in pod spec"
Expand All @@ -119,20 +62,8 @@ EOF
;;

"test-error-handling")
cat <<EOF | kubectl apply -f -
apiVersion: kubeflow.org/v1alpha1
kind: PodDefault
metadata:
name: invalid-poddefault
namespace: ${NAMESPACE}
spec:
selector:
matchLabels:
invalid: "true"
volumeMounts:
- name: non-existent-volume
mountPath: /invalid
EOF
export NAMESPACE
envsubst < "$(dirname "$0")/resources/poddefault-invalid.yaml" | kubectl apply -f -
;;

"validate-webhook")
Expand Down
29 changes: 4 additions & 25 deletions testing/gh-actions/test_profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,8 @@ fi

case "$OPERATION" in
"create")
cat <<EOF | kubectl apply -f -
apiVersion: kubeflow.org/v1
kind: Profile
metadata:
name: ${PROFILE_NAME}
spec:
owner:
kind: User
name: ${USER_EMAIL}
resourceQuotaSpec:
hard:
cpu: "2"
memory: 2Gi
requests.nvidia.com/gpu: "1"
EOF
export PROFILE_NAME USER_EMAIL
envsubst < "$(dirname "$0")/resources/profile-with-quota.yaml" | kubectl apply -f -
kubectl wait --for=jsonpath='{.metadata.name}'=${PROFILE_NAME} profile "${PROFILE_NAME}" --timeout=60s
timeout=120
interval=5
Expand All @@ -59,16 +46,8 @@ EOF
;;

"create-simple")
cat <<EOF | kubectl apply -f -
apiVersion: kubeflow.org/v1
kind: Profile
metadata:
name: ${PROFILE_NAME}
spec:
owner:
kind: User
name: ${USER_EMAIL}
EOF
export PROFILE_NAME USER_EMAIL
envsubst < "$(dirname "$0")/resources/profile-simple.yaml" | kubectl apply -f -
kubectl wait --for=jsonpath='{.metadata.name}'=${PROFILE_NAME} profile "${PROFILE_NAME}" --timeout=60s
timeout=120
interval=5
Expand Down