-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ci teardown to cluster init (#150)
1. Add new action build-cluster-init and run-cluster-init to be used by both turing and cluster-init ci. 2. Add new e2e test in cluster-init ci to smoke test knative service. 3. Shifted tear down test from turing to cluster-init Co-authored-by: leonlnj <ningjie.lee@gojek.com>
- Loading branch information
Showing
4 changed files
with
248 additions
and
103 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build Cluster Init | ||
description: Set up Turing Cluster Init | ||
|
||
inputs: | ||
artifact_retention_days: | ||
required: false | ||
description: 'Artifact retention days' | ||
default: 7 | ||
outputs: | ||
cluster-init-version: | ||
description: 'Cluster Init Version built' | ||
value: ${{ steps.build-image.outputs.cluster-init-version }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build Docker image | ||
id: build-image | ||
working-directory: infra/cluster-init | ||
shell: bash | ||
run: | | ||
set -o pipefail | ||
make build-image | tee output.log | ||
echo "::set-output name=cluster-init-version::$(sed -n 's%turing-cluster-init version: \(.*\)%\1%p' output.log)" | ||
- name: Save Docker image | ||
shell: bash | ||
run: | | ||
docker image save \ | ||
--output cluster-init.${{ steps.build-image.outputs.cluster-init-version }}.tar \ | ||
cluster-init:${{ steps.build-image.outputs.cluster-init-version }} | ||
- name: Publish Artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: cluster-init.${{ steps.build-image.outputs.cluster-init-version }}.tar | ||
path: cluster-init.${{ steps.build-image.outputs.cluster-init-version }}.tar | ||
retention-days: ${{ inputs.artifact_retention_days }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Run Cluster Init | ||
description: Set up Turing Cluster Init | ||
|
||
inputs: | ||
cluster_name: | ||
required: true | ||
description: 'Name of Cluster' | ||
default: '' | ||
istio_version: | ||
required: true | ||
description: 'Istio Version' | ||
default: '' | ||
knative_version: | ||
required: true | ||
description: 'Knative Version' | ||
default: '' | ||
knative_istio_version: | ||
required: true | ||
description: 'Knative Istio Version' | ||
default: '' | ||
local_registry: | ||
required: true | ||
description: 'Endpoint of local registry' | ||
default: '' | ||
cluster_init_version: | ||
required: true | ||
description: 'Version of cluster to install, tar file has to follow naming - cluster-init.(CLUSTER_INIT_VERSION).tar ' | ||
default: '' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: "Setup local k8s cluster" | ||
uses: AbsaOSS/k3d-action@v1.5.0 | ||
with: | ||
cluster-name: ${{ inputs.cluster_name }} | ||
use-default-registry: true | ||
args: >- | ||
--servers 1 | ||
--agents 3 | ||
--port 80:80@loadbalancer | ||
--k3s-server-arg "--no-deploy=traefik,metrics-server" | ||
- name: Publish images to local registry | ||
env: | ||
DOCKER_REPOSITORY: ${{ inputs.local_registry }}/${{ github.repository }} | ||
CLUSTER_INIT_VERSION: ${{ inputs.cluster_init_version }} | ||
shell: bash | ||
run: | | ||
# Cluster init | ||
docker image load --input cluster-init.${{ env.CLUSTER_INIT_VERSION }}.tar | ||
docker tag \ | ||
cluster-init:${{ env.CLUSTER_INIT_VERSION }} \ | ||
${{ env.DOCKER_REPOSITORY }}/cluster-init:${{ env.CLUSTER_INIT_VERSION }} | ||
docker push ${{ env.DOCKER_REPOSITORY }}/cluster-init:${{ env.CLUSTER_INIT_VERSION }} | ||
- name: Install Infrastructure | ||
env: | ||
CLUSTER_INIT_VERSION: ${{ inputs.cluster_init_version }} | ||
shell: bash | ||
run: | | ||
kubectl create ns infrastructure | ||
helm upgrade turing-init infra/charts/turing-init \ | ||
--namespace infrastructure \ | ||
--set image.registry=${{ inputs.local_registry }}/ \ | ||
--set image.repository=${{ github.repository }}/cluster-init \ | ||
--set image.tag=${{ env.CLUSTER_INIT_VERSION }} \ | ||
--set knative.domains="127.0.0.1.nip.io" \ | ||
--set knative.registriesSkippingTagResolving=${{ inputs.local_registry }} \ | ||
--install \ | ||
--wait | ||
# wait for install infra job to finish | ||
kubectl logs -n infrastructure -f $(kubectl get pod --namespace infrastructure | grep -v 'NAME' | grep -v 'spark' | head -n 1 | awk '{print $1}') | ||
kubectl get pod --all-namespaces | ||
kubectl get svc --all-namespaces | ||
kubectl wait -n infrastructure --for=condition=complete --timeout=10m job/turing-init-spark-operator-webhook-init | ||
# Might fail the first time but the 2nd run should work, rarely fails on the first try though. | ||
kubectl wait -n infrastructure --for=condition=complete --timeout=10m job/turing-init-init |
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
Oops, something went wrong.