config-default.sh 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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. # Accelerators to be attached to each node. Format "type=<accelerator-type>,count=<accelerator-count>"
  46. # More information on available GPUs here - https://cloud.google.com/compute/docs/gpus/
  47. NODE_ACCELERATORS=${NODE_ACCELERATORS:-""}
  48. REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true}
  49. PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false}
  50. PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false}
  51. KUBE_DELETE_NODES=${KUBE_DELETE_NODES:-true}
  52. KUBE_DELETE_NETWORK=${KUBE_DELETE_NETWORK:-} # default value calculated below
  53. CREATE_CUSTOM_NETWORK=${CREATE_CUSTOM_NETWORK:-false}
  54. MIG_WAIT_UNTIL_STABLE_TIMEOUT=${MIG_WAIT_UNTIL_STABLE_TIMEOUT:-1800}
  55. MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
  56. NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
  57. WINDOWS_NODE_OS_DISTRIBUTION=${WINDOWS_NODE_OS_DISTRIBUTION:-win1809}
  58. if [[ "${MASTER_OS_DISTRIBUTION}" == "cos" ]]; then
  59. MASTER_OS_DISTRIBUTION="gci"
  60. fi
  61. if [[ "${NODE_OS_DISTRIBUTION}" == "cos" ]]; then
  62. NODE_OS_DISTRIBUTION="gci"
  63. fi
  64. # GPUs supported in GCE do not have compatible drivers in Debian 7.
  65. if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then
  66. NODE_ACCELERATORS=""
  67. fi
  68. # By default a cluster will be started with the master and nodes
  69. # on Container-optimized OS (cos, previously known as gci). If
  70. # you are updating the os image versions, update this variable.
  71. # Also please update corresponding image for node e2e at:
  72. # https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/jenkins/image-config.yaml
  73. GCI_VERSION=${KUBE_GCI_VERSION:-cos-73-11647-163-0}
  74. MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-}
  75. MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-cos-cloud}
  76. NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-${GCI_VERSION}}
  77. NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-cos-cloud}
  78. NODE_SERVICE_ACCOUNT=${KUBE_GCE_NODE_SERVICE_ACCOUNT:-default}
  79. # KUBELET_TEST_ARGS are extra arguments passed to kubelet.
  80. KUBELET_TEST_ARGS=${KUBE_KUBELET_EXTRA_ARGS:-}
  81. CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-docker}
  82. CONTAINER_RUNTIME_ENDPOINT=${KUBE_CONTAINER_RUNTIME_ENDPOINT:-}
  83. CONTAINER_RUNTIME_NAME=${KUBE_CONTAINER_RUNTIME_NAME:-}
  84. LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-}
  85. if [[ "${CONTAINER_RUNTIME}" == "containerd" ]]; then
  86. CONTAINER_RUNTIME_NAME=${KUBE_CONTAINER_RUNTIME_NAME:-containerd}
  87. CONTAINER_RUNTIME_ENDPOINT=${KUBE_CONTAINER_RUNTIME_ENDPOINT:-unix:///run/containerd/containerd.sock}
  88. LOAD_IMAGE_COMMAND=${KUBE_LOAD_IMAGE_COMMAND:-ctr -n=k8s.io images import}
  89. KUBELET_TEST_ARGS="${KUBELET_TEST_ARGS} --runtime-cgroups=/system.slice/containerd.service"
  90. fi
  91. # MASTER_EXTRA_METADATA is the extra instance metadata on master instance separated by commas.
  92. MASTER_EXTRA_METADATA=${KUBE_MASTER_EXTRA_METADATA:-${KUBE_EXTRA_METADATA:-}}
  93. # MASTER_EXTRA_METADATA is the extra instance metadata on node instance separated by commas.
  94. NODE_EXTRA_METADATA=${KUBE_NODE_EXTRA_METADATA:-${KUBE_EXTRA_METADATA:-}}
  95. NETWORK=${KUBE_GCE_NETWORK:-default}
  96. # Enable network deletion by default (for kube-down), unless we're using 'default' network.
  97. if [[ "${NETWORK}" == "default" ]]; then
  98. KUBE_DELETE_NETWORK=${KUBE_DELETE_NETWORK:-false}
  99. else
  100. KUBE_DELETE_NETWORK=${KUBE_DELETE_NETWORK:-true}
  101. fi
  102. if [[ "${CREATE_CUSTOM_NETWORK}" == true ]]; then
  103. SUBNETWORK="${SUBNETWORK:-${NETWORK}-custom-subnet}"
  104. fi
  105. INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-kubernetes}"
  106. CLUSTER_NAME="${CLUSTER_NAME:-${INSTANCE_PREFIX}}"
  107. MASTER_NAME="${INSTANCE_PREFIX}-master"
  108. AGGREGATOR_MASTER_NAME="${INSTANCE_PREFIX}-aggregator"
  109. INITIAL_ETCD_CLUSTER="${MASTER_NAME}"
  110. MASTER_TAG="${INSTANCE_PREFIX}-master"
  111. NODE_TAG="${INSTANCE_PREFIX}-minion"
  112. CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-$(get-cluster-ip-range)}"
  113. MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
  114. # NODE_IP_RANGE is used when ENABLE_IP_ALIASES=true or CREATE_CUSTOM_NETWORK=true.
  115. # It is the primary range in the subnet and is the range used for node instance IPs.
  116. NODE_IP_RANGE="$(get-node-ip-range)"
  117. # NOTE: Avoid giving nodes empty scopes, because kubelet needs a service account
  118. # in order to initialize properly.
  119. NODE_SCOPES="${NODE_SCOPES:-monitoring,logging-write,storage-ro}"
  120. # Extra docker options for nodes.
  121. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS:-}"
  122. VOLUME_PLUGIN_DIR="${VOLUME_PLUGIN_DIR:-/home/kubernetes/flexvolume}"
  123. SERVICE_CLUSTER_IP_RANGE="${SERVICE_CLUSTER_IP_RANGE:-10.0.0.0/16}" # formerly PORTAL_NET
  124. ALLOCATE_NODE_CIDRS=true
  125. # When set to true, Docker Cache is enabled by default as part of the cluster bring up.
  126. ENABLE_DOCKER_REGISTRY_CACHE=true
  127. # Optional: Deploy a L7 loadbalancer controller to fulfill Ingress requests:
  128. # glbc - CE L7 Load Balancer Controller
  129. ENABLE_L7_LOADBALANCING="${KUBE_ENABLE_L7_LOADBALANCING:-glbc}"
  130. # Optional: Cluster monitoring to setup as part of the cluster bring up:
  131. # none - No cluster monitoring setup
  132. # influxdb - Heapster, InfluxDB, and Grafana
  133. # google - Heapster, Google Cloud Monitoring, and Google Cloud Logging
  134. # stackdriver - Heapster, Google Cloud Monitoring (schema container), and Google Cloud Logging
  135. # googleinfluxdb - Enable influxdb and google (except GCM)
  136. # standalone - Heapster only. Metrics available via Heapster REST API.
  137. ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-standalone}"
  138. # Optional: Enable deploying separate prometheus stack for monitoring kubernetes cluster
  139. ENABLE_PROMETHEUS_MONITORING="${KUBE_ENABLE_PROMETHEUS_MONITORING:-false}"
  140. # Optional: Enable Metrics Server. Metrics Server should be enable everywhere,
  141. # since it's a critical component, but in the first release we need a way to disable
  142. # this in case of stability issues.
  143. # TODO(piosz) remove this option once Metrics Server became a stable thing.
  144. ENABLE_METRICS_SERVER="${KUBE_ENABLE_METRICS_SERVER:-true}"
  145. # Optional: Metadata agent to setup as part of the cluster bring up:
  146. # none - No metadata agent
  147. # stackdriver - Stackdriver metadata agent
  148. # Metadata agent is a daemon set that provides metadata of kubernetes objects
  149. # running on the same node for exporting metrics and logs.
  150. ENABLE_METADATA_AGENT="${KUBE_ENABLE_METADATA_AGENT:-none}"
  151. # One special node out of NUM_NODES would be created of this type if specified.
  152. # Useful for scheduling heapster in large clusters with nodes of small size.
  153. HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}"
  154. # NON_MASTER_NODE_LABELS are labels will only be applied on non-master nodes.
  155. NON_MASTER_NODE_LABELS="${KUBE_NON_MASTER_NODE_LABELS:-}"
  156. WINDOWS_NON_MASTER_NODE_LABELS="${WINDOWS_NON_MASTER_NODE_LABELS:-}"
  157. if [[ "${PREEMPTIBLE_MASTER}" == "true" ]]; then
  158. NODE_LABELS="${NODE_LABELS},cloud.google.com/gke-preemptible=true"
  159. WINDOWS_NODE_LABELS="${WINDOWS_NODE_LABELS},cloud.google.com/gke-preemptible=true"
  160. elif [[ "${PREEMPTIBLE_NODE}" == "true" ]]; then
  161. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS},cloud.google.com/gke-preemptible=true"
  162. WINDOWS_NON_MASTER_NODE_LABELS="${WINDOWS_NON_MASTER_NODE_LABELS},cloud.google.com/gke-preemptible=true"
  163. fi
  164. # To avoid running Calico on a node that is not configured appropriately,
  165. # label each Node so that the DaemonSet can run the Pods only on ready Nodes.
  166. # Windows nodes do not support Calico.
  167. if [[ ${NETWORK_POLICY_PROVIDER:-} == "calico" ]]; then
  168. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS:+${NON_MASTER_NODE_LABELS},}projectcalico.org/ds-ready=true"
  169. fi
  170. # Optional: Enable netd.
  171. ENABLE_NETD="${KUBE_ENABLE_NETD:-false}"
  172. CUSTOM_NETD_YAML="${KUBE_CUSTOM_NETD_YAML:-}"
  173. CUSTOM_CALICO_NODE_DAEMONSET_YAML="${KUBE_CUSTOM_CALICO_NODE_DAEMONSET_YAML:-}"
  174. CUSTOM_TYPHA_DEPLOYMENT_YAML="${KUBE_CUSTOM_TYPHA_DEPLOYMENT_YAML:-}"
  175. # To avoid running netd on a node that is not configured appropriately,
  176. # label each Node so that the DaemonSet can run the Pods only on ready Nodes.
  177. # Windows nodes do not support netd.
  178. if [[ ${ENABLE_NETD:-} == "true" ]]; then
  179. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS:+${NON_MASTER_NODE_LABELS},}cloud.google.com/gke-netd-ready=true"
  180. fi
  181. ENABLE_NODELOCAL_DNS="${KUBE_ENABLE_NODELOCAL_DNS:-false}"
  182. LOCAL_DNS_IP="${KUBE_LOCAL_DNS_IP:-169.254.20.10}"
  183. # Enable metadata concealment by firewalling pod traffic to the metadata server
  184. # and run a proxy daemonset on nodes.
  185. #
  186. # TODO(#8867) Enable by default.
  187. ENABLE_METADATA_CONCEALMENT="${ENABLE_METADATA_CONCEALMENT:-false}" # true, false
  188. METADATA_CONCEALMENT_NO_FIREWALL="${METADATA_CONCEALMENT_NO_FIREWALL:-false}" # true, false
  189. if [[ ${ENABLE_METADATA_CONCEALMENT:-} == "true" ]]; then
  190. # Put the necessary label on the node so the daemonset gets scheduled.
  191. NODE_LABELS="${NODE_LABELS},cloud.google.com/metadata-proxy-ready=true"
  192. # TODO(liggitt): remove this in v1.16
  193. NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true"
  194. # Add to the provider custom variables.
  195. PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_METADATA_CONCEALMENT METADATA_CONCEALMENT_NO_FIREWALL"
  196. fi
  197. # Optional: Enable node logging.
  198. ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}"
  199. LOGGING_DESTINATION="${KUBE_LOGGING_DESTINATION:-gcp}" # options: elasticsearch, gcp
  200. # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up.
  201. ENABLE_CLUSTER_LOGGING="${KUBE_ENABLE_CLUSTER_LOGGING:-true}"
  202. ELASTICSEARCH_LOGGING_REPLICAS=1
  203. # Optional: Don't require https for registries in our local RFC1918 network
  204. if [[ ${KUBE_ENABLE_INSECURE_REGISTRY:-false} == "true" ]]; then
  205. EXTRA_DOCKER_OPTS="${EXTRA_DOCKER_OPTS} --insecure-registry 10.0.0.0/8"
  206. fi
  207. # Optional: customize runtime config
  208. RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
  209. if [[ "${KUBE_FEATURE_GATES:-}" == "AllAlpha=true" ]]; then
  210. RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-api/all=true}"
  211. fi
  212. # Optional: set feature gates
  213. FEATURE_GATES="${KUBE_FEATURE_GATES:-ExperimentalCriticalPodAnnotation=true}"
  214. if [[ ! -z "${NODE_ACCELERATORS}" ]]; then
  215. FEATURE_GATES="${FEATURE_GATES},DevicePlugins=true"
  216. if [[ "${NODE_ACCELERATORS}" =~ .*type=([a-zA-Z0-9-]+).* ]]; then
  217. NON_MASTER_NODE_LABELS="${NON_MASTER_NODE_LABELS},cloud.google.com/gke-accelerator=${BASH_REMATCH[1]}"
  218. fi
  219. fi
  220. # Optional: Install cluster DNS.
  221. # Set CLUSTER_DNS_CORE_DNS to 'false' to install kube-dns instead of CoreDNS.
  222. CLUSTER_DNS_CORE_DNS="${CLUSTER_DNS_CORE_DNS:-true}"
  223. ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
  224. DNS_SERVER_IP="${KUBE_DNS_SERVER_IP:-10.0.0.10}"
  225. DNS_DOMAIN="${KUBE_DNS_DOMAIN:-cluster.local}"
  226. DNS_MEMORY_LIMIT="${KUBE_DNS_MEMORY_LIMIT:-170Mi}"
  227. # Optional: Enable DNS horizontal autoscaler
  228. ENABLE_DNS_HORIZONTAL_AUTOSCALER="${KUBE_ENABLE_DNS_HORIZONTAL_AUTOSCALER:-true}"
  229. # Optional: Install Kubernetes UI
  230. ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
  231. # Optional: Install node problem detector.
  232. # none - Not run node problem detector.
  233. # daemonset - Run node problem detector as daemonset.
  234. # standalone - Run node problem detector as standalone system daemon.
  235. if [[ "${NODE_OS_DISTRIBUTION}" == "gci" ]]; then
  236. # Enable standalone mode by default for gci.
  237. ENABLE_NODE_PROBLEM_DETECTOR="${KUBE_ENABLE_NODE_PROBLEM_DETECTOR:-standalone}"
  238. else
  239. ENABLE_NODE_PROBLEM_DETECTOR="${KUBE_ENABLE_NODE_PROBLEM_DETECTOR:-daemonset}"
  240. fi
  241. NODE_PROBLEM_DETECTOR_VERSION="${NODE_PROBLEM_DETECTOR_VERSION:-}"
  242. NODE_PROBLEM_DETECTOR_TAR_HASH="${NODE_PROBLEM_DETECTOR_TAR_HASH:-}"
  243. NODE_PROBLEM_DETECTOR_RELEASE_PATH="${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-}"
  244. NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS="${NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS:-}"
  245. CNI_VERSION="${CNI_VERSION:-}"
  246. CNI_SHA1="${CNI_SHA1:-}"
  247. # Optional: Create autoscaler for cluster's nodes.
  248. ENABLE_CLUSTER_AUTOSCALER="${KUBE_ENABLE_CLUSTER_AUTOSCALER:-false}"
  249. if [[ "${ENABLE_CLUSTER_AUTOSCALER}" == "true" ]]; then
  250. AUTOSCALER_MIN_NODES="${KUBE_AUTOSCALER_MIN_NODES:-}"
  251. AUTOSCALER_MAX_NODES="${KUBE_AUTOSCALER_MAX_NODES:-}"
  252. AUTOSCALER_ENABLE_SCALE_DOWN="${KUBE_AUTOSCALER_ENABLE_SCALE_DOWN:-true}"
  253. AUTOSCALER_EXPANDER_CONFIG="${KUBE_AUTOSCALER_EXPANDER_CONFIG:---expander=price}"
  254. fi
  255. # Optional: Enable allocation of pod IPs using IP aliases.
  256. #
  257. # BETA FEATURE.
  258. #
  259. # IP_ALIAS_SIZE is the size of the podCIDR allocated to a node.
  260. # IP_ALIAS_SUBNETWORK is the subnetwork to allocate from. If empty, a
  261. # new subnetwork will be created for the cluster.
  262. ENABLE_IP_ALIASES=${KUBE_GCE_ENABLE_IP_ALIASES:-false}
  263. NODE_IPAM_MODE=${KUBE_GCE_NODE_IPAM_MODE:-RangeAllocator}
  264. if [ ${ENABLE_IP_ALIASES} = true ]; then
  265. # Number of Pods that can run on this node.
  266. MAX_PODS_PER_NODE=${MAX_PODS_PER_NODE:-110}
  267. # Size of ranges allocated to each node.
  268. IP_ALIAS_SIZE="/$(get-alias-range-size ${MAX_PODS_PER_NODE})"
  269. IP_ALIAS_SUBNETWORK=${KUBE_GCE_IP_ALIAS_SUBNETWORK:-${INSTANCE_PREFIX}-subnet-default}
  270. # If we're using custom network, use the subnet we already create for it as the one for ip-alias.
  271. # Note that this means SUBNETWORK would override KUBE_GCE_IP_ALIAS_SUBNETWORK in case of custom network.
  272. if [[ "${CREATE_CUSTOM_NETWORK}" == true ]]; then
  273. IP_ALIAS_SUBNETWORK="${SUBNETWORK}"
  274. fi
  275. # Reserve the services IP space to avoid being allocated for other GCP resources.
  276. SERVICE_CLUSTER_IP_SUBNETWORK=${KUBE_GCE_SERVICE_CLUSTER_IP_SUBNETWORK:-${INSTANCE_PREFIX}-subnet-services}
  277. NODE_IPAM_MODE=${KUBE_GCE_NODE_IPAM_MODE:-CloudAllocator}
  278. SECONDARY_RANGE_NAME=${SECONDARY_RANGE_NAME:-}
  279. # Add to the provider custom variables.
  280. PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_IP_ALIASES"
  281. PROVIDER_VARS="${PROVIDER_VARS:-} NODE_IPAM_MODE"
  282. PROVIDER_VARS="${PROVIDER_VARS:-} SECONDARY_RANGE_NAME"
  283. elif [[ -n "${MAX_PODS_PER_NODE:-}" ]]; then
  284. # Should not have MAX_PODS_PER_NODE set for route-based clusters.
  285. echo -e "${color_red}Cannot set MAX_PODS_PER_NODE for route-based projects for ${PROJECT}." >&2
  286. exit 1
  287. fi
  288. # Enable GCE Alpha features.
  289. if [[ -n "${GCE_ALPHA_FEATURES:-}" ]]; then
  290. PROVIDER_VARS="${PROVIDER_VARS:-} GCE_ALPHA_FEATURES"
  291. fi
  292. # Disable Docker live-restore.
  293. if [[ -n "${DISABLE_DOCKER_LIVE_RESTORE:-}" ]]; then
  294. PROVIDER_VARS="${PROVIDER_VARS:-} DISABLE_DOCKER_LIVE_RESTORE"
  295. fi
  296. # Override default GLBC image
  297. if [[ -n "${GCE_GLBC_IMAGE:-}" ]]; then
  298. PROVIDER_VARS="${PROVIDER_VARS:-} GCE_GLBC_IMAGE"
  299. fi
  300. CUSTOM_INGRESS_YAML="${CUSTOM_INGRESS_YAML:-}"
  301. # Admission Controllers to invoke prior to persisting objects in cluster
  302. ADMISSION_CONTROL=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,PersistentVolumeClaimResize,DefaultTolerationSeconds,NodeRestriction,Priority,StorageObjectInUseProtection
  303. if [[ "${ENABLE_POD_SECURITY_POLICY:-}" == "true" ]]; then
  304. ADMISSION_CONTROL="${ADMISSION_CONTROL},PodSecurityPolicy"
  305. fi
  306. # MutatingAdmissionWebhook should be the last controller that modifies the
  307. # request object, otherwise users will be confused if the mutating webhooks'
  308. # modification is overwritten.
  309. ADMISSION_CONTROL="${ADMISSION_CONTROL},MutatingAdmissionWebhook,ValidatingAdmissionWebhook"
  310. # ResourceQuota must come last, or a creation is recorded, but the pod was forbidden.
  311. ADMISSION_CONTROL="${ADMISSION_CONTROL},ResourceQuota"
  312. # Optional: if set to true kube-up will automatically check for existing resources and clean them up.
  313. KUBE_UP_AUTOMATIC_CLEANUP=${KUBE_UP_AUTOMATIC_CLEANUP:-false}
  314. # Storage backend. 'etcd2' supported, 'etcd3' experimental.
  315. STORAGE_BACKEND=${STORAGE_BACKEND:-}
  316. # Networking plugin specific settings.
  317. NETWORK_PROVIDER="${NETWORK_PROVIDER:-kubenet}" # none, kubenet
  318. # Network Policy plugin specific settings.
  319. NETWORK_POLICY_PROVIDER="${NETWORK_POLICY_PROVIDER:-none}" # calico
  320. NON_MASQUERADE_CIDR="0.0.0.0/0"
  321. # How should the kubelet configure hairpin mode?
  322. HAIRPIN_MODE="${HAIRPIN_MODE:-hairpin-veth}" # promiscuous-bridge, hairpin-veth, none
  323. # Optional: if set to true, kube-up will configure the cluster to run e2e tests.
  324. E2E_STORAGE_TEST_ENVIRONMENT="${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false}"
  325. # Evict pods whenever compute resource availability on the nodes gets below a threshold.
  326. EVICTION_HARD="${EVICTION_HARD:-memory.available<250Mi,nodefs.available<10%,nodefs.inodesFree<5%}"
  327. # Optional: custom scheduling algorithm
  328. SCHEDULING_ALGORITHM_PROVIDER="${SCHEDULING_ALGORITHM_PROVIDER:-}"
  329. # Optional: install a default StorageClass
  330. ENABLE_DEFAULT_STORAGE_CLASS="${ENABLE_DEFAULT_STORAGE_CLASS:-true}"
  331. # Optional: Enable legacy ABAC policy that makes all service accounts superusers.
  332. ENABLE_LEGACY_ABAC="${ENABLE_LEGACY_ABAC:-false}" # true, false
  333. # Indicates if the values (i.e. KUBE_USER and KUBE_PASSWORD for basic
  334. # authentication) in metadata should be treated as canonical, and therefore disk
  335. # copies ought to be recreated/clobbered.
  336. METADATA_CLOBBERS_CONFIG="${METADATA_CLOBBERS_CONFIG:-false}"
  337. ENABLE_BIG_CLUSTER_SUBNETS="${ENABLE_BIG_CLUSTER_SUBNETS:-false}"
  338. if [[ -n "${LOGROTATE_FILES_MAX_COUNT:-}" ]]; then
  339. PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_FILES_MAX_COUNT"
  340. fi
  341. if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
  342. PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_MAX_SIZE"
  343. fi
  344. if [[ -n "${POD_LOG_MAX_FILE:-}" ]]; then
  345. PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_FILE"
  346. fi
  347. if [[ -n "${POD_LOG_MAX_SIZE:-}" ]]; then
  348. PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_SIZE"
  349. fi
  350. # Fluentd requirements
  351. # YAML exists to trigger a configuration refresh when changes are made.
  352. FLUENTD_GCP_YAML_VERSION="v3.2.0"
  353. FLUENTD_GCP_VERSION="${FLUENTD_GCP_VERSION:-1.6.8}"
  354. FLUENTD_GCP_MEMORY_LIMIT="${FLUENTD_GCP_MEMORY_LIMIT:-}"
  355. FLUENTD_GCP_CPU_REQUEST="${FLUENTD_GCP_CPU_REQUEST:-}"
  356. FLUENTD_GCP_MEMORY_REQUEST="${FLUENTD_GCP_MEMORY_REQUEST:-}"
  357. # Heapster requirements
  358. HEAPSTER_GCP_BASE_MEMORY="${HEAPSTER_GCP_BASE_MEMORY:-140Mi}"
  359. HEAPSTER_GCP_MEMORY_PER_NODE="${HEAPSTER_GCP_MEMORY_PER_NODE:-4}"
  360. HEAPSTER_GCP_BASE_CPU="${HEAPSTER_GCP_BASE_CPU:-80m}"
  361. HEAPSTER_GCP_CPU_PER_NODE="${HEAPSTER_GCP_CPU_PER_NODE:-0.5}"
  362. # Optional: custom system banner for dashboard addon
  363. CUSTOM_KUBE_DASHBOARD_BANNER="${CUSTOM_KUBE_DASHBOARD_BANNER:-}"
  364. # Default Stackdriver resources version exported by Fluentd-gcp addon
  365. LOGGING_STACKDRIVER_RESOURCE_TYPES="${LOGGING_STACKDRIVER_RESOURCE_TYPES:-old}"
  366. # Adding to PROVIDER_VARS, since this is GCP-specific.
  367. 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"
  368. # Fluentd configuration for node-journal
  369. ENABLE_NODE_JOURNAL="${ENABLE_NODE_JOURNAL:-false}"
  370. # prometheus-to-sd configuration
  371. PROMETHEUS_TO_SD_ENDPOINT="${PROMETHEUS_TO_SD_ENDPOINT:-https://monitoring.googleapis.com/}"
  372. PROMETHEUS_TO_SD_PREFIX="${PROMETHEUS_TO_SD_PREFIX:-custom.googleapis.com}"
  373. ENABLE_PROMETHEUS_TO_SD="${ENABLE_PROMETHEUS_TO_SD:-false}"
  374. # TODO(#51292): Make kube-proxy Daemonset default and remove the configuration here.
  375. # Optional: [Experiment Only] Run kube-proxy as a DaemonSet if set to true, run as static pods otherwise.
  376. KUBE_PROXY_DAEMONSET="${KUBE_PROXY_DAEMONSET:-false}" # true, false
  377. # Optional: duration of cluster signed certificates.
  378. CLUSTER_SIGNING_DURATION="${CLUSTER_SIGNING_DURATION:-}"
  379. # Optional: enable pod priority
  380. ENABLE_POD_PRIORITY="${ENABLE_POD_PRIORITY:-}"
  381. if [[ "${ENABLE_POD_PRIORITY}" == "true" ]]; then
  382. FEATURE_GATES="${FEATURE_GATES},PodPriority=true"
  383. fi
  384. # Optional: enable certificate rotation of the kubelet certificates.
  385. ROTATE_CERTIFICATES="${ROTATE_CERTIFICATES:-}"
  386. # The number of services that are allowed to sync concurrently. Will be passed
  387. # into kube-controller-manager via `--concurrent-service-syncs`
  388. CONCURRENT_SERVICE_SYNCS="${CONCURRENT_SERVICE_SYNCS:-}"
  389. SERVICEACCOUNT_ISSUER="https://kubernetes.io/${CLUSTER_NAME}"
  390. # Optional: Enable Node termination Handler for Preemptible and GPU VMs.
  391. # https://github.com/GoogleCloudPlatform/k8s-node-termination-handler
  392. ENABLE_NODE_TERMINATION_HANDLER="${ENABLE_NODE_TERMINATION_HANDLER:-false}"
  393. # Override default Node Termination Handler Image
  394. if [[ "${NODE_TERMINATION_HANDLER_IMAGE:-}" ]]; then
  395. PROVIDER_VARS="${PROVIDER_VARS:-} NODE_TERMINATION_HANDLER_IMAGE"
  396. fi
  397. # Taint Windows nodes by default to prevent Linux workloads from being
  398. # scheduled onto them.
  399. WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSchedule}"
  400. # Whether to set up a private GCE cluster, i.e. a cluster where nodes have only private IPs.
  401. GCE_PRIVATE_CLUSTER="${KUBE_GCE_PRIVATE_CLUSTER:-false}"