run.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. # Copyright 2019 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. set -o errexit
  16. set -o nounset
  17. set -o pipefail
  18. if ! command -v kind --version &> /dev/null; then
  19. echo "kind is not installed. Use the package manager or visit the official site https://kind.sigs.k8s.io/"
  20. exit 1
  21. fi
  22. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  23. cd $DIR
  24. echo "Kubernetes cluster:"
  25. kubectl get nodes -o wide
  26. kubectl describe node external-secrets-control-plane
  27. echo -e "Granting permissions to e2e service account..."
  28. kubectl create serviceaccount external-secrets-e2e || true
  29. kubectl create clusterrolebinding permissive-binding \
  30. --clusterrole=cluster-admin \
  31. --user=admin \
  32. --user=kubelet \
  33. --serviceaccount=default:external-secrets-e2e || true
  34. echo -e "Waiting service account..."; \
  35. until kubectl get secret | grep -q -e ^external-secrets-e2e-token; do \
  36. echo -e "waiting for api token"; \
  37. sleep 3; \
  38. done
  39. kubectl apply -f ${DIR}/k8s/deploy/crds
  40. echo -e "Starting the e2e test pod"
  41. FOCUS=${FOCUS:-.*}
  42. export FOCUS
  43. kubectl run --rm \
  44. --attach \
  45. --restart=Never \
  46. --env="FOCUS=${FOCUS}" \
  47. --env="GCP_SM_SA_JSON=${GCP_SM_SA_JSON}" \
  48. --env="AZURE_CLIENT_ID=${AZURE_CLIENT_ID}" \
  49. --env="AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET}" \
  50. --env="TENANT_ID=${TENANT_ID}" \
  51. --env="VAULT_URL=${VAULT_URL}" \
  52. --overrides='{ "apiVersion": "v1", "spec":{"serviceAccountName": "external-secrets-e2e"}}' \
  53. e2e --image=local/external-secrets-e2e:test