Tolerate existing kubernetes service in test-cmd.sh

This commit is contained in:
Jordan Liggitt 2017-01-25 11:30:52 -05:00
parent a7f52b276f
commit 903787ab2c
No known key found for this signature in database
GPG Key ID: 24E7ADF9A3B42012

View File

@ -2473,11 +2473,10 @@ runTests() {
# Make sure "kubernetes" service exists. # Make sure "kubernetes" service exists.
if kube::test::if_supports_resource "${services}" ; then if kube::test::if_supports_resource "${services}" ; then
output_message=$(kubectl get "${kube_flags[@]}" svc) # Attempt to create the kubernetes service, tolerating failure (since it might already exist)
if [[ ! $(echo "${output_message}" | grep "kubernetes") ]]; then kubectl create "${kube_flags[@]}" -f hack/testdata/kubernetes-service.yaml || true
# Create kubernetes service # Require the service to exist (either we created it or the API server did)
kubectl create "${kube_flags[@]}" -f hack/testdata/kubernetes-service.yaml kubectl get "${kube_flags[@]}" -f hack/testdata/kubernetes-service.yaml
fi
fi fi
# Passing no arguments to create is an error # Passing no arguments to create is an error