Skip to content

Commit

Permalink
adding cloud-provider awareness.
Browse files Browse the repository at this point in the history
this is just a rebased pires#62

Signed-off-by: António Meireles <antonio.meireles@reformi.st>
  • Loading branch information
pires authored and AntonioMeireles committed Apr 14, 2015
1 parent d45687c commit d4394f8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ Right now, the available environment variables are:

Defaults to **8.8.8.8:53,8.8.4.4:53**, Googles' public [DNS service]
(https://developers.google.com/speed/public-dns/docs/using).
- **CLOUD_PROVIDER** defines the specific cloud provider being used.
This is useful, for instance, if you're relying on kubernetes to set
load-balancers for your services.

Possible values are `gce`, `gke`, `aws`, `azure`, `vagrant`, `vsphere`,
`libvirt-coreos` and `juju`. Defaults to **vagrant**.

So, in order to start, say, a Kubernetes cluster with 3 minion nodes, 2GB of RAM and 2 vCPUs per node one just would do...

Expand Down
10 changes: 10 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ DNS_REPLICAS = ENV['DNS_REPLICAS'] || 2
DNS_DOMAIN = ENV['DNS_DOMAIN'] || "k8s.local"
DNS_UPSTREAM_SERVERS = ENV['DNS_UPSTREAM_SERVERS'] || "8.8.8.8:53,8.8.4.4:53"

tempCloudProvider = (ENV['CLOUD_PROVIDER'].to_s.downcase)
case tempCloudProvider
when "gce", "gke", "aws", "azure", "vagrant", "sphere", "libvirt-coreos", "juju"
CLOUD_PROVIDER = tempCloudProvider
else
CLOUD_PROVIDER = 'vagrant'
end
puts "Cloud provider: #{CLOUD_PROVIDER}"

(1..(NUM_INSTANCES.to_i + 1)).each do |i|
if i == 1
ETCD_SEED_CLUSTER = ""
Expand Down Expand Up @@ -321,6 +330,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
sed -i "s,__NAME__,#{hostname},g" /tmp/vagrantfile-user-data
sed -i "s|__ETCD_SEED_CLUSTER__|#{ETCD_SEED_CLUSTER}|g" /tmp/vagrantfile-user-data
sed -i "s|__MASTER_IP__|#{MASTER_IP}|g" /tmp/vagrantfile-user-data
sed -i "s,__CLOUDPROVIDER__,#{CLOUD_PROVIDER},g" /tmp/vagrantfile-user-data
mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/
EOF
end
Expand Down
1 change: 1 addition & 0 deletions master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ coreos:
--etcd_servers=http://127.0.0.1:2379 \
--public_address_override=__MASTER_IP__ \
--runtime_config=api/v1beta3 \
--cloud_provider=__CLOUDPROVIDER__ \
--logtostderr=true
Restart=always
RestartSec=10
Expand Down

0 comments on commit d4394f8

Please sign in to comment.