This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multicluster: Populate MulticlusterService (#3802)
* multicluster: Populate MulticlusterService * Shellcheck fixes * Change port number
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters