config-default.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. # Copyright 2014 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ## Contains configuration values for interacting with the libvirt CoreOS cluster
  16. # Number of minions in the cluster
  17. NUM_NODES=${NUM_NODES:-3}
  18. export NUM_NODES
  19. # The IP of the master
  20. export MASTER_IP="192.168.10.1"
  21. export INSTANCE_PREFIX=kubernetes
  22. export MASTER_NAME="${INSTANCE_PREFIX}-master"
  23. # Map out the IPs, names and container subnets of each node
  24. export NODE_IP_BASE="192.168.10."
  25. NODE_CONTAINER_SUBNET_BASE="10.10"
  26. MASTER_CONTAINER_NETMASK="255.255.255.0"
  27. MASTER_CONTAINER_ADDR="${NODE_CONTAINER_SUBNET_BASE}.0.1"
  28. MASTER_CONTAINER_SUBNET="${NODE_CONTAINER_SUBNET_BASE}.0.1/24"
  29. CONTAINER_SUBNET="${NODE_CONTAINER_SUBNET_BASE}.0.0/16"
  30. if [[ "$NUM_NODES" -gt 253 ]]; then
  31. echo "ERROR: Because of how IPs are allocated in ${BASH_SOURCE}, you cannot create more than 253 nodes"
  32. exit 1
  33. fi
  34. for ((i=0; i < NUM_NODES; i++)) do
  35. NODE_IPS[$i]="${NODE_IP_BASE}$((i+2))"
  36. NODE_NAMES[$i]="${INSTANCE_PREFIX}-node-$((i+1))"
  37. NODE_CONTAINER_SUBNETS[$i]="${NODE_CONTAINER_SUBNET_BASE}.$((i+1)).1/24"
  38. NODE_CONTAINER_ADDRS[$i]="${NODE_CONTAINER_SUBNET_BASE}.$((i+1)).1"
  39. NODE_CONTAINER_NETMASKS[$i]="255.255.255.0"
  40. done
  41. NODE_CONTAINER_SUBNETS[$NUM_NODES]=$MASTER_CONTAINER_SUBNET
  42. SERVICE_CLUSTER_IP_RANGE="${SERVICE_CLUSTER_IP_RANGE:-10.11.0.0/16}" # formerly PORTAL_NET
  43. # Optional: Enable node logging.
  44. ENABLE_NODE_LOGGING=false
  45. LOGGING_DESTINATION=elasticsearch
  46. # Optional: Install cluster DNS.
  47. ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
  48. DNS_SERVER_IP="${SERVICE_CLUSTER_IP_RANGE%.*}.254"
  49. DNS_DOMAIN="cluster.local"
  50. DNS_REPLICAS=1
  51. #Generate dns files
  52. sed -f "${KUBE_ROOT}/cluster/addons/dns/transforms2sed.sed" < "${KUBE_ROOT}/cluster/addons/dns/skydns-rc.yaml.base" | sed -f "${KUBE_ROOT}/cluster/libvirt-coreos/forShellEval.sed" > "${KUBE_ROOT}/cluster/libvirt-coreos/skydns-rc.yaml"
  53. sed -f "${KUBE_ROOT}/cluster/addons/dns/transforms2sed.sed" < "${KUBE_ROOT}/cluster/addons/dns/skydns-svc.yaml.base" | sed -f "${KUBE_ROOT}/cluster/libvirt-coreos/forShellEval.sed" > "${KUBE_ROOT}/cluster/libvirt-coreos/skydns-svc.yaml"