| 1 | #!/bin/bash |
| 2 | # Copyright 2020 The Kubernetes Authors. |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | MYGOBIN=$(go env GOBIN) |
| 6 | MYGOBIN="${MYGOBIN:-$(go env GOPATH)/bin}" |
| 7 | VERSION=$1 |
| 8 | |
| 9 | cp $HOME/.kube/config /tmp/kubeconfig.txt | true |
| 10 | $MYGOBIN/kind create cluster --image kindest/node:$VERSION --name=getopenapidata |
| 11 | |
| 12 | # TODO (natasha41575) Add a `kustomize openapi fetch --proto` option |
| 13 | kubectl proxy & |
| 14 | sleep 5 |
| 15 | curl -k -H "Accept: application/[email protected]+protobuf" http://localhost:8001/openapi/v2 > /tmp/new_swagger.pb |
| 16 | |
| 17 | $MYGOBIN/kind delete cluster --name=getopenapidata |
| 18 | cp /tmp/kubeconfig.txt $HOME/.kube/config | true |
| 19 | mkdir -p kubernetesapi/"${VERSION//./_}" |
| 20 | cp /tmp/new_swagger.pb kubernetesapi/"${VERSION//./_}"/swagger.pb |