Skip to content

Commit

Permalink
Use kustomize to patch deployments before deploy
Browse files Browse the repository at this point in the history
Signed-off-by: carter.fendley <[email protected]>
  • Loading branch information
CarterFendley committed Oct 15, 2024
1 parent 1aeea00 commit 743246f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
18 changes: 3 additions & 15 deletions scripts/deploy/github/deploy-kfp.sh
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"
TEST_MANIFESTS="scripts/deploy/github/manifests/test"

kubectl apply -k "${PLATFORM_AGNOSTIC_MANIFESTS}" || EXIT_CODE=$?
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
19 changes: 19 additions & 0 deletions scripts/deploy/github/manifests/test/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 scripts/deploy/github/manifests/test/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

0 comments on commit 743246f

Please sign in to comment.