k3s/vendor/k8s.io/kubernetes/openapi-save.sh
Darren Shepherd ce93f17e28 Update vendor
2019-01-25 22:09:46 -07:00

33 lines
736 B
Bash
Executable File

#!/bin/bash
set -e
exit()
{
exit=$?
kill -9 $ETCD_PID $HYPERKUBE_PID 2>/dev/null || true
rm -f hyperkube
return $exit
}
trap exit EXIT
echo Compiling hyperkube
./hack/update-codegen.sh || ./hack/update-codegen.sh
go build -o hyperkube ./cmd/hyperkube
etcd &
ETCD_PID=$!
./hyperkube kube-apiserver --etcd-servers http://localhost:2379 --cert-dir $(pwd)/certs &
HYPERKUBE_PID=$!
while ! curl -f http://localhost:8080/healthz; do
echo waiting for k8s
sleep 1
done
curl http://localhost:8080/openapi/v2 > openapi.json
curl -H "Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf" http://localhost:8080/openapi/v2 > openapi.pb
git add openapi.json
git add openapi.pb
git commit -m "Save openapi"