2015-02-17 21:20:07 +00:00
#!/bin/bash
2016-06-03 00:25:58 +00:00
# Copyright 2014 The Kubernetes Authors.
2015-02-17 21:20:07 +00:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## Contains configuration values for interacting with the libvirt CoreOS cluster
# Number of minions in the cluster
2015-11-24 03:06:36 +00:00
NUM_NODES = ${ NUM_NODES :- 3 }
export NUM_NODES
2015-02-27 15:45:14 +00:00
# The IP of the master
export MASTER_IP = "192.168.10.1"
export INSTANCE_PREFIX = kubernetes
export MASTER_NAME = " ${ INSTANCE_PREFIX } -master "
2015-09-30 03:28:14 +00:00
# Map out the IPs, names and container subnets of each node
export NODE_IP_BASE = "192.168.10."
NODE_CONTAINER_SUBNET_BASE = "10.10"
2015-02-27 15:45:14 +00:00
MASTER_CONTAINER_NETMASK = "255.255.255.0"
2015-09-30 03:28:14 +00:00
MASTER_CONTAINER_ADDR = " ${ NODE_CONTAINER_SUBNET_BASE } .0.1 "
MASTER_CONTAINER_SUBNET = " ${ NODE_CONTAINER_SUBNET_BASE } .0.1/24 "
CONTAINER_SUBNET = " ${ NODE_CONTAINER_SUBNET_BASE } .0.0/16 "
2015-11-24 03:06:36 +00:00
if [ [ " $NUM_NODES " -gt 253 ] ] ; then
2015-09-30 03:28:14 +00:00
echo " ERROR: Because of how IPs are allocated in ${ BASH_SOURCE } , you cannot create more than 253 nodes "
2015-02-27 15:45:14 +00:00
exit 1
fi
2015-11-24 03:06:36 +00:00
for ( ( i = 0; i < NUM_NODES; i++) ) do
2015-09-30 03:28:14 +00:00
NODE_IPS[ $i ] = " ${ NODE_IP_BASE } $(( i+2)) "
NODE_NAMES[ $i ] = " ${ INSTANCE_PREFIX } -node- $(( i+1)) "
NODE_CONTAINER_SUBNETS[ $i ] = " ${ NODE_CONTAINER_SUBNET_BASE } . $(( i+1)) .1/24 "
NODE_CONTAINER_ADDRS[ $i ] = " ${ NODE_CONTAINER_SUBNET_BASE } . $(( i+1)) .1 "
NODE_CONTAINER_NETMASKS[ $i ] = "255.255.255.0"
2015-02-27 15:45:14 +00:00
done
2015-11-24 03:06:36 +00:00
NODE_CONTAINER_SUBNETS[ $NUM_NODES ] = $MASTER_CONTAINER_SUBNET
2015-02-27 15:45:14 +00:00
2016-02-18 18:55:46 +00:00
SERVICE_CLUSTER_IP_RANGE = " ${ SERVICE_CLUSTER_IP_RANGE :- 10 .11.0.0/16 } " # formerly PORTAL_NET
2015-02-27 16:05:00 +00:00
# Optional: Enable node logging.
ENABLE_NODE_LOGGING = false
LOGGING_DESTINATION = elasticsearch
2015-02-28 06:55:44 +00:00
# Optional: Install cluster DNS.
2015-07-23 08:25:06 +00:00
ENABLE_CLUSTER_DNS = " ${ KUBE_ENABLE_CLUSTER_DNS :- true } "
2016-02-18 18:55:46 +00:00
DNS_SERVER_IP = " ${ SERVICE_CLUSTER_IP_RANGE %.* } .254 "
2015-05-12 06:00:43 +00:00
DNS_DOMAIN = "cluster.local"
2016-08-01 12:41:10 +00:00
2016-11-10 21:59:29 +00:00
# Optional: Install cluster registry
ENABLE_CLUSTER_REGISTRY = " ${ KUBE_ENABLE_CLUSTER_REGISTRY :- true } "
2016-11-07 18:44:42 +00:00
# Optional: Enable DNS horizontal autoscaler
ENABLE_DNS_HORIZONTAL_AUTOSCALER = " ${ KUBE_ENABLE_DNS_HORIZONTAL_AUTOSCALER :- false } "
2016-08-01 12:41:10 +00:00
#Generate dns files
2016-12-09 03:47:11 +00:00
sed -f " ${ KUBE_ROOT } /cluster/addons/dns/transforms2sed.sed " < " ${ KUBE_ROOT } /cluster/addons/dns/kubedns-controller.yaml.base " | sed -f " ${ KUBE_ROOT } /cluster/libvirt-coreos/forShellEval.sed " > " ${ KUBE_ROOT } /cluster/libvirt-coreos/kubedns-controller.yaml "
sed -f " ${ KUBE_ROOT } /cluster/addons/dns/transforms2sed.sed " < " ${ KUBE_ROOT } /cluster/addons/dns/kubedns-svc.yaml.base " | sed -f " ${ KUBE_ROOT } /cluster/libvirt-coreos/forShellEval.sed " > " ${ KUBE_ROOT } /cluster/libvirt-coreos/kubedns-svc.yaml "
2016-12-15 14:52:56 +00:00
cp " ${ KUBE_ROOT } /cluster/addons/dns/kubedns-sa.yaml " " ${ KUBE_ROOT } /cluster/libvirt-coreos/kubedns-sa.yaml "
2016-11-10 21:59:29 +00:00
#Generate registry files
sed -f " ${ KUBE_ROOT } /cluster/libvirt-coreos/forEmptyDirRegistry.sed " < " ${ KUBE_ROOT } /cluster/addons/registry/registry-rc.yaml " > " ${ KUBE_ROOT } /cluster/libvirt-coreos/registry-rc.yaml "