From 7a24aefdf625a451fa5d68aa0a5929a33f7f0768 Mon Sep 17 00:00:00 2001 From: Michael Gasch Date: Thu, 29 Apr 2021 14:20:00 +0200 Subject: [PATCH] Verify Helm chart Runs helm chart deployment verification on every change in the chart/ folder. Closes: #359 Signed-off-by: Michael Gasch --- .github/workflows/router-verify-helm.yml | 101 +++++++++++++++++++++++ vmware-event-router/deploy/vcsim.yaml | 33 ++++++++ 2 files changed, 134 insertions(+) create mode 100644 .github/workflows/router-verify-helm.yml create mode 100644 vmware-event-router/deploy/vcsim.yaml diff --git a/.github/workflows/router-verify-helm.yml b/.github/workflows/router-verify-helm.yml new file mode 100644 index 00000000..2fa62474 --- /dev/null +++ b/.github/workflows/router-verify-helm.yml @@ -0,0 +1,101 @@ +name: VMware Event Router Helm Test + +# triggered on every PR and commit on changes inside the vmware-event-router +# (Helm) chart directory +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - "vmware-event-router/chart/**" + push: + paths: + - "vmware-event-router/chart/**" + +jobs: + helm: + name: Verify Helm chart (latest release) + runs-on: ubuntu-latest + env: + KO_DOCKER_REPO: kind.local + KO_VERSION: 0.8.2 + KIND_VERSION: v0.10.0 + NAMESPACE: vmware + CHART_REPO: "https://projects.registry.vmware.com/chartrepo/veba" + timeout-minutes: 15 + + steps: + - name: Install KinD + run: | + curl -L https://github.com/google/ko/releases/download/v${KO_VERSION}/ko_${KO_VERSION}_Linux_x86_64.tar.gz | tar xzf - ko + chmod +x ./ko + sudo mv ko /usr/local/bin + + - name: Check out code onto GOPATH + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Setup KinD Cluster + run: | + set -x + curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 + chmod +x ./kind + sudo mv kind /usr/local/bin + + # create cluster with defaults + kind create cluster --wait 3m + + - name: Install OpenFaaS with Helm + run: | + kubectl create ns openfaas && kubectl create ns openfaas-fn + helm repo add openfaas https://openfaas.github.io/faas-netes + helm repo update + helm upgrade openfaas --install openfaas/openfaas \ + --namespace openfaas \ + --set functionNamespace=openfaas-fn \ + --set generateBasicAuth=true --wait + + kubectl wait --timeout=1m --for=condition=Available -n openfaas deploy/gateway + echo "OF_PASS=$(kubectl -n openfaas get secret basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode)" >> $GITHUB_ENV + + - name: Install vCenter Simulator + working-directory: ./vmware-event-router + run: | + kubectl create ns ${NAMESPACE} + kubectl -n ${NAMESPACE} apply -f deploy/vcsim.yaml + kubectl wait --timeout=1m --for=condition=Available -n ${NAMESPACE} deploy/vcsim + + - name: Install VMware Event Router with Helm + run: | + echo "::group::Create override.yaml" + cat << EOF > override.yaml + eventrouter: + config: + logLevel: debug + vcenter: + address: https://vcsim.vmware.svc.cluster.local + username: user + password: pass + insecure: true # ignore TLS certs + openfaas: + address: http://gateway.openfaas.svc.cluster.local:8080 + basicAuth: true + username: admin + password: ${OF_PASS} + EOF + echo "::endgroup::" + + echo "::group::Deploy VMware Event Router" + helm repo add vmware-veba ${CHART_REPO} + helm install -n vmware --create-namespace veba vmware-veba/event-router -f override.yaml --wait + + # assert it deployed correctly + kubectl wait --timeout=1m --for=condition=Available -n vmware deploy/router + echo "::endgroup::" + + - name: "Debug" + if: ${{ always() }} + run: | + kubectl get pods --all-namespaces + kubectl -n ${NAMESPACE} describe pods + kubectl -n ${NAMESPACE} get events \ No newline at end of file diff --git a/vmware-event-router/deploy/vcsim.yaml b/vmware-event-router/deploy/vcsim.yaml new file mode 100644 index 00000000..1a21c57c --- /dev/null +++ b/vmware-event-router/deploy/vcsim.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vcsim +spec: + selector: + matchLabels: + app: vcsim + template: + metadata: + labels: + app: vcsim + spec: + containers: + - name: vcsim + image: vmware/vcsim:latest + args: ["/vcsim", "-l", ":8989"] + ports: + - name: https + containerPort: 8989 + +--- +apiVersion: v1 +kind: Service +metadata: + name: vcsim +spec: + selector: + app: vcsim + ports: + - name: https + port: 443 + targetPort: 8989