elastic - bump to latest 7.17.16 #68
Workflow file for this run
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
name: k8s deployment validation | |
on: | |
pull_request: | |
paths: | |
- "k8s/*" | |
- ".github/workflows/k8s.yaml" | |
jobs: | |
check-k8s: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: test | |
uses: vetyy/kubeval-action@master | |
with: | |
strict: true | |
files: ./k8s | |
ignore_missing_schemas: false | |
additional_schema_locations: https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/ | |
run-k8s-deployment: | |
runs-on: ubuntu-latest | |
env: | |
namespace: monocle | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Start minikube | |
uses: medyagh/[email protected] | |
with: | |
minikube-version: latest | |
kubernetes-version: stable | |
- name: run k8s deployment on the cluster | |
run: | | |
echo CRAWLERS_API_KEY=$(uuidgen) > .secrets | |
kubectl create namespace "${namespace}" | |
kubectl -n "${namespace}" create secret generic monocle-secrets --from-file=.secrets | |
kubectl create --namespace "${namespace}" --filename ./k8s/ | |
- name: validate components have been deployed successfuly | |
run: | | |
deploy_pod_labels_raw=$(kubectl get --namespace "${namespace}" --filename ./k8s/elastic-deployment.yaml --output go-template='{{ range $k, $v :=.spec.selector.matchLabels }}{{$k}}={{$v}},{{ end }}') | |
deploy_pod_labels_elastic=$(echo "${deploy_pod_labels_raw}" | rev | cut --delimiter=',' --fields='2-' | rev) | |
while [[ $(kubectl get po --namespace "${namespace}" --no-headers 2>/dev/null | wc -l) -eq 0 ]]; do | |
echo -n "." | |
sleep 1s | |
done | |
echo | |
kubectl wait --for=condition=Ready --namespace "${namespace}" pods --selector "${deploy_pod_labels_elastic}" --timeout=2m | |
kubectl wait --for=condition=Ready --namespace "${namespace}" pods --all | |
kubectl get po --namespace "${namespace}" | |
- name: Display indexes | |
run: | | |
kubectl port-forward --namespace "${namespace}" $( kubectl get --namespace "${namespace}" -f k8s/elastic-service.yaml --output name) 9200:9200 & | |
sleep 30s | |
curl -s -I -X GET http://localhost:9200/_cat/indices | |
kill %1 | |
- name: Check api service | |
run: | | |
kubectl port-forward --namespace "${namespace}" $( kubectl get --namespace "${namespace}" -f k8s/api-service.yaml --output name) 8080:8080 & | |
sleep 30s | |
curl -s --fail -H 'Content-type: application/json' http://localhost:8080/api/2/get_workspaces -d '{}' | grep 'workspaces' | |
kill %1 | |
- name: Check web service to fetch web app | |
run: | | |
kubectl port-forward --namespace "${namespace}" $( kubectl get --namespace "${namespace}" -f k8s/api-service.yaml --output name) 8080:8080 & | |
sleep 30s | |
curl -s http://localhost:8080/index.html | grep 'window.document.title' | |
kill %1 |