Skip to content

Instantly share code, notes, and snippets.

@tanzeeb
Created October 30, 2018 22:57
Show Gist options
  • Save tanzeeb/af52fa40a01acb114708b37512798057 to your computer and use it in GitHub Desktop.
Save tanzeeb/af52fa40a01acb114708b37512798057 to your computer and use it in GitHub Desktop.
Autoscale Test #2155
#!/usr/bin/env bash
set -e
echo "Running tests"
echo "Changes in helloworld-go"
pushd docs/serving/samples/helloworld-go
git --no-pager diff .
popd
echo "Changes in serving"
pushd serving
git --no-pager diff .
popd
echo "Deleting helloworld-go service"
pushd docs/serving/samples/helloworld-go
ko delete -f service.yaml --ignore-not-found
popd
sleep 10
echo "Deploying serving"
pushd serving
ko apply -f config/
popd
sleep 10
echo "Deploying helloworld-go service"
pushd docs/serving/samples/helloworld-go
ko apply -f service.yaml
popd
IP=$(kubectl get svc knative-ingressgateway -n istio-system --no-headers | awk '{print $4}')
echo "Waiting..."
sleep 120
echo "Curling helloworld-go"
curl -H 'Host: helloworld-go.default.example.com' http://$IP -isfv
echo "Trying again after container expires..."
sleep 180
echo "Curling helloworld-go to restart the container"
curl -H 'Host: helloworld-go.default.example.com' http://$IP -isfv -m 5 || true
echo "Curling helloworld-go after container has started"
sleep 120
curl -H 'Host: helloworld-go.default.example.com' http://$IP -isfv
echo "Success!"
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
spec:
container:
image: github.com/knative/docs/serving/samples/helloworld-go
env:
- name: TARGET
value: "Go Sample v1"
readinessProbe:
httpGet:
path: /
initialDelaySeconds: 90
#/bin/sh
watch -n 1 kubectl describe podautoscaler helloworld-go
watch -n 1 eval "kubectl get pod \$(kubectl get pods | grep helloworld-go | cut -f1 -d' ') -o=json | jq .status.conditions"
watch -n 1 kubectl get deployment helloworld-go-00001-deployment
watch -n 1 kubectl get endpoints helloworld-go-00001-service
watch -n 1 eval "kubectl get route helloworld-go -o=json | jq .status.conditions"
watch -n 1 kubectl describe revision helloworld-go-00001
watch -n 1 kubectl describe configuration helloworld-go
watch -n 1 kubectl describe ksvc helloworld-go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment