Commit db928095 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #50947 from shyamjvs/clusterIpRange-ginkgo

Automatic merge from submit-queue (batch tested with PRs 51108, 51035, 50539, 51160, 50947) Auto-calculate CLUSTER_IP_RANGE based on cluster size In preparation for eliminating CLUSTER_IP_RANGE env var from job configs, making it less error prone while folks try to start their own large cluster tests (https://github.com/kubernetes/kubernetes/issues/50907). /cc @kubernetes/sig-scalability-misc @wojtek-t @gmarek
parents 8bfde3a0 bacc01f7
...@@ -84,6 +84,20 @@ function get-node-ip-range { ...@@ -84,6 +84,20 @@ function get-node-ip-range {
echo "${suggested_range}" echo "${suggested_range}"
} }
function get-cluster-ip-range {
local suggested_range="10.100.0.0/14"
if [[ "${NUM_NODES}" -gt 1000 ]]; then
suggested_range="10.100.0.0/13"
fi
if [[ "${NUM_NODES}" -gt 2000 ]]; then
suggested_range="10.100.0.0/12"
fi
if [[ "${NUM_NODES}" -gt 4000 ]]; then
suggested_range="10.100.0.0/11"
fi
echo "${suggested_range}"
}
if [[ "${FEDERATION:-}" == true ]]; then if [[ "${FEDERATION:-}" == true ]]; then
NODE_SCOPES="${NODE_SCOPES:-compute-rw,monitoring,logging-write,storage-ro,https://www.googleapis.com/auth/ndev.clouddns.readwrite}" NODE_SCOPES="${NODE_SCOPES:-compute-rw,monitoring,logging-write,storage-ro,https://www.googleapis.com/auth/ndev.clouddns.readwrite}"
else else
......
...@@ -92,7 +92,7 @@ ETCD_QUORUM_READ="${ENABLE_ETCD_QUORUM_READ:-false}" ...@@ -92,7 +92,7 @@ ETCD_QUORUM_READ="${ENABLE_ETCD_QUORUM_READ:-false}"
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
NODE_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.244.0.0/14}" CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-$(get-cluster-ip-range)}"
MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}" MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
if [[ "${FEDERATION:-}" == true ]]; then if [[ "${FEDERATION:-}" == true ]]; then
......
...@@ -93,7 +93,7 @@ ETCD_QUORUM_READ="${ENABLE_ETCD_QUORUM_READ:-false}" ...@@ -93,7 +93,7 @@ ETCD_QUORUM_READ="${ENABLE_ETCD_QUORUM_READ:-false}"
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
NODE_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.100.0.0/14}" CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-$(get-cluster-ip-range)}"
MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}" MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
# NODE_IP_RANGE is used when ENABLE_IP_ALIASES=true. It is the primary range in # NODE_IP_RANGE is used when ENABLE_IP_ALIASES=true. It is the primary range in
# the subnet and is the range used for node instance IPs. # the subnet and is the range used for node instance IPs.
......
...@@ -301,4 +301,8 @@ func AfterReadingAllFlags(t *TestContextType) { ...@@ -301,4 +301,8 @@ func AfterReadingAllFlags(t *TestContextType) {
if len(t.Host) == 0 && len(t.KubeConfig) == 0 { if len(t.Host) == 0 && len(t.KubeConfig) == 0 {
t.Host = defaultHost t.Host = defaultHost
} }
// Reset the cluster IP range flag to CLUSTER_IP_RANGE env var, if defined.
if clusterIPRange := os.Getenv("CLUSTER_IP_RANGE"); clusterIPRange != "" {
t.CloudConfig.ClusterIPRange = clusterIPRange
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment