mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Summary: Add phabricator example Reviewers: davidopp Reviewed By: davidopp Subscribers: #kubernetes Projects: #kubernetes Differential Revision: http://107.178.210.6/D5
		
			
				
	
	
		
			16 lines
		
	
	
		
			618 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			618 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
# TODO: This loop updates authorized networks even if nothing has changed. It
 | 
						|
#       should only send updates if something changes. We should be able to do
 | 
						|
#       this by comparing pod creation time with the last scan time.
 | 
						|
while true; do
 | 
						|
  hostport="${KUBERNETES_RO_SERVICE_HOST}:${KUBERNETES_RO_SERVICE_PORT}"
 | 
						|
  path="api/v1beta1/pods"
 | 
						|
  query="labels=$SELECTOR"
 | 
						|
  ips_json=`curl ${hostport}/${path}?${query} 2>/dev/null | grep hostIP`
 | 
						|
  ips=`echo $ips_json | cut -d'"' -f 4 | sed 's/,$//'`
 | 
						|
  echo "Adding IPs $ips"
 | 
						|
  gcloud sql instances patch $CLOUDSQL_DB --authorized-networks $ips
 | 
						|
  sleep 10
 | 
						|
done
 |