From d4ab9663c4b5165a22001d408434d74b78458f58 Mon Sep 17 00:00:00 2001 From: Mike Spreitzer Date: Wed, 13 Jan 2016 23:39:10 -0500 Subject: [PATCH] Introduce FLANNEL_OTHER_NET_CONFIG .. so allow configuration of other fields in, usually, /coreos.com/network/config in etcd. Fixes #19618 --- cluster/ubuntu/config-default.sh | 9 +++++++++ cluster/ubuntu/reconfDocker.sh | 2 +- cluster/ubuntu/util.sh | 4 ++-- docs/getting-started-guides/ubuntu.md | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cluster/ubuntu/config-default.sh b/cluster/ubuntu/config-default.sh index 49e9da217a062..ef3aaaf213157 100755 --- a/cluster/ubuntu/config-default.sh +++ b/cluster/ubuntu/config-default.sh @@ -34,6 +34,15 @@ export SERVICE_CLUSTER_IP_RANGE=${SERVICE_CLUSTER_IP_RANGE:-192.168.3.0/24} # f # define the IP range used for flannel overlay network, should not conflict with above SERVICE_CLUSTER_IP_RANGE export FLANNEL_NET=${FLANNEL_NET:-172.16.0.0/16} +# Optionally add other contents to the Flannel configuration JSON +# object normally stored in etcd as /coreos.com/network/config. Use +# JSON syntax suitable for insertion into a JSON object constructor +# after other field name:value pairs. For example: +# FLANNEL_OTHER_NET_CONFIG=', "SubnetMin": "172.16.10.0", "SubnetMax": "172.16.90.0"' + +export FLANNEL_OTHER_NET_CONFIG +FLANNEL_OTHER_NET_CONFIG='' + # Admission Controllers to invoke prior to persisting objects in cluster export ADMISSION_CONTROL=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota,SecurityContextDeny diff --git a/cluster/ubuntu/reconfDocker.sh b/cluster/ubuntu/reconfDocker.sh index 08977b6b221fc..5e7b1cb78dcf1 100755 --- a/cluster/ubuntu/reconfDocker.sh +++ b/cluster/ubuntu/reconfDocker.sh @@ -36,7 +36,7 @@ function config_etcd { exit 2 fi - /opt/bin/etcdctl mk /coreos.com/network/config "{\"Network\":\"${FLANNEL_NET}\", \"Backend\": {\"Type\": \"vxlan\"}}" + /opt/bin/etcdctl mk /coreos.com/network/config "{\"Network\":\"${FLANNEL_NET}\", \"Backend\": {\"Type\": \"vxlan\"}${FLANNEL_OTHER_NET_CONFIG}}" attempt=$((attempt+1)) sleep 3 fi diff --git a/cluster/ubuntu/util.sh b/cluster/ubuntu/util.sh index 574c8da6b82a6..de82f359bf127 100755 --- a/cluster/ubuntu/util.sh +++ b/cluster/ubuntu/util.sh @@ -396,7 +396,7 @@ function provision-master() { create-kube-controller-manager-opts '${NODE_IPS}' create-kube-scheduler-opts create-flanneld-opts '127.0.0.1' '${MASTER_IP}' - sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce ' + FLANNEL_OTHER_NET_CONFIG='${FLANNEL_OTHER_NET_CONFIG}' sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce ' ${BASH_DEBUG_FLAGS} cp ~/kube/default/* /etc/default/ @@ -529,7 +529,7 @@ function provision-masterandnode() { '${MASTER_IP}' create-flanneld-opts '127.0.0.1' '${MASTER_IP}' - sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce ' + FLANNEL_OTHER_NET_CONFIG='${FLANNEL_OTHER_NET_CONFIG}' sudo -E -p '[sudo] password to start master: ' -- /bin/bash -ce ' ${BASH_DEBUG_FLAGS} cp ~/kube/default/* /etc/default/ cp ~/kube/init_conf/* /etc/init/ diff --git a/docs/getting-started-guides/ubuntu.md b/docs/getting-started-guides/ubuntu.md index 4b813a62cb3b5..5be24d43922a5 100644 --- a/docs/getting-started-guides/ubuntu.md +++ b/docs/getting-started-guides/ubuntu.md @@ -145,6 +145,8 @@ that conflicts with your own private network range. The `FLANNEL_NET` variable defines the IP range used for flannel overlay network, should not conflict with above `SERVICE_CLUSTER_IP_RANGE`. +You can optionally provide additional Flannel network configuration +through `FLANNEL_OTHER_NET_CONFIG`, as explained in `cluster/ubuntu/config-default.sh`. **Note:** When deploying, master needs to be connected to the Internet to download the necessary files. If your machines are located in a private network that need proxy setting to connect the Internet,