config-default.sh 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #!/usr/bin/env bash
  2. # Copyright 2017 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. # A configuration for Kubemark cluster. It doesn't need to be kept in
  16. # sync with gce/config-default.sh (except the filename, because I'm reusing
  17. # gce/util.sh script which assumes config filename), but if some things that
  18. # are enabled by default should not run in hollow clusters, they should be disabled here.
  19. # shellcheck disable=SC2034 # Variables sourced in other scripts.
  20. source "${KUBE_ROOT}/cluster/gce/config-common.sh"
  21. GCLOUD=gcloud
  22. ZONE=${KUBE_GCE_ZONE:-us-central1-b}
  23. REGION=${ZONE%-*}
  24. NUM_NODES=${KUBEMARK_NUM_NODES:-10}
  25. NUM_WINDOWS_NODES=${KUBEMARK_NUM_WINDOWS_NODES:-0}
  26. MASTER_SIZE=${KUBEMARK_MASTER_SIZE:-n1-standard-$(get-master-size)}
  27. MASTER_DISK_TYPE=pd-ssd
  28. MASTER_DISK_SIZE=${MASTER_DISK_SIZE:-$(get-master-disk-size)}
  29. MASTER_ROOT_DISK_SIZE=${KUBEMARK_MASTER_ROOT_DISK_SIZE:-$(get-master-root-disk-size)}
  30. REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false}
  31. PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false}
  32. NODE_ACCELERATORS=${NODE_ACCELERATORS:-""}
  33. CREATE_CUSTOM_NETWORK=${CREATE_CUSTOM_NETWORK:-false}
  34. EVENT_PD=${EVENT_PD:-false}
  35. MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-gci}
  36. NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-gci}
  37. MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-cos-beta-73-11647-64-0}
  38. MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-cos-cloud}
  39. CLEANUP_KUBEMARK_IMAGE=${CLEANUP_KUBEMARK_IMAGE:-true}
  40. # GPUs supported in GCE do not have compatible drivers in Debian 7.
  41. if [[ "${NODE_OS_DISTRIBUTION}" == "debian" ]]; then
  42. NODE_ACCELERATORS=""
  43. fi
  44. NETWORK=${KUBE_GCE_NETWORK:-e2e}
  45. if [[ "${CREATE_CUSTOM_NETWORK}" == true ]]; then
  46. SUBNETWORK="${SUBNETWORK:-${NETWORK}-custom-subnet}"
  47. fi
  48. INSTANCE_PREFIX="${INSTANCE_PREFIX:-"default"}"
  49. MASTER_NAME="${INSTANCE_PREFIX}-kubemark-master"
  50. AGGREGATOR_MASTER_NAME="${INSTANCE_PREFIX}-kubemark-aggregator"
  51. MASTER_TAG="kubemark-master"
  52. EVENT_STORE_NAME="${INSTANCE_PREFIX}-event-store"
  53. MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
  54. CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-$(get-cluster-ip-range)}"
  55. RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}"
  56. TERMINATED_POD_GC_THRESHOLD=${TERMINATED_POD_GC_THRESHOLD:-100}
  57. KUBE_APISERVER_REQUEST_TIMEOUT=300
  58. ETCD_COMPACTION_INTERVAL_SEC="${KUBEMARK_ETCD_COMPACTION_INTERVAL_SEC:-}"
  59. # Set etcd image (e.g. k8s.gcr.io/etcd) and version (e.g. 3.1.12-1) if you need
  60. # non-default version.
  61. ETCD_IMAGE="${TEST_ETCD_IMAGE:-}"
  62. ETCD_VERSION="${TEST_ETCD_VERSION:-}"
  63. ETCD_SERVERS="${KUBEMARK_ETCD_SERVERS:-}"
  64. ETCD_SERVERS_OVERRIDES="${KUBEMARK_ETCD_SERVERS_OVERRIDES:-}"
  65. # Storage backend. 'etcd2' and 'etcd3' are supported.
  66. STORAGE_BACKEND=${STORAGE_BACKEND:-}
  67. # Storage media type: application/json and application/vnd.kubernetes.protobuf are supported.
  68. STORAGE_MEDIA_TYPE=${STORAGE_MEDIA_TYPE:-}
  69. # Default Log level for all components in test clusters and variables to override it in specific components.
  70. TEST_CLUSTER_LOG_LEVEL="${TEST_CLUSTER_LOG_LEVEL:---v=4}"
  71. API_SERVER_TEST_LOG_LEVEL="${API_SERVER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  72. CONTROLLER_MANAGER_TEST_LOG_LEVEL="${CONTROLLER_MANAGER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  73. SCHEDULER_TEST_LOG_LEVEL="${SCHEDULER_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  74. HOLLOW_KUBELET_TEST_LOG_LEVEL="${HOLLOW_KUBELET_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  75. HOLLOW_PROXY_TEST_LOG_LEVEL="${HOLLOW_PROXY_TEST_LOG_LEVEL:-$TEST_CLUSTER_LOG_LEVEL}"
  76. TEST_CLUSTER_DELETE_COLLECTION_WORKERS="${TEST_CLUSTER_DELETE_COLLECTION_WORKERS:---delete-collection-workers=16}"
  77. TEST_CLUSTER_MAX_REQUESTS_INFLIGHT="${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT:-}"
  78. TEST_CLUSTER_RESYNC_PERIOD="${TEST_CLUSTER_RESYNC_PERIOD:-}"
  79. # ContentType used by all components to communicate with apiserver.
  80. TEST_CLUSTER_API_CONTENT_TYPE="${TEST_CLUSTER_API_CONTENT_TYPE:-}"
  81. KUBEMARK_MASTER_COMPONENTS_QPS_LIMITS="${KUBEMARK_MASTER_COMPONENTS_QPS_LIMITS:-}"
  82. CUSTOM_ADMISSION_PLUGINS="${CUSTOM_ADMISSION_PLUGINS:-NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,StorageObjectInUseProtection,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota}"
  83. # Master components' test arguments.
  84. APISERVER_TEST_ARGS="${KUBEMARK_APISERVER_TEST_ARGS:-} --runtime-config=extensions/v1beta1,scheduling.k8s.io/v1alpha1 ${API_SERVER_TEST_LOG_LEVEL} ${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT} ${TEST_CLUSTER_DELETE_COLLECTION_WORKERS}"
  85. CONTROLLER_MANAGER_TEST_ARGS="${KUBEMARK_CONTROLLER_MANAGER_TEST_ARGS:-} ${CONTROLLER_MANAGER_TEST_LOG_LEVEL} ${TEST_CLUSTER_RESYNC_PERIOD} ${TEST_CLUSTER_API_CONTENT_TYPE} ${KUBEMARK_MASTER_COMPONENTS_QPS_LIMITS}"
  86. SCHEDULER_TEST_ARGS="${KUBEMARK_SCHEDULER_TEST_ARGS:-} ${SCHEDULER_TEST_LOG_LEVEL} ${TEST_CLUSTER_API_CONTENT_TYPE} ${KUBEMARK_MASTER_COMPONENTS_QPS_LIMITS}"
  87. # Hollow-node components' test arguments.
  88. HOLLOW_KUBELET_TEST_ARGS="${HOLLOW_KUBELET_TEST_ARGS:-} ${HOLLOW_KUBELET_TEST_LOG_LEVEL}"
  89. HOLLOW_PROXY_TEST_ARGS="${HOLLOW_PROXY_TEST_ARGS:-} ${HOLLOW_PROXY_TEST_LOG_LEVEL}"
  90. SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET
  91. ALLOCATE_NODE_CIDRS=true
  92. # Optional: Enable cluster autoscaler.
  93. ENABLE_KUBEMARK_CLUSTER_AUTOSCALER="${ENABLE_KUBEMARK_CLUSTER_AUTOSCALER:-false}"
  94. # When using Cluster Autoscaler, always start with one hollow-node replica.
  95. # NUM_NODES should not be specified by the user. Instead we use
  96. # NUM_NODES=KUBEMARK_AUTOSCALER_MAX_NODES. This gives other cluster components
  97. # (e.g. kubemark master, Heapster) enough resources to handle maximum cluster size.
  98. if [[ "${ENABLE_KUBEMARK_CLUSTER_AUTOSCALER}" == "true" ]]; then
  99. NUM_REPLICAS=1
  100. if [[ -n "$NUM_NODES" ]]; then
  101. echo "WARNING: Using Cluster Autoscaler, ignoring NUM_NODES parameter. Set KUBEMARK_AUTOSCALER_MAX_NODES to specify maximum size of the cluster."
  102. fi
  103. fi
  104. #Optional: Enable kube dns.
  105. ENABLE_KUBEMARK_KUBE_DNS="${ENABLE_KUBEMARK_KUBE_DNS:-true}"
  106. KUBE_DNS_DOMAIN="${KUBE_DNS_DOMAIN:-cluster.local}"
  107. # Optional: set feature gates
  108. FEATURE_GATES="${KUBE_FEATURE_GATES:-ExperimentalCriticalPodAnnotation=true}"
  109. # Enable a simple "AdvancedAuditing" setup for testing.
  110. ENABLE_APISERVER_ADVANCED_AUDIT="${ENABLE_APISERVER_ADVANCED_AUDIT:-false}"
  111. # Optional: enable pod priority
  112. ENABLE_POD_PRIORITY="${ENABLE_POD_PRIORITY:-}"
  113. if [[ "${ENABLE_POD_PRIORITY}" == "true" ]]; then
  114. FEATURE_GATES="${FEATURE_GATES},PodPriority=true"
  115. fi
  116. # The number of services that are allowed to sync concurrently. Will be passed
  117. # into kube-controller-manager via `--concurrent-service-syncs`
  118. CONCURRENT_SERVICE_SYNCS="${CONCURRENT_SERVICE_SYNCS:-}"