config-test.sh 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. #!/usr/bin/env 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. # TODO(jbeda): Provide a way to override project
  16. # gcloud multiplexing for shared GCE/GKE tests.
  17. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
  18. source "${KUBE_ROOT}/cluster/gce/config-common.sh"
  19. # Specifying KUBE_GCE_API_ENDPOINT will override the default GCE Compute API endpoint (https://www.googleapis.com/compute/v1/).
  20. # This endpoint has to be pointing to v1 api. For example, https://www.googleapis.com/compute/staging_v1/
  21. GCE_API_ENDPOINT=${KUBE_GCE_API_ENDPOINT:-}
  22. GCLOUD=gcloud
  23. ZONE=${KUBE_GCE_ZONE:-us-central1-b}
  24. REGION=${ZONE%-*}
  25. RELEASE_REGION_FALLBACK=${RELEASE_REGION_FALLBACK:-false}
  26. REGIONAL_KUBE_ADDONS=${REGIONAL_KUBE_ADDONS:-true}
  27. NODE_SIZE=${NODE_SIZE:-n1-standard-2}
  28. NUM_NODES=${NUM_NODES:-3}
  29. NUM_WINDOWS_NODES=${NUM_WINDOWS_NODES:-0}
  30. MASTER_SIZE=${MASTER_SIZE:-n1-standard-$(get-master-size)}
  31. MASTER_MIN_CPU_ARCHITECTURE=${MASTER_MIN_CPU_ARCHITECTURE:-} # To allow choosing better architectures.
  32. MASTER_DISK_TYPE=pd-ssd
  33. MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-$(get-master-disk-size)}
  34. MASTER_ROOT_DISK_SIZE=${MASTER_ROOT_DISK_SIZE:-$(get-master-root-disk-size)}
  35. NODE_DISK_TYPE=${NODE_DISK_TYPE:-pd-standard}
  36. NODE_DISK_SIZE=${NODE_DISK_SIZE:-100GB}
  37. NODE_LOCAL_SSDS=${NODE_LOCAL_SSDS:-0}
  38. NODE_LABELS="${KUBE_NODE_LABELS:-}"
  39. WINDOWS_NODE_LABELS="${WINDOWS_NODE_LABELS:-}"
  40. # An extension to local SSDs allowing users to specify block/fs and SCSI/NVMe devices
  41. # Format of this variable will be "#,scsi/nvme,block/fs" you can specify multiple
  42. # configurations by separating them by a semi-colon ex. "2,scsi,fs;1,nvme,block"
  43. # is a request for 2 SCSI formatted and mounted SSDs and 1 NVMe block device SSD.
  44. NODE_LOCAL_SSDS_EXT=${NODE_LOCAL_SSDS_EXT:-}
  45. NODE_ACCELERATORS=${NODE_ACCELERATORS:-""}
  46. REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true}
  47. KUBE_APISERVER_REQUEST_TIMEOUT=300
  48. # Increase initial delay for the apiserver liveness probe, to avoid prematurely tearing it down
  49. KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC=${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-45}
  50. # Also increase the initial delay for etcd just to be safe
  51. ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC=${ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC:-45}
  52. PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false}
  53. PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false}
  54. KUBE_DELETE_NODES=${KUBE_DELETE_NODES:-true}
  55. KUBE_DELETE_NETWORK=${KUBE_DELETE_NETWORK:-true}
  56. CREATE_CUSTOM_NETWORK=${CREATE_CUSTOM_NETWORK:-false}
  57. MIG_WAIT_UNTIL_STABLE_TIMEOUT=${MIG_WAIT_UNTIL_STABLE_TIMEOUT:-1800}
  58. MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
  59. NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
  60. WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1809}
  61. if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
  62. MASTER_OS_DISTRIBUTION="gci"
  63. fi
  64. if [[ "${NODE_OS_DISTRIBUTION}" == "cos" ]]; then
  65. NODE_OS_DISTRIBUTION="gci"
  66. fi
  67. # GPUs supported in GCE do not have compatible drivers in Debian 7.
  68. if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then
  69. NODE_ACCELERATORS=""
  70. fi
  71. # To avoid failing large tests due to some flakes in starting nodes, allow
  72. # for a small percentage of nodes to not start during cluster startup.
  73. ALLOWED_NOTREADY_NODES="${ALLOWED_NOTREADY_NODES:-$(($(get-num-nodes) / 100))}"
  74. # By default a cluster will be started with the master and nodes
  75. # on Container-optimized OS (cos, previously known as gci). If
  76. # you are updating the os image versions, update this variable.
  77. # Also please update corresponding image for node e2e at:
  78. # https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/jenkins/image-config.yaml
  79. GCI_VERSION=${KUBE_GCI_VERSION:-cos-73-11647-163-0}
  80. MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-}
  81. MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-cos-cloud}
  82. NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-${GCI_VERSION}}
  83. NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-cos-cloud}
  84. NODE_SERVICE_ACCOUNT=${KUBE_GCE_NODE_SERVICE_ACCOUNT:-default}
  85. CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker}
  86. CONTAINER_RUNTIME_ENDPOINT=${KUBE_CONTAINER_RUNTIME_ENDPOINT:-}
  87. CONTAINER_RUNTIME_NAME=${KUBE_CONTAINER_RUNTIME_NAME:-}
  88. LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-}
  89. GCI_DOCKER_VERSION=${KUBE_GCI_DOCKER_VERSION:-}
  90. if [[ "${CONTAINER_RUNTIME}" == "containerd" ]]; then
  91. CONTAINER_RUNTIME_NAME=${KUBE_CONTAINER_RUNTIME_NAME:-containerd}
  92. CONTAINER_RUNTIME_ENDPOINT=${KUBE_CONTAINER_RUNTIME_ENDPOINT:-unix:///run/containerd/containerd.sock}
  93. LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-ctr -n=k8s.io images import}
  94. KUBELET_TEST_ARGS="${KUBELET_TEST_ARGS:-} --runtime-cgroups=/system.slice/containerd.service"
  95. fi
  96. # MASTER_EXTRA_METADATA is the extra instance metadata on master instance separated by commas.
  97. MASTER_EXTRA_METADATA=${KUBE_MASTER_EXTRA_METADATA:-${KUBE_EXTRA_METADATA:-}}
  98. # MASTER_EXTRA_METADATA is the extra instance metadata on node instance separated by commas.
  99. NODE_EXTRA_METADATA=${KUBE_NODE_EXTRA_METADATA:-${KUBE_EXTRA_METADATA:-}}
  100. NETWORK=${KUBE_GCE_NETWORK:-e2e-test-${USER}}
  101. if [[ "${CREATE_CUSTOM_NETWORK}" == true ]]; then
  102. SUBNETWORK="${SUBNETWORK:-${NETWORK}-custom-subnet}"
  103. fi
  104. INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-e2e-test-${USER}}"
  105. CLUSTER_NAME="${CLUSTER_NAME:-${INSTANCE_PREFIX}}"
  106. MASTER_NAME="${INSTANCE_PREFIX}-master"
  107. AGGREGATOR_MASTER_NAME="${INSTANCE_PREFIX}-aggregator"
  108. INITIAL_ETCD_CLUSTER="${MASTER_NAME}"
  109. MASTER_TAG="${INSTANCE_PREFIX}-master"
  110. NODE_TAG="${INSTANCE_PREFIX}-minion"
  111. CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-$(get-cluster-ip-range)}"
  112. MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
  113. # NODE_IP_RANGE is used when ENABLE_IP_ALIASES=true or CREATE_CUSTOM_NETWORK=true.
  114. # It is the primary range in the subnet and is the range used for node instance IPs.
  115. NODE_IP_RANGE="$(get-node-ip-range)"
  116. RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
  117. if [[ "${KUBE_FEATURE_GATES:-}" == "AllAlpha=true" ]]; then
  118. RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-api/all=true}"
  119. fi
  120. # Optional: set feature gates
  121. FEATURE_GATES="${KUBE_FEATURE_GATES:-ExperimentalCriticalPodAnnotation=true}"
  122. TERMINATED_POD_GC_THRESHOLD=${TERMINATED_POD_GC_THRESHOLD:-100}
  123. # Extra docker options for nodes.
  124. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS:-}"
  125. # Enable the docker debug mode.
  126. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS} --debug"
  127. SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
  128. # When set to true, Docker Cache is enabled by default as part of the cluster bring up.
  129. ENABLE_DOCKER_REGISTRY_CACHE=true
  130. # Optional: Deploy a L7 loadbalancer controller to fulfill Ingress requests:
  131. # glbc - CE L7 Load Balancer Controller
  132. ENABLE_L7_LOADBALANCING="${KUBE_ENABLE_L7_LOADBALANCING:-glbc}"
  133. # Optional: Cluster monitoring to setup as part of the cluster bring up:
  134. # none - No cluster monitoring setup
  135. # influxdb - Heapster, InfluxDB, and Grafana
  136. # google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
  137. # stackdriver - Heapster, Google Cloud Monitoring (schema container), and Google Cloud Logging
  138. # googleinfluxdb - Enable influxdb and google (except GCM)
  139. # standalone - Heapster only. Metrics available via Heapster REST API.
  140. ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-standalone}"
  141. # Optional: Enable deploying separate prometheus stack for monitoring kubernetes cluster
  142. ENABLE_PROMETHEUS_MONITORING="${KUBE_ENABLE_PROMETHEUS_MONITORING:-false}"
  143. # Optional: Enable Metrics Server. Metrics Server should be enable everywhere,
  144. # since it's a critical component, but in the first release we need a way to disable
  145. # this in case of stability issues.
  146. # TODO(piosz) remove this option once Metrics Server became a stable thing.
  147. ENABLE_METRICS_SERVER="${KUBE_ENABLE_METRICS_SERVER:-true}"
  148. # Optional: Metadata agent to setup as part of the cluster bring up:
  149. # none - No metadata agent
  150. # stackdriver - Stackdriver metadata agent
  151. # Metadata agent is a daemon set that provides metadata of kubernetes objects
  152. # running on the same node for exporting metrics and logs.
  153. ENABLE_METADATA_AGENT="${KUBE_ENABLE_METADATA_AGENT:-none}"
  154. # One special node out of NUM_NODES would be created of this type if specified.
  155. # Useful for scheduling heapster in large clusters with nodes of small size.
  156. HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
  157. # Set etcd image (e.g. k8s.gcr.io/etcd) and version (e.g. 3.3.10-1) if you need
  158. # non-default version.
  159. ETCD_IMAGE="${TEST_ETCD_IMAGE:-}"
  160. ETCD_DOCKER_REPOSITORY="${TEST_ETCD_DOCKER_REPOSITORY:-}"
  161. ETCD_VERSION="${TEST_ETCD_VERSION:-}"
  162. # Default Log level for all components in test clusters and variables to override it in specific components.
  163. TEST_CLUSTER_LOG_LEVEL="${TEST_CLUSTER_LOG_LEVEL:---v=4}"
  164. KUBELET_TEST_LOG_LEVEL="${KUBELET_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  165. DOCKER_TEST_LOG_LEVEL="${DOCKER_TEST_LOG_LEVEL:---log-level=info}"
  166. API_SERVER_TEST_LOG_LEVEL="${API_SERVER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  167. CONTROLLER_MANAGER_TEST_LOG_LEVEL="${CONTROLLER_MANAGER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  168. SCHEDULER_TEST_LOG_LEVEL="${SCHEDULER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  169. KUBEPROXY_TEST_LOG_LEVEL="${KUBEPROXY_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  170. VOLUME_PLUGIN_DIR="${VOLUME_PLUGIN_DIR:-/home/kubernetes/flexvolume}"
  171. TEST_CLUSTER_DELETE_COLLECTION_WORKERS="${TEST_CLUSTER_DELETE_COLLECTION_WORKERS:---delete-collection-workers=1}"
  172. TEST_CLUSTER_MAX_REQUESTS_INFLIGHT="${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT:-}"
  173. TEST_CLUSTER_RESYNC_PERIOD="${TEST_CLUSTER_RESYNC_PERIOD:---min-resync-period=3m}"
  174. # ContentType used by all components to communicate with apiserver.
  175. TEST_CLUSTER_API_CONTENT_TYPE="${TEST_CLUSTER_API_CONTENT_TYPE:-}"
  176. KUBELET_TEST_ARGS="${KUBELET_TEST_ARGS:-} --serialize-image-pulls=false ${TEST_CLUSTER_API_CONTENT_TYPE}"
  177. if [[ "${NODE_OS_DISTRIBUTION}" == "gci" ]] || [[ "${NODE_OS_DISTRIBUTION}" == "ubuntu" ]] || [[ "${NODE_OS_DISTRIBUTION}" == "custom" ]]; then
  178. NODE_KUBELET_TEST_ARGS="${NODE_KUBELET_TEST_ARGS:-} --experimental-kernel-memcg-notification=true"
  179. fi
  180. if [[ "${MASTER_OS_DISTRIBUTION}" == "gci" ]] || [[ "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]]; then
  181. MASTER_KUBELET_TEST_ARGS="${MASTER_KUBELET_TEST_ARGS:-} --experimental-kernel-memcg-notification=true"
  182. fi
  183. APISERVER_TEST_ARGS="${APISERVER_TEST_ARGS:-} --runtime-config=extensions/v1beta1,scheduling.k8s.io/v1alpha1,settings.k8s.io/v1alpha1 ${TEST_CLUSTER_DELETE_COLLECTION_WORKERS} ${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT}"
  184. CONTROLLER_MANAGER_TEST_ARGS="${CONTROLLER_MANAGER_TEST_ARGS:-} ${TEST_CLUSTER_RESYNC_PERIOD} ${TEST_CLUSTER_API_CONTENT_TYPE}"
  185. SCHEDULER_TEST_ARGS="${SCHEDULER_TEST_ARGS:-} ${TEST_CLUSTER_API_CONTENT_TYPE}"
  186. KUBEPROXY_TEST_ARGS="${KUBEPROXY_TEST_ARGS:-} ${TEST_CLUSTER_API_CONTENT_TYPE}"
  187. # NON_MASTER_NODE_LABELS are labels will only be applied on non-master nodes.
  188. NON_MASTER_NODE_LABELS="${KUBE_NON_MASTER_NODE_LABELS:-}"
  189. WINDOWS_NON_MASTER_NODE_LABELS="${WINDOWS_NON_MASTER_NODE_LABELS:-}"
  190. if [[ "${PREEMPTIBLE_MASTER}" == "true" ]]; then
  191. NODE_LABELS="${NODE_LABELS},cloud.google.com/gke-preemptible=true"
  192. WINDOWS_NODE_LABELS="${WINDOWS_NODE_LABELS},cloud.google.com/gke-preemptible=true"
  193. elif [[ "${PREEMPTIBLE_NODE}" == "true" ]]; then
  194. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS},cloud.google.com/gke-preemptible=true"
  195. WINDOWS_NON_MASTER_NODE_LABELS="${WINDOWS_NON_MASTER_NODE_LABELS},cloud.google.com/gke-preemptible=true"
  196. fi
  197. # Optional: Enable netd.
  198. ENABLE_NETD="${KUBE_ENABLE_NETD:-false}"
  199. CUSTOM_NETD_YAML="${KUBE_CUSTOM_NETD_YAML:-}"
  200. CUSTOM_CALICO_NODE_DAEMONSET_YAML="${KUBE_CUSTOM_CALICO_NODE_DAEMONSET_YAML:-}"
  201. CUSTOM_TYPHA_DEPLOYMENT_YAML="${KUBE_CUSTOM_TYPHA_DEPLOYMENT_YAML:-}"
  202. # To avoid running netd on a node that is not configured appropriately,
  203. # label each Node so that the DaemonSet can run the Pods only on ready Nodes.
  204. # Windows nodes do not support netd.
  205. if [[ ${ENABLE_NETD:-} == "true" ]]; then
  206. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS:+${NON_MASTER_NODE_LABELS},}cloud.google.com/gke-netd-ready=true"
  207. fi
  208. ENABLE_NODELOCAL_DNS="${KUBE_ENABLE_NODELOCAL_DNS:-false}"
  209. # To avoid running Calico on a node that is not configured appropriately,
  210. # label each Node so that the DaemonSet can run the Pods only on ready Nodes.
  211. # Windows nodes do not support Calico.
  212. if [[ ${NETWORK_POLICY_PROVIDER:-} == "calico" ]]; then
  213. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS:+${NON_MASTER_NODE_LABELS},}projectcalico.org/ds-ready=true"
  214. fi
  215. # Enable metadata concealment by firewalling pod traffic to the metadata server
  216. # and run a proxy daemonset on nodes.
  217. ENABLE_METADATA_CONCEALMENT="${ENABLE_METADATA_CONCEALMENT:-true}" # true, false
  218. METADATA_CONCEALMENT_NO_FIREWALL="${METADATA_CONCEALMENT_NO_FIREWALL:-false}" # true, false
  219. if [[ ${ENABLE_METADATA_CONCEALMENT:-} == "true" ]]; then
  220. # Put the necessary label on the node so the daemonset gets scheduled.
  221. NODE_LABELS="${NODE_LABELS},cloud.google.com/metadata-proxy-ready=true"
  222. # TODO(liggitt): remove this in v1.16
  223. NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true"
  224. # Add to the provider custom variables.
  225. PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_METADATA_CONCEALMENT METADATA_CONCEALMENT_NO_FIREWALL"
  226. fi
  227. # Optional: Enable node logging.
  228. ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}"
  229. LOGGING_DESTINATION="${KUBE_LOGGING_DESTINATION:-gcp}" # options: elasticsearch, gcp
  230. # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up.
  231. ENABLE_CLUSTER_LOGGING="${KUBE_ENABLE_CLUSTER_LOGGING:-true}"
  232. ELASTICSEARCH_LOGGING_REPLICAS=1
  233. # Optional: Don't require https for registries in our local RFC1918 network
  234. if [[ ${KUBE_ENABLE_INSECURE_REGISTRY:-false} == "true" ]]; then
  235. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS} --insecure-registry 10.0.0.0/8"
  236. fi
  237. if [[ ! -z "${NODE_ACCELERATORS}" ]]; then
  238. FEATURE_GATES="${FEATURE_GATES},DevicePlugins=true"
  239. if [[ "${NODE_ACCELERATORS}" =~ .*type=([a-zA-Z0-9-]+).* ]]; then
  240. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS},cloud.google.com/gke-accelerator=${BASH_REMATCH[1]}"
  241. fi
  242. fi
  243. # Optional: Install cluster DNS.
  244. # Set CLUSTER_DNS_CORE_DNS to 'false' to install kube-dns instead of CoreDNS.
  245. CLUSTER_DNS_CORE_DNS="${CLUSTER_DNS_CORE_DNS:-true}"
  246. ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
  247. DNS_SERVER_IP="10.0.0.10"
  248. LOCAL_DNS_IP="${KUBE_LOCAL_DNS_IP:-169.254.20.10}"
  249. DNS_DOMAIN="cluster.local"
  250. DNS_MEMORY_LIMIT="${KUBE_DNS_MEMORY_LIMIT:-170Mi}"
  251. # Optional: Enable DNS horizontal autoscaler
  252. ENABLE_DNS_HORIZONTAL_AUTOSCALER="${KUBE_ENABLE_DNS_HORIZONTAL_AUTOSCALER:-true}"
  253. # Optional: Install Kubernetes UI
  254. ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
  255. # Optional: Install node problem detector.
  256. # none - Not run node problem detector.
  257. # daemonset - Run node problem detector as daemonset.
  258. # standalone - Run node problem detector as standalone system daemon.
  259. if [[ "${NODE_OS_DISTRIBUTION}" == "gci" ]]; then
  260. # Enable standalone mode by default for gci.
  261. ENABLE_NODE_PROBLEM_DETECTOR="${KUBE_ENABLE_NODE_PROBLEM_DETECTOR:-standalone}"
  262. else
  263. ENABLE_NODE_PROBLEM_DETECTOR="${KUBE_ENABLE_NODE_PROBLEM_DETECTOR:-daemonset}"
  264. fi
  265. NODE_PROBLEM_DETECTOR_VERSION="${NODE_PROBLEM_DETECTOR_VERSION:-}"
  266. NODE_PROBLEM_DETECTOR_TAR_HASH="${NODE_PROBLEM_DETECTOR_TAR_HASH:-}"
  267. NODE_PROBLEM_DETECTOR_RELEASE_PATH="${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-}"
  268. NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS="${NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS:-}"
  269. CNI_VERSION="${CNI_VERSION:-}"
  270. CNI_SHA1="${CNI_SHA1:-}"
  271. # Optional: Create autoscaler for cluster's nodes.
  272. ENABLE_CLUSTER_AUTOSCALER="${KUBE_ENABLE_CLUSTER_AUTOSCALER:-false}"
  273. if [[ "${ENABLE_CLUSTER_AUTOSCALER}" == "true" ]]; then
  274. AUTOSCALER_MIN_NODES="${KUBE_AUTOSCALER_MIN_NODES:-}"
  275. AUTOSCALER_MAX_NODES="${KUBE_AUTOSCALER_MAX_NODES:-}"
  276. AUTOSCALER_ENABLE_SCALE_DOWN="${KUBE_AUTOSCALER_ENABLE_SCALE_DOWN:-false}"
  277. AUTOSCALER_EXPANDER_CONFIG="${KUBE_AUTOSCALER_EXPANDER_CONFIG:---expander=price}"
  278. fi
  279. # Optional: Enable allocation of pod IPs using IP aliases.
  280. #
  281. # BETA FEATURE.
  282. #
  283. # IP_ALIAS_SIZE is the size of the podCIDR allocated to a node.
  284. # IP_ALIAS_SUBNETWORK is the subnetwork to allocate from. If empty, a
  285. # new subnetwork will be created for the cluster.
  286. ENABLE_IP_ALIASES=${KUBE_GCE_ENABLE_IP_ALIASES:-false}
  287. NODE_IPAM_MODE=${KUBE_GCE_NODE_IPAM_MODE:-RangeAllocator}
  288. if [ ${ENABLE_IP_ALIASES} = true ]; then
  289. # Number of Pods that can run on this node.
  290. MAX_PODS_PER_NODE=${MAX_PODS_PER_NODE:-110}
  291. # Size of ranges allocated to each node.
  292. IP_ALIAS_SIZE="/$(get-alias-range-size ${MAX_PODS_PER_NODE})"
  293. IP_ALIAS_SUBNETWORK=${KUBE_GCE_IP_ALIAS_SUBNETWORK:-${INSTANCE_PREFIX}-subnet-default}
  294. # If we're using custom network, use the subnet we already create for it as the one for ip-alias.
  295. # Note that this means SUBNETWORK would override KUBE_GCE_IP_ALIAS_SUBNETWORK in case of custom network.
  296. if [[ "${CREATE_CUSTOM_NETWORK}" == true ]]; then
  297. IP_ALIAS_SUBNETWORK="${SUBNETWORK}"
  298. fi
  299. # Reserve the services IP space to avoid being allocated for other GCP resources.
  300. SERVICE_CLUSTER_IP_SUBNETWORK=${KUBE_GCE_SERVICE_CLUSTER_IP_SUBNETWORK:-${INSTANCE_PREFIX}-subnet-services}
  301. NODE_IPAM_MODE=${KUBE_GCE_NODE_IPAM_MODE:-CloudAllocator}
  302. SECONDARY_RANGE_NAME=${SECONDARY_RANGE_NAME:-}
  303. # Add to the provider custom variables.
  304. PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_IP_ALIASES"
  305. PROVIDER_VARS="${PROVIDER_VARS:-} NODE_IPAM_MODE"
  306. PROVIDER_VARS="${PROVIDER_VARS:-} SECONDARY_RANGE_NAME"
  307. elif [[ -n "${MAX_PODS_PER_NODE:-}" ]]; then
  308. # Should not have MAX_PODS_PER_NODE set for route-based clusters.
  309. echo -e "${color_red}Cannot set MAX_PODS_PER_NODE for route-based projects for ${PROJECT}." >&2
  310. exit 1
  311. fi
  312. # Enable GCE Alpha features.
  313. if [[ -n "${GCE_ALPHA_FEATURES:-}" ]]; then
  314. PROVIDER_VARS="${PROVIDER_VARS:-} GCE_ALPHA_FEATURES"
  315. fi
  316. # Disable Docker live-restore.
  317. if [[ -n "${DISABLE_DOCKER_LIVE_RESTORE:-}" ]]; then
  318. PROVIDER_VARS="${PROVIDER_VARS:-} DISABLE_DOCKER_LIVE_RESTORE"
  319. fi
  320. # Override default GLBC image
  321. if [[ -n "${GCE_GLBC_IMAGE:-}" ]]; then
  322. PROVIDER_VARS="${PROVIDER_VARS:-} GCE_GLBC_IMAGE"
  323. fi
  324. CUSTOM_INGRESS_YAML="${CUSTOM_INGRESS_YAML:-}"
  325. if [[ -z "${KUBE_ADMISSION_CONTROL:-}" ]]; then
  326. ADMISSION_CONTROL="NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,PodPreset,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,StorageObjectInUseProtection,PersistentVolumeClaimResize"
  327. if [[ "${ENABLE_POD_SECURITY_POLICY:-}" == "true" ]]; then
  328. ADMISSION_CONTROL="${ADMISSION_CONTROL},PodSecurityPolicy"
  329. fi
  330. # ResourceQuota must come last, or a creation is recorded, but the pod may be forbidden.
  331. ADMISSION_CONTROL="${ADMISSION_CONTROL},MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
  332. else
  333. ADMISSION_CONTROL=${KUBE_ADMISSION_CONTROL}
  334. fi
  335. ENABLE_APISERVER_DYNAMIC_AUDIT="${ENABLE_APISERVER_DYNAMIC_AUDIT:-false}"
  336. # Optional: if set to true kube-up will automatically check for existing resources and clean them up.
  337. KUBE_UP_AUTOMATIC_CLEANUP=${KUBE_UP_AUTOMATIC_CLEANUP:-false}
  338. # Optional: setting it to true denotes this is a testing cluster,
  339. # so that we can use pulled kubernetes binaries, even if binaries
  340. # are pre-installed in the image. Note that currently this logic
  341. # is only supported in trusty or GCI.
  342. TEST_CLUSTER="${TEST_CLUSTER:-true}"
  343. # Storage backend. 'etcd2' and 'etcd3' are supported.
  344. STORAGE_BACKEND=${STORAGE_BACKEND:-}
  345. # Storage media type: application/json and application/vnd.kubernetes.protobuf are supported.
  346. STORAGE_MEDIA_TYPE=${STORAGE_MEDIA_TYPE:-}
  347. NETWORK_PROVIDER="${NETWORK_PROVIDER:-kubenet}" # none, kubenet
  348. # Network Policy plugin specific settings.
  349. NETWORK_POLICY_PROVIDER="${NETWORK_POLICY_PROVIDER:-none}" # calico
  350. NON_MASQUERADE_CIDR="0.0.0.0/0"
  351. # How should the kubelet configure hairpin mode?
  352. HAIRPIN_MODE="${HAIRPIN_MODE:-hairpin-veth}" # promiscuous-bridge, hairpin-veth, none
  353. # Optional: if set to true, kube-up will configure the cluster to run e2e tests.
  354. E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false}
  355. # Evict pods whenever compute resource availability on the nodes gets below a threshold.
  356. EVICTION_HARD="${EVICTION_HARD:-memory.available<250Mi,nodefs.available<10%,nodefs.inodesFree<5%}"
  357. # Optional: custom scheduling algorithm
  358. SCHEDULING_ALGORITHM_PROVIDER="${SCHEDULING_ALGORITHM_PROVIDER:-}"
  359. # Optional: install a default StorageClass
  360. ENABLE_DEFAULT_STORAGE_CLASS="${ENABLE_DEFAULT_STORAGE_CLASS:-true}"
  361. # Optional: Enable legacy ABAC policy that makes all service accounts superusers.
  362. # Disabling this by default in tests ensures default RBAC policies are sufficient from 1.6+
  363. # Upgrade test jobs that go from a version < 1.6 to a version >= 1.6 should override this to be true.
  364. ENABLE_LEGACY_ABAC="${ENABLE_LEGACY_ABAC:-false}" # true, false
  365. # Enable a simple "AdvancedAuditing" setup for testing.
  366. ENABLE_APISERVER_ADVANCED_AUDIT="${ENABLE_APISERVER_ADVANCED_AUDIT:-true}" # true, false
  367. ADVANCED_AUDIT_LOG_MODE="${ADVANCED_AUDIT_LOG_MODE:-batch}" # batch, blocking
  368. ENABLE_BIG_CLUSTER_SUBNETS="${ENABLE_BIG_CLUSTER_SUBNETS:-false}"
  369. if [[ -n "${LOGROTATE_FILES_MAX_COUNT:-}" ]]; then
  370. PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_FILES_MAX_COUNT"
  371. fi
  372. if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
  373. PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_MAX_SIZE"
  374. fi
  375. if [[ -n "${POD_LOG_MAX_FILE:-}" ]]; then
  376. PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_FILE"
  377. fi
  378. if [[ -n "${POD_LOG_MAX_SIZE:-}" ]]; then
  379. PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_SIZE"
  380. fi
  381. # Fluentd requirements
  382. # YAML exists to trigger a configuration refresh when changes are made.
  383. FLUENTD_GCP_YAML_VERSION="v3.2.0"
  384. FLUENTD_GCP_VERSION="${FLUENTD_GCP_VERSION:-1.6.8}"
  385. FLUENTD_GCP_MEMORY_LIMIT="${FLUENTD_GCP_MEMORY_LIMIT:-}"
  386. FLUENTD_GCP_CPU_REQUEST="${FLUENTD_GCP_CPU_REQUEST:-}"
  387. FLUENTD_GCP_MEMORY_REQUEST="${FLUENTD_GCP_MEMORY_REQUEST:-}"
  388. # Heapster requirements
  389. HEAPSTER_GCP_BASE_MEMORY="${HEAPSTER_GCP_BASE_MEMORY:-140Mi}"
  390. HEAPSTER_GCP_MEMORY_PER_NODE="${HEAPSTER_GCP_MEMORY_PER_NODE:-4}"
  391. HEAPSTER_GCP_BASE_CPU="${HEAPSTER_GCP_BASE_CPU:-80m}"
  392. HEAPSTER_GCP_CPU_PER_NODE="${HEAPSTER_GCP_CPU_PER_NODE:-0.5}"
  393. # Optional: custom system banner for dashboard addon
  394. CUSTOM_KUBE_DASHBOARD_BANNER="${CUSTOM_KUBE_DASHBOARD_BANNER:-}"
  395. # Default Stackdriver resources version exported by Fluentd-gcp addon
  396. LOGGING_STACKDRIVER_RESOURCE_TYPES="${LOGGING_STACKDRIVER_RESOURCE_TYPES:-old}"
  397. # Adding to PROVIDER_VARS, since this is GCP-specific.
  398. PROVIDER_VARS="${PROVIDER_VARS:-} FLUENTD_GCP_YAML_VERSION FLUENTD_GCP_VERSION FLUENTD_GCP_MEMORY_LIMIT FLUENTD_GCP_CPU_REQUEST FLUENTD_GCP_MEMORY_REQUEST HEAPSTER_GCP_BASE_MEMORY HEAPSTER_GCP_MEMORY_PER_NODE HEAPSTER_GCP_BASE_CPU HEAPSTER_GCP_CPU_PER_NODE CUSTOM_KUBE_DASHBOARD_BANNER LOGGING_STACKDRIVER_RESOURCE_TYPES"
  399. # Fluentd configuration for node-journal
  400. ENABLE_NODE_JOURNAL="${ENABLE_NODE_JOURNAL:-false}"
  401. # prometheus-to-sd configuration
  402. PROMETHEUS_TO_SD_ENDPOINT="${PROMETHEUS_TO_SD_ENDPOINT:-https://monitoring.googleapis.com/}"
  403. PROMETHEUS_TO_SD_PREFIX="${PROMETHEUS_TO_SD_PREFIX:-custom.googleapis.com}"
  404. ENABLE_PROMETHEUS_TO_SD="${ENABLE_PROMETHEUS_TO_SD:-true}"
  405. # TODO(#51292): Make kube-proxy Daemonset default and remove the configuration here.
  406. # Optional: [Experiment Only] Run kube-proxy as a DaemonSet if set to true, run as static pods otherwise.
  407. KUBE_PROXY_DAEMONSET="${KUBE_PROXY_DAEMONSET:-false}" # true, false
  408. # Optional: Change the kube-proxy implementation. Choices are [iptables, ipvs].
  409. KUBE_PROXY_MODE="${KUBE_PROXY_MODE:-iptables}"
  410. # Optional: duration of cluster signed certificates.
  411. CLUSTER_SIGNING_DURATION="${CLUSTER_SIGNING_DURATION:-}"
  412. # Optional: enable pod priority
  413. ENABLE_POD_PRIORITY="${ENABLE_POD_PRIORITY:-}"
  414. if [[ "${ENABLE_POD_PRIORITY}" == "true" ]]; then
  415. FEATURE_GATES="${FEATURE_GATES},PodPriority=true"
  416. fi
  417. # Optional: enable certificate rotation of the kubelet certificates.
  418. ROTATE_CERTIFICATES="${ROTATE_CERTIFICATES:-}"
  419. # The number of services that are allowed to sync concurrently. Will be passed
  420. # into kube-controller-manager via `--concurrent-service-syncs`
  421. CONCURRENT_SERVICE_SYNCS="${CONCURRENT_SERVICE_SYNCS:-}"
  422. SERVICEACCOUNT_ISSUER="https://kubernetes.io/${CLUSTER_NAME}"
  423. # Optional: Enable Node termination Handler for Preemptible and GPU VMs.
  424. # https://github.com/GoogleCloudPlatform/k8s-node-termination-handler
  425. ENABLE_NODE_TERMINATION_HANDLER="${ENABLE_NODE_TERMINATION_HANDLER:-false}"
  426. # Override default Node Termination Handler Image
  427. if [[ "${NODE_TERMINATION_HANDLER_IMAGE:-}" ]]; then
  428. PROVIDER_VARS="${PROVIDER_VARS:-} NODE_TERMINATION_HANDLER_IMAGE"
  429. fi
  430. # Taint Windows nodes by default to prevent Linux workloads from being
  431. # scheduled onto them.
  432. WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}"
  433. # Whether to set up a private GCE cluster, i.e. a cluster where nodes have only private IPs.
  434. GCE_PRIVATE_CLUSTER="${KUBE_GCE_PRIVATE_CLUSTER:-false}"
  435. ETCD_LISTEN_CLIENT_IP=0.0.0.0
  436. GCE_UPLOAD_KUBCONFIG_TO_MASTER_METADATA=true