From ef0503b834dc3abd6210f9d8d5f349a7def68fcf Mon Sep 17 00:00:00 2001 From: Matt Liggett Date: Mon, 28 Aug 2017 16:29:35 -0700 Subject: [PATCH] Add KUBE_APISERVER_REQUEST_TIMEOUT_SEC env var. If set, connect it to kube-apiserver's --request-timeout flag. --- cluster/common.sh | 7 +++++++ cluster/gce/configure-vm.sh | 5 +++++ cluster/gce/container-linux/configure-helper.sh | 3 +++ cluster/gce/gci/configure-helper.sh | 3 +++ .../saltbase/salt/kube-apiserver/kube-apiserver.manifest | 7 ++++++- 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cluster/common.sh b/cluster/common.sh index 669e520483..8c02c5946e 100755 --- a/cluster/common.sh +++ b/cluster/common.sh @@ -795,6 +795,13 @@ ETCD_CA_CERT: $(yaml-quote ${ETCD_CA_CERT_BASE64:-}) ETCD_PEER_KEY: $(yaml-quote ${ETCD_PEER_KEY_BASE64:-}) ETCD_PEER_CERT: $(yaml-quote ${ETCD_PEER_CERT_BASE64:-}) EOF + # KUBE_APISERVER_REQUEST_TIMEOUT_SEC (if set) controls the --request-timeout + # flag + if [ -n "${KUBE_APISERVER_REQUEST_TIMEOUT_SEC:-}" ]; then + cat >>$file <>$file <>/srv/salt-overlay/pillar/cluster-params.sls storage_media_type: '$(echo "$STORAGE_MEDIA_TYPE" | sed -e "s/'/''/g")' +EOF + fi + if [ -n "${KUBE_APISERVER_REQUEST_TIMEOUT_SEC:-}" ]; then + cat <>/srv/salt-overlay/pillar/cluster-params.sls +kube_apiserver_request_timeout_sec: '$(echo "$KUBE_APISERVER_REQUEST_TIMEOUT_SEC" | sed -e "s/'/''/g")' EOF fi if [ -n "${ADMISSION_CONTROL:-}" ] && [ ${ADMISSION_CONTROL} == *"ImagePolicyWebhook"* ]; then diff --git a/cluster/gce/container-linux/configure-helper.sh b/cluster/gce/container-linux/configure-helper.sh index f4779165f1..5a5c60646b 100755 --- a/cluster/gce/container-linux/configure-helper.sh +++ b/cluster/gce/container-linux/configure-helper.sh @@ -937,6 +937,9 @@ function start-kube-apiserver { if [[ -n "${STORAGE_MEDIA_TYPE:-}" ]]; then params+=" --storage-media-type=${STORAGE_MEDIA_TYPE}" fi + if [[ -n "${KUBE_APISERVER_REQUEST_TIMEOUT_SEC:-}" ]]; then + params+=" --request-timeout=${KUBE_APISERVER_REQUEST_TIMEOUT_SEC}s" + fi if [[ -n "${ENABLE_GARBAGE_COLLECTOR:-}" ]]; then params+=" --enable-garbage-collector=${ENABLE_GARBAGE_COLLECTOR}" fi diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 863a2d6bac..dfbcf42b71 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -1292,6 +1292,9 @@ function start-kube-apiserver { if [[ -n "${STORAGE_MEDIA_TYPE:-}" ]]; then params+=" --storage-media-type=${STORAGE_MEDIA_TYPE}" fi + if [[ -n "${KUBE_APISERVER_REQUEST_TIMEOUT_SEC:-}" ]]; then + params+=" --request-timeout=${KUBE_APISERVER_REQUEST_TIMEOUT_SEC}s" + fi if [[ -n "${ENABLE_GARBAGE_COLLECTOR:-}" ]]; then params+=" --enable-garbage-collector=${ENABLE_GARBAGE_COLLECTOR}" fi diff --git a/cluster/saltbase/salt/kube-apiserver/kube-apiserver.manifest b/cluster/saltbase/salt/kube-apiserver/kube-apiserver.manifest index e3d8f4cac8..2047a5ced1 100644 --- a/cluster/saltbase/salt/kube-apiserver/kube-apiserver.manifest +++ b/cluster/saltbase/salt/kube-apiserver/kube-apiserver.manifest @@ -66,6 +66,11 @@ {% set storage_media_type = "--storage-media-type=" + pillar['storage_media_type'] -%} {% endif -%} +{% set request_timeout = "" -%} +{% if pillar['kube_apiserver_request_timeout_sec'] is defined -%} + {% set request_timeout = "--request-timeout=" + pillar['kube_apiserver_request_timeout_sec'] + "s" -%} +{% endif -%} + {% set max_requests_inflight = "" -%} {% set target_ram_mb = "" -%} {% if pillar['num_nodes'] is defined -%} @@ -196,7 +201,7 @@ {% endif %} {% endif -%} -{% set params = address + " " + storage_backend + " " + storage_media_type + " " + etcd_servers + " " + etcd_servers_overrides + " " + cloud_provider + " " + cloud_config + " " + runtime_config + " " + feature_gates + " " + admission_control + " " + max_requests_inflight + " " + target_ram_mb + " " + service_cluster_ip_range + " " + client_ca_file + basic_auth_file + " " + min_request_timeout + " " + enable_garbage_collector + " " + etcd_quorum_read + " " + audit_log -%} +{% set params = address + " " + storage_backend + " " + storage_media_type + " " + etcd_servers + " " + etcd_servers_overrides + " " + cloud_provider + " " + cloud_config + " " + runtime_config + " " + feature_gates + " " + admission_control + " " + max_requests_inflight + " " + target_ram_mb + " " + service_cluster_ip_range + " " + client_ca_file + basic_auth_file + " " + min_request_timeout + " " + enable_garbage_collector + " " + etcd_quorum_read + " " + audit_log + " " + request-timeout -%} {% set params = params + " " + cert_file + " " + key_file + " " + kubelet_cert_file + " " + kubelet_key_file + " --secure-port=" + secure_port + token_auth_file + " " + bind_address + " " + log_level + " " + advertise_address + " " + proxy_ssh_options + authz_mode + abac_policy_file + webhook_authentication_config + webhook_authorization_config + image_review_config -%} # test_args has to be kept at the end, so they'll overwrite any prior configuration