Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
multicluster: Populate MulticlusterService (#3802)
Browse files Browse the repository at this point in the history
* multicluster: Populate MulticlusterService

* Shellcheck fixes

* Change port number
  • Loading branch information
draychev authored Jul 21, 2021
1 parent e63b185 commit c0d4ec1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
42 changes: 42 additions & 0 deletions demo/populate-MulticlusterService.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -auexo pipefail

# TODO: Parameterize this value: https://github.com/openservicemesh/osm/issues/3804
GATEWAY_PORT=14080

# Populate the IP of the Multicluster Gateway from the OTHER cluster
##########################
# Get IP addresses of OSM Multicluster Gateways
kubectl config use-context 'alpha'
ALPHA_OSM_GATEWAY_IP=$(kubectl get pods -n 'osm-system' --selector app=osm-gateway -o json | jq -r '.items[].status.podIP')

kubectl config use-context 'beta'
BETA_OSM_GATEWAY_IP=$(kubectl get pods -n 'osm-system' --selector app=osm-gateway -o json | jq -r '.items[].status.podIP')

##########################
# Populate Alpha w/ Beta's IP
kubectl config use-context 'alpha'
kubectl patch MulticlusterService \
--namespace bookstore \
bookstore \
--type merge \
--patch '{"spec":{"clusters":[{"name":"beta","address":"'"${BETA_OSM_GATEWAY_IP}"':'"${GATEWAY_PORT}"'"}]}}'

kubectl get MulticlusterService \
--namespace bookstore bookstore \
-o json | jq '.spec.clusters'


##########################
# Populate Beta w/ Alpha's IP
kubectl config use-context 'beta'
kubectl patch MulticlusterService \
--namespace bookstore \
bookstore \
--type merge \
--patch '{"spec":{"clusters":[{"name":"alpha","address":"'"${ALPHA_OSM_GATEWAY_IP}"':'"${GATEWAY_PORT}"'"}]}}'

kubectl get MulticlusterService \
--namespace bookstore bookstore \
-o json | jq '.spec.clusters'
2 changes: 2 additions & 0 deletions demo/run-osm-multicluster-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ for CONTEXT in $MULTICLUSTER_CONTEXTS; do
# Create the MultiClusterService object.
./demo/deploy-MultiClusterService.sh
done

./demo/populate-MulticlusterService.sh

0 comments on commit c0d4ec1

Please sign in to comment.