github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/testgrid/cluster/setup.sh (about) 1 #!/bin/bash 2 # Copyright 2018 The Kubernetes Authors. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 set -o errexit 17 18 # Ensure namespace exists 19 echo -n 'testgrid namespace: ' >&2 20 kubectl get namespaces/testgrid &>/dev/null || kubectl create namespace testgrid 21 echo 'PRESENT' >&2 22 # Ensure secrets exists 23 for i in updater configurator; do 24 echo -n "testgrid-$i-service-account secret: " >&2 25 kubectl get secrets/testgrid-$i-service-account --namespace=testgrid &>/dev/null \ 26 && echo 'PRESENT' >&2 \ 27 && continue 28 echo 'MISSING' >&2 29 echo 'Fix with the following:' >&2 30 echo " kubectl create secret generic testgrid-$i-service-account \\" >&2 31 echo ' --from-file=service-account.json=PATH/TO/SERVICE-ACCOUNT.json' >&2 32 exit 1 33 done 34 echo 'READY to deploy with the following command:' >&2 35 echo ' bazel run //testgrid/cluster:dev.create'