Add Phabricator example
Summary: Add phabricator example Reviewers: davidopp Reviewed By: davidopp Subscribers: #kubernetes Projects: #kubernetes Differential Revision: http://107.178.210.6/D5
This commit is contained in:
8
examples/phabricator/cloudsql-authenticator/Dockerfile
Normal file
8
examples/phabricator/cloudsql-authenticator/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM google/cloud-sdk
|
||||
|
||||
RUN apt-get update && apt-get install -y curl
|
||||
|
||||
ADD run.sh /run.sh
|
||||
RUN chmod a+x /*.sh
|
||||
|
||||
CMD ["/run.sh"]
|
15
examples/phabricator/cloudsql-authenticator/run.sh
Executable file
15
examples/phabricator/cloudsql-authenticator/run.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/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
|
Reference in New Issue
Block a user