-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsvc-hosts.sh
24 lines (16 loc) · 1017 Bytes
/
svc-hosts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Host update script to create a "core-vm-endpoint" hosts file
# Date : 28-10-2016
# Version 0.3
# Author : Jacky Huang
# Commissioned by ANZ Bank under direction of Ben Smillie ([email protected])
# Change the following values to match your environment
# "ubernetes-144200" - To your project
# "asia-east1-a" - To your zone
# "core-vm-endpoint" - To your core-vm-endpoint host
#!/bin/bash -x
gcloud compute --project "ubernetes-144200" ssh --zone "asia-east1-a" "core-vm-endpoint" "sed -i -e 's|.*svc-.*||g' /etc/hosts"
export CONTEXT=$(kubectl config view | awk '/current-context/ {print $2}')
kubectl config set-context $CONTEXT --namespace=hyperledger-05
kubectl get svc -n hyperledger-06 | awk '{print $3, $1".hyperledger-06.svc.cluster.local"}'|grep svc- > /tmp/svc-hosts
gcloud compute --project "ubernetes-144200" copy-files --zone "asia-east1-a" /tmp/svc-hosts core-vm-endpoint:.
gcloud compute --project "ubernetes-144200" ssh --zone "asia-east1-a" "core-vm-endpoint" "cat svc-hosts >>/etc/hosts"