Skip to content

Commit

Permalink
feat(testing): use kustomize to patch deployments before deploy (#11294)
Browse files Browse the repository at this point in the history
* Use kustomize to patch deployments before deploy

Signed-off-by: carter.fendley <[email protected]>

* Relocate scripts / manifests to github directory

Signed-off-by: carter.fendley <[email protected]>

---------

Signed-off-by: carter.fendley <[email protected]>
  • Loading branch information
CarterFendley authored Oct 17, 2024
1 parent aec2856 commit be863a8
Show file tree
Hide file tree
Showing 29 changed files with 66 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/actions/kfp-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ runs:

- name: Build images
shell: bash
run: ./scripts/deploy/github/build-images.sh
run: ./.github/resources/scripts/build-images.sh

- name: Deploy KFP
shell: bash
run: ./scripts/deploy/github/deploy-kfp.sh
run: ./.github/resources/scripts/deploy-kfp.sh
4 changes: 2 additions & 2 deletions .github/actions/kfp-tekton-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ runs:

- name: Build images
shell: bash
run: ./scripts/deploy/github/build-images.sh
run: ./.github/resources/scripts/build-images.sh

- name: Deploy KFP
shell: bash
run: ./scripts/deploy/github/deploy-kfp-tekton.sh
run: ./.github/resources/scripts/deploy-kfp-tekton.sh
19 changes: 19 additions & 0 deletions .github/resources/manifests/argo/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/kustomize/env/platform-agnostic

images:
- name: gcr.io/ml-pipeline/api-server
newName: kind-registry:5000/apiserver
newTag: latest
- name: gcr.io/ml-pipeline/persistenceagent
newName: kind-registry:5000/persistenceagent
newTag: latest
- name: gcr.io/ml-pipeline/scheduledworkflow
newName: kind-registry:5000/scheduledworkflow
newTag: latest

patchesStrategicMerge:
- overlays/apiserver-env.yaml
14 changes: 14 additions & 0 deletions .github/resources/manifests/argo/overlays/apiserver-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ml-pipeline
spec:
template:
spec:
containers:
- name: ml-pipeline-api-server
env:
- name: V2_DRIVER_IMAGE
value: kind-registry:5000/driver
- name: V2_LAUNCHER_IMAGE
value: kind-registry:5000/launcher
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ then
fi

# Deploy manifest
kubectl apply -k "scripts/deploy/github/manifests" || EXIT_CODE=$?
TEST_MANIFESTS=".github/resources/manifests/tekton"
kubectl apply -k "${TEST_MANIFESTS}" || EXIT_CODE=$?
if [[ $EXIT_CODE -ne 0 ]]
then
echo "Deploy unsuccessful. Failure applying $KUSTOMIZE_DIR."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,15 @@ then
exit $EXIT_CODE
fi

PLATFORM_AGNOSTIC_MANIFESTS="manifests/kustomize/env/platform-agnostic"

kubectl apply -k "${PLATFORM_AGNOSTIC_MANIFESTS}" || EXIT_CODE=$?
# Deploy manifest
TEST_MANIFESTS=".github/resources/manifests/argo"
kubectl apply -k "${TEST_MANIFESTS}" || EXIT_CODE=$?
if [[ $EXIT_CODE -ne 0 ]]
then
echo "Deploy unsuccessful. Failure applying ${PLATFORM_AGNOSTIC_MANIFESTS}."
echo "Deploy unsuccessful. Failure applying ${TEST_MANIFESTS}."
exit 1
fi

echo "Patching deployments to use built docker images..."
# Patch API server
kubectl patch deployment ml-pipeline -p '{"spec": {"template": {"spec": {"containers": [{"name": "ml-pipeline-api-server", "image": "kind-registry:5000/apiserver"}]}}}}' -n kubeflow
# Patch persistence agent
kubectl patch deployment.apps/ml-pipeline-persistenceagent -p '{"spec": {"template": {"spec": {"containers": [{"name": "ml-pipeline-persistenceagent", "image": "kind-registry:5000/persistenceagent"}]}}}}' -n kubeflow
# Patch scheduled workflow
kubectl patch deployment.apps/ml-pipeline-scheduledworkflow -p '{"spec": {"template": {"spec": {"containers": [{"name": "ml-pipeline-scheduledworkflow", "image": "kind-registry:5000/scheduledworkflow"}]}}}}' -n kubeflow

# Update environment variables to override driver / launcher
kubectl set env deployments/ml-pipeline V2_DRIVER_IMAGE=kind-registry:5000/driver -n kubeflow
kubectl set env deployments/ml-pipeline V2_LAUNCHER_IMAGE=kind-registry:5000/launcher -n kubeflow

# Check if all pods are running - (10 minutes)
wait_for_pods || EXIT_CODE=$?
if [[ $EXIT_CODE -ne 0 ]]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- '.github/workflows/backend.yml'
- 'go.mod'
- 'backend/**'
- 'scripts/deploy/github/**'
- '.github/resources/**'
- 'manifests/kustomize/**'

env:
Expand Down Expand Up @@ -48,23 +48,23 @@ jobs:
- name: "flip coin test"
run: |
. .venv/bin/activate
TEST_SCRIPT="test-flip-coin.sh" ./scripts/deploy/github/e2e-test.sh
TEST_SCRIPT="test-flip-coin.sh" ./.github/resources/scripts/e2e-test.sh
- name: "static loop test"
run: |
. .venv/bin/activate
TEST_SCRIPT="test-static-loop.sh" ./scripts/deploy/github/e2e-test.sh
TEST_SCRIPT="test-static-loop.sh" ./.github/resources/scripts/e2e-test.sh
- name: "dynamic loop test"
run: |
. .venv/bin/activate
TEST_SCRIPT="test-dynamic-loop.sh" ./scripts/deploy/github/e2e-test.sh
TEST_SCRIPT="test-dynamic-loop.sh" ./.github/resources/scripts/e2e-test.sh
- name: "use env"
run: |
. .venv/bin/activate
TEST_SCRIPT="test-env.sh" ./scripts/deploy/github/e2e-test.sh
TEST_SCRIPT="test-env.sh" ./.github/resources/scripts/e2e-test.sh
- name: "use volume"
run: |
. .venv/bin/activate
TEST_SCRIPT="test-volume.sh" ./scripts/deploy/github/e2e-test.sh
TEST_SCRIPT="test-volume.sh" ./.github/resources/scripts/e2e-test.sh
- name: Collect test results
if: always()
uses: actions/upload-artifact@v4
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
paths:
- '.github/workflows/e2e-test.yml'
- 'scripts/deploy/github/**'
- '.github/resources/**'
- 'go.mod'
- 'go.sum'
- 'backend/**'
Expand All @@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: Initialization tests v1
working-directory: ./backend/test/initialization
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: Initialization tests v2
working-directory: ./backend/test/v2/initialization
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: API integration tests v1
working-directory: ./backend/test/integration
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: API integration tests v2
working-directory: ./backend/test/v2/integration
Expand Down Expand Up @@ -144,10 +144,10 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: Forward Frontend port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline-ui" 3000 3000
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline-ui" 3000 3000

- name: Build frontend integration tests image
working-directory: ./test/frontend-integration-test
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: Install prerequisites
run: pip3 install -r ./test/sample-test/requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/kfp-kubernetes-execution-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
paths:
- '.github/workflows/kfp-kubernetes-execution-tests.yml'
- 'scripts/deploy/github/**'
- '.github/resources/**'
- 'sdk/python/**'
- 'api/v2alpha1/**'
- 'kubernetes_platform/**'
Expand All @@ -28,7 +28,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: apt-get update
run: sudo apt-get update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/kfp-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
pull_request:
paths:
- 'scripts/deploy/github/**'
- '.github/resources/**'
- 'samples/**'
- 'backend/src/v2/**'
- '.github/workflows/kfp-samples.yml'
Expand All @@ -28,7 +28,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: Run Samples Tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/kubeflow-pipelines-integration-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
paths:
- '.github/workflows/kubeflow-pipelines-integration-v2.yml'
- 'scripts/deploy/github/**'
- '.github/resources/**'
- 'samples/core/parameterized_tfx_oss/**'
- 'samples/core/dataflow/**'
- 'backend/**'
Expand All @@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: Run the Integration Tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sdk-execution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
paths:
- '.github/workflows/sdk-execution.yml'
- 'scripts/deploy/github/**'
- '.github/resources/**'
- 'sdk/python/**'
- 'api/v2alpha1/**'

Expand All @@ -27,7 +27,7 @@ jobs:
uses: ./.github/actions/kfp-cluster

- name: Forward API port
run: ./scripts/deploy/github/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888

- name: apt-get update
run: sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
paths:
- '.github/workflows/upgrade-test.yml'
- 'scripts/deploy/github/**'
- '.github/resources/**'
- 'backend/**'
- 'manifests/kustomize/**'

Expand Down
5 changes: 0 additions & 5 deletions scripts/OWNERS

This file was deleted.

0 comments on commit be863a8

Please sign in to comment.