config-test.sh 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. ZONE=${KUBE_AWS_ZONE:-us-west-2a}
  16. MASTER_SIZE=${MASTER_SIZE:-}
  17. NODE_SIZE=${NODE_SIZE:-}
  18. NUM_NODES=${NUM_NODES:-2}
  19. # Dynamically set node sizes so that Heapster has enough space to run
  20. if [[ -z ${NODE_SIZE} ]]; then
  21. if (( ${NUM_NODES} < 50 )); then
  22. NODE_SIZE="t2.micro"
  23. elif (( ${NUM_NODES} < 150 )); then
  24. NODE_SIZE="t2.small"
  25. else
  26. NODE_SIZE="t2.medium"
  27. fi
  28. fi
  29. # Dynamically set the master size by the number of nodes, these are guesses
  30. # TODO: gather some data
  31. if [[ -z ${MASTER_SIZE} ]]; then
  32. if (( ${NUM_NODES} < 150 )); then
  33. MASTER_SIZE="m3.medium"
  34. else
  35. MASTER_SIZE="m3.large"
  36. fi
  37. fi
  38. # Because regions are globally named, we want to create in a single region; default to us-east-1
  39. AWS_S3_REGION=${AWS_S3_REGION:-us-east-1}
  40. # Which docker storage mechanism to use.
  41. DOCKER_STORAGE=${DOCKER_STORAGE:-aufs}
  42. # Extra docker options for nodes.
  43. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS:-}"
  44. INSTANCE_PREFIX="${KUBE_AWS_INSTANCE_PREFIX:-e2e-test-${USER}}"
  45. CONFIG_CONTEXT="${KUBE_CONFIG_CONTEXT:-aws_${INSTANCE_PREFIX}}"
  46. CLUSTER_ID=${INSTANCE_PREFIX}
  47. VPC_NAME=${VPC_NAME:-kubernetes-vpc}
  48. AWS_SSH_KEY=${AWS_SSH_KEY:-$HOME/.ssh/kube_aws_rsa}
  49. IAM_PROFILE_MASTER="kubernetes-master"
  50. IAM_PROFILE_NODE="kubernetes-minion"
  51. LOG="/dev/null"
  52. MASTER_DISK_TYPE="${MASTER_DISK_TYPE:-gp2}"
  53. MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-20}
  54. # The master root EBS volume size (typically does not need to be very large)
  55. MASTER_ROOT_DISK_TYPE="${MASTER_ROOT_DISK_TYPE:-gp2}"
  56. MASTER_ROOT_DISK_SIZE=${MASTER_ROOT_DISK_SIZE:-8}
  57. # The minions root EBS volume size (used to house Docker images)
  58. NODE_ROOT_DISK_TYPE="${NODE_ROOT_DISK_TYPE:-gp2}"
  59. NODE_ROOT_DISK_SIZE=${NODE_ROOT_DISK_SIZE:-32}
  60. MASTER_NAME="${INSTANCE_PREFIX}-master"
  61. MASTER_TAG="${INSTANCE_PREFIX}-master"
  62. NODE_TAG="${INSTANCE_PREFIX}-minion"
  63. NODE_SCOPES=""
  64. NON_MASQUERADE_CIDR="${NON_MASQUERADE_CIDR:-10.0.0.0/8}" # Traffic to IPs outside this range will use IP masquerade
  65. SERVICE_CLUSTER_IP_RANGE="${SERVICE_CLUSTER_IP_RANGE:-10.0.0.0/16}" # formerly PORTAL_NET
  66. CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.245.0.0/16}"
  67. MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
  68. SSH_CIDR="${SSH_CIDR:-0.0.0.0/0}" # IP to restrict ssh access to nodes/master
  69. HTTP_API_CIDR="${HTTP_API_CIDR:-0.0.0.0/0}" # IP to restrict HTTP API access
  70. # If set to an Elastic IP address, the master instance will be associated with this IP.
  71. # Otherwise a new Elastic IP will be acquired
  72. # (We used to accept 'auto' to mean 'allocate elastic ip', but that is now the default)
  73. MASTER_RESERVED_IP="${MASTER_RESERVED_IP:-}"
  74. RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
  75. # Optional: Cluster monitoring to setup as part of the cluster bring up:
  76. # none - No cluster monitoring setup
  77. # influxdb - Heapster, InfluxDB, and Grafana
  78. ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-none}"
  79. # Optional: Enable node logging.
  80. ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}"
  81. LOGGING_DESTINATION="${KUBE_LOGGING_DESTINATION:-elasticsearch}" # options: elasticsearch, gcp
  82. # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up.
  83. ENABLE_CLUSTER_LOGGING="${KUBE_ENABLE_CLUSTER_LOGGING:-false}"
  84. ELASTICSEARCH_LOGGING_REPLICAS=1
  85. # Optional: Don't require https for registries in our local RFC1918 network
  86. if [[ ${KUBE_ENABLE_INSECURE_REGISTRY:-false} == "true" ]]; then
  87. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS} --insecure-registry ${NON_MASQUERADE_CIDR}"
  88. fi
  89. # Optional: Install cluster DNS.
  90. ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
  91. DNS_SERVER_IP="${DNS_SERVER_IP:-10.0.0.10}"
  92. DNS_DOMAIN="cluster.local"
  93. DNS_REPLICAS=1
  94. # Optional: Install Kubernetes UI
  95. ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
  96. # Optional: Create autoscaler for cluster's nodes.
  97. ENABLE_CLUSTER_AUTOSCALER="${KUBE_ENABLE_CLUSTER_AUTOSCALER:-false}"
  98. if [[ "${ENABLE_CLUSTER_AUTOSCALER}" == "true" ]]; then
  99. # TODO: actually configure ASG or similar
  100. AUTOSCALER_MIN_NODES="${KUBE_AUTOSCALER_MIN_NODES:-1}"
  101. AUTOSCALER_MAX_NODES="${KUBE_AUTOSCALER_MAX_NODES:-${NUM_NODES}}"
  102. TARGET_NODE_UTILIZATION="${KUBE_TARGET_NODE_UTILIZATION:-0.7}"
  103. fi
  104. # Admission Controllers to invoke prior to persisting objects in cluster
  105. # If we included ResourceQuota, we should keep it at the end of the list to prevent incremeting quota usage prematurely.
  106. ADMISSION_CONTROL=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,ResourceQuota
  107. # Optional: Enable/disable public IP assignment for minions.
  108. # Important Note: disable only if you have setup a NAT instance for internet access and configured appropriate routes!
  109. ENABLE_NODE_PUBLIC_IP=${KUBE_ENABLE_NODE_PUBLIC_IP:-true}
  110. # OS options for minions
  111. KUBE_OS_DISTRIBUTION="${KUBE_OS_DISTRIBUTION:-jessie}"
  112. MASTER_OS_DISTRIBUTION="${KUBE_OS_DISTRIBUTION}"
  113. NODE_OS_DISTRIBUTION="${KUBE_OS_DISTRIBUTION}"
  114. KUBE_NODE_IMAGE="${KUBE_NODE_IMAGE:-}"
  115. COREOS_CHANNEL="${COREOS_CHANNEL:-alpha}"
  116. CONTAINER_RUNTIME="${KUBE_CONTAINER_RUNTIME:-docker}"
  117. RKT_VERSION="${KUBE_RKT_VERSION:-0.5.5}"
  118. # Optional: if set to true, kube-up will configure the cluster to run e2e tests.
  119. E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false}