run.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. kubectl run --rm \
  42. --attach \
  43. --restart=Never \
  44. --pod-running-timeout=10m \
  45. --env="FOCUS=${FOCUS:-.*}" \
  46. --env="GCP_SM_SA_JSON=${GCP_SM_SA_JSON:-}" \
  47. --env="GCP_PROJECT_ID=${GCP_PROJECT_ID:-}" \
  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. --env="GITLAB_TOKEN=${GITLAB_TOKEN:-}" \
  53. --env="GITLAB_PROJECT_ID=${GITLAB_PROJECT_ID:-}" \
  54. --overrides='{ "apiVersion": "v1", "spec":{"serviceAccountName": "external-secrets-e2e"}}' \
  55. e2e --image=local/external-secrets-e2e:test