Skip to content

Merge pull request #1076 from embano1/workflows #80

Merge pull request #1076 from embano1/workflows

Merge pull request #1076 from embano1/workflows #80

Workflow file for this run

name: VMware Event Router Helm Test
# triggered on every push and PRs but only when changes inside
# vmware-event-router (sub)dir(s)
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'vmware-event-router/**'
push:
paths:
- 'vmware-event-router/**'
env:
KIND_VERSION: v0.17.0
NAMESPACE: vmware
KO_DOCKER_REPO: kind.local
jobs:
openfaas:
name: OpenFaaS Event Processor
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set up Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: 1.19
cache-dependency-path: vmware-event-router/go.sum
- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
- name: Get short COMMIT and TAG (used by ko)
run: |
echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV
echo "KO_TAG=$(basename "${{ github.ref }}")" >> $GITHUB_ENV
- 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
# KinD configuration.
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
EOF
# Create a cluster!
kind create cluster --config kind.yaml --wait 3m
- name: Build router image with ko
working-directory: ./vmware-event-router
run: |
# loads image into kind
ko resolve -BRf deploy/event-router-k8s.yaml
- 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=3m --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=3m --for=condition=Available -n ${NAMESPACE} deploy/vcsim
- name: Install VMware Event Router with Helm
working-directory: ./vmware-event-router
run: |
echo "::group::Create override.yaml"
cat << EOF > override.yaml
image:
fullImage: kind.local/router:latest
pullPolicy: IfNotPresent
eventrouter:
config:
logLevel: debug
vcenter:
address: https://vcsim.${NAMESPACE}.svc.cluster.local
username: user
password: pass
insecure: true # ignore TLS certs
eventProcessor: openfaas
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 install veba-openfaas -n ${NAMESPACE} --wait -f override.yaml ./chart
# assert it deployed correctly
kubectl wait --timeout=3m --for=condition=Available -n ${NAMESPACE} deploy/router
echo "::endgroup::"
- name: "Debug"
if: ${{ always() }}
run: |
kubectl get pods --all-namespaces
kubectl -n ${NAMESPACE} describe pods
kubectl -n ${NAMESPACE} get events
knative:
name: Knative Event Processor
runs-on: ubuntu-latest
env:
KNATIVE_VERSION: knative-v1.8.3 # same as VEBA BOM
BROKER_NAMESPACE: default
BROKER_NAME: default
timeout-minutes: 15
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set up Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: 1.19
cache-dependency-path: vmware-event-router/go.sum
- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
- name: Get short COMMIT and TAG (used by ko)
run: |
echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV
echo "KO_TAG=$(basename "${{ github.ref }}")" >> $GITHUB_ENV
- 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
# KinD configuration.
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
EOF
# Create a cluster!
kind create cluster --config kind.yaml --wait 3m
- name: Build router image with ko
working-directory: ./vmware-event-router
run: |
# loads image into kind
ko resolve -BRf deploy/event-router-k8s.yaml
- name: Setup Knative Serving
run: |
echo "::group::Serving CRDs"
kubectl apply -f https://github.com/knative/serving/releases/download/${KNATIVE_VERSION}/serving-crds.yaml
kubectl wait --timeout=20s --for=condition=Established crd/services.serving.knative.dev
echo "::endgroup::"
echo "::group::Serving Core"
kubectl apply -f https://github.com/knative/serving/releases/download/${KNATIVE_VERSION}/serving-core.yaml
kubectl -n knative-serving wait --timeout=3m --for=condition=Available deploy/webhook
echo "::endgroup::"
echo "::group::Ingress"
echo "waiting 10s before proceeding..." && sleep 10 # hack: give webhook mutating admission controllers some time to settle
# TODO (@embano1): hard-code version since v1.8.3 does not exist
kubectl apply -f https://github.com/knative-sandbox/net-kourier/releases/download/knative-v1.8.1/kourier.yaml
kubectl -n kourier-system wait --timeout=3m --for=condition=Available deploy/3scale-kourier-gateway
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
echo "::endgroup::"
- name: Setup Knative Eventing
run: |
echo "::group::Eventing CRDs"
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/eventing-crds.yaml
kubectl wait --timeout=20s --for=condition=Established crd/brokers.eventing.knative.dev
echo "::endgroup::"
echo "::group::Eventing Core"
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/eventing-core.yaml
kubectl -n knative-eventing wait --timeout=3m --for=condition=Available deploy/eventing-webhook
echo "::endgroup::"
echo "::group::Broker Core"
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/in-memory-channel.yaml
kubectl -n knative-eventing wait --timeout=3m --for=condition=Available deploy/imc-controller
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/mt-channel-broker.yaml
kubectl -n knative-eventing wait --timeout=3m --for=condition=Available deploy/mt-broker-controller
echo "::endgroup::"
echo "::group::Default Broker"
kubectl apply -f - <<EOF
apiVersion: eventing.knative.dev/v1
kind: broker
metadata:
name: ${BROKER_NAME}
namespace: ${BROKER_NAMESPACE}
EOF
echo "::endgroup::"
- 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=3m --for=condition=Available -n ${NAMESPACE} deploy/vcsim
- name: Install VMware Event Router with Helm
working-directory: ./vmware-event-router
run: |
echo "::group::Create override.yaml"
cat << EOF > override.yaml
image:
fullImage: kind.local/router:latest
pullPolicy: IfNotPresent
eventrouter:
config:
logLevel: debug
vcenter:
address: https://vcsim.vmware.svc.cluster.local
username: user
password: pass
insecure: true # ignore TLS certs
eventProcessor: knative
knative:
destination:
ref:
apiVersion: eventing.knative.dev/v1
kind: Broker
name: ${BROKER_NAME}
namespace: ${BROKER_NAMESPACE}
EOF
echo "::endgroup::"
echo "::group::Deploy VMware Event Router"
helm install veba-knative -n ${NAMESPACE} --wait -f override.yaml ./chart
# assert it deployed correctly
kubectl wait --timeout=3m --for=condition=Available -n ${NAMESPACE} deploy/router
echo "::endgroup::"
- name: "Debug"
if: ${{ always() }}
run: |
kubectl get pods --all-namespaces
kubectl -n ${NAMESPACE} describe pods
kubectl -n ${NAMESPACE} get events