location-mesh.sh 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bash
  2. # shellcheck disable=SC1091
  3. . lib.sh
  4. setup_suite() {
  5. create_cluster
  6. # shellcheck disable=SC2016
  7. $KUBECTL_BINARY patch ds -n kube-system kilo -p '{"spec": {"template":{"spec":{"containers":[{"name":"kilo","args":["--hostname=$(NODE_NAME)","--create-interface=false","--kubeconfig=/etc/kubernetes/kubeconfig","--mesh-granularity=location"]}]}}}}'
  8. block_until_ready_by_name kube-system kilo-userspace
  9. $KUBECTL_BINARY wait pod -l app.kubernetes.io/name=adjacency --for=condition=Ready --timeout 3m
  10. }
  11. test_location_mesh_connectivity() {
  12. assert "retry 30 5 '' check_ping" "should be able to ping all Pods"
  13. assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 12" "adjacency should return the right number of successful pings"
  14. echo "sleep for 30s (one reconciliation period) and try again..."
  15. sleep 30
  16. assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 12" "adjacency should return the right number of successful pings after reconciling"
  17. }
  18. test_location_mesh_peer() {
  19. check_peer wg1 e2e 10.5.0.1/32 location
  20. }
  21. test_mesh_granularity_auto_detect() {
  22. assert_equals "$($KGCTL_BINARY graph)" "$($KGCTL_BINARY graph --mesh-granularity location)"
  23. }
  24. teardown_suite () {
  25. delete_cluster
  26. }