mirror of https://github.com/k3s-io/k3s
Configurable liveness probe initial delays for etcd and kube-apiserver in GCE
parent
da9a4d5da9
commit
c3b0a83a5c
|
@ -838,6 +838,16 @@ EOF
|
||||||
if [ -n "${ETCD_HOSTNAME:-}" ]; then
|
if [ -n "${ETCD_HOSTNAME:-}" ]; then
|
||||||
cat >>$file <<EOF
|
cat >>$file <<EOF
|
||||||
ETCD_HOSTNAME: $(yaml-quote ${ETCD_HOSTNAME})
|
ETCD_HOSTNAME: $(yaml-quote ${ETCD_HOSTNAME})
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [ -n "${ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC:-}" ]; then
|
||||||
|
cat >>$file <<EOF
|
||||||
|
ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC: $(yaml-quote ${ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC})
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [ -n "${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-}" ]; then
|
||||||
|
cat >>$file <<EOF
|
||||||
|
KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC: $(yaml-quote ${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC})
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [ -n "${APISERVER_TEST_ARGS:-}" ]; then
|
if [ -n "${APISERVER_TEST_ARGS:-}" ]; then
|
||||||
|
|
|
@ -494,6 +494,16 @@ EOF
|
||||||
if [ -n "${KUBE_APISERVER_REQUEST_TIMEOUT_SEC:-}" ]; then
|
if [ -n "${KUBE_APISERVER_REQUEST_TIMEOUT_SEC:-}" ]; then
|
||||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||||
kube_apiserver_request_timeout_sec: '$(echo "$KUBE_APISERVER_REQUEST_TIMEOUT_SEC" | sed -e "s/'/''/g")'
|
kube_apiserver_request_timeout_sec: '$(echo "$KUBE_APISERVER_REQUEST_TIMEOUT_SEC" | sed -e "s/'/''/g")'
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [ -n "${ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC:-}" ]; then
|
||||||
|
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||||
|
etcd_liveness_probe_initial_delay: '$(echo "$ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC" | sed -e "s/'/''/g")'
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [ -n "${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-}" ]; then
|
||||||
|
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||||
|
kube_apiserver_liveness_probe_initial_delay: '$(echo "$KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC" | sed -e "s/'/''/g")'
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [ -n "${ADMISSION_CONTROL:-}" ] && [ ${ADMISSION_CONTROL} == *"ImagePolicyWebhook"* ]; then
|
if [ -n "${ADMISSION_CONTROL:-}" ] && [ ${ADMISSION_CONTROL} == *"ImagePolicyWebhook"* ]; then
|
||||||
|
|
|
@ -778,6 +778,7 @@ function prepare-etcd-manifest {
|
||||||
sed -i -e "s@{{ *hostname *}}@$host_name@g" "${temp_file}"
|
sed -i -e "s@{{ *hostname *}}@$host_name@g" "${temp_file}"
|
||||||
sed -i -e "s@{{ *srv_kube_path *}}@/etc/srv/kubernetes@g" "${temp_file}"
|
sed -i -e "s@{{ *srv_kube_path *}}@/etc/srv/kubernetes@g" "${temp_file}"
|
||||||
sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${temp_file}"
|
sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${temp_file}"
|
||||||
|
sed -i -e "s@{{ *liveness_probe_initial_delay *}}@${ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC:-15}@g" "${temp_file}"
|
||||||
# Get default storage backend from manifest file.
|
# Get default storage backend from manifest file.
|
||||||
local -r default_storage_backend=$(cat "${temp_file}" | \
|
local -r default_storage_backend=$(cat "${temp_file}" | \
|
||||||
grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||||
|
@ -1060,6 +1061,7 @@ function start-kube-apiserver {
|
||||||
sed -i -e "s@{{pillar\['kube_docker_registry'\]}}@${DOCKER_REGISTRY}@g" "${src_file}"
|
sed -i -e "s@{{pillar\['kube_docker_registry'\]}}@${DOCKER_REGISTRY}@g" "${src_file}"
|
||||||
sed -i -e "s@{{pillar\['kube-apiserver_docker_tag'\]}}@${kube_apiserver_docker_tag}@g" "${src_file}"
|
sed -i -e "s@{{pillar\['kube-apiserver_docker_tag'\]}}@${kube_apiserver_docker_tag}@g" "${src_file}"
|
||||||
sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
|
sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
|
||||||
|
sed -i -e "s@{{liveness_probe_initial_delay}}@${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-15}@g" "${src_file}"
|
||||||
sed -i -e "s@{{secure_port}}@443@g" "${src_file}"
|
sed -i -e "s@{{secure_port}}@443@g" "${src_file}"
|
||||||
sed -i -e "s@{{secure_port}}@8080@g" "${src_file}"
|
sed -i -e "s@{{secure_port}}@8080@g" "${src_file}"
|
||||||
sed -i -e "s@{{additional_cloud_config_mount}}@@g" "${src_file}"
|
sed -i -e "s@{{additional_cloud_config_mount}}@@g" "${src_file}"
|
||||||
|
|
|
@ -1372,6 +1372,7 @@ function prepare-etcd-manifest {
|
||||||
sed -i -e "s@{{ *hostname *}}@$host_name@g" "${temp_file}"
|
sed -i -e "s@{{ *hostname *}}@$host_name@g" "${temp_file}"
|
||||||
sed -i -e "s@{{ *srv_kube_path *}}@/etc/srv/kubernetes@g" "${temp_file}"
|
sed -i -e "s@{{ *srv_kube_path *}}@/etc/srv/kubernetes@g" "${temp_file}"
|
||||||
sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${temp_file}"
|
sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${temp_file}"
|
||||||
|
sed -i -e "s@{{ *liveness_probe_initial_delay *}}@${ETCD_LIVENESS_PROBE_INITIAL_DELAY_SEC:-15}@g" "${temp_file}"
|
||||||
# Get default storage backend from manifest file.
|
# Get default storage backend from manifest file.
|
||||||
local -r default_storage_backend=$(cat "${temp_file}" | \
|
local -r default_storage_backend=$(cat "${temp_file}" | \
|
||||||
grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
grep -o "{{ *pillar\.get('storage_backend', '\(.*\)') *}}" | \
|
||||||
|
@ -1747,6 +1748,7 @@ function start-kube-apiserver {
|
||||||
sed -i -e "s@{{pillar\['kube_docker_registry'\]}}@${DOCKER_REGISTRY}@g" "${src_file}"
|
sed -i -e "s@{{pillar\['kube_docker_registry'\]}}@${DOCKER_REGISTRY}@g" "${src_file}"
|
||||||
sed -i -e "s@{{pillar\['kube-apiserver_docker_tag'\]}}@${kube_apiserver_docker_tag}@g" "${src_file}"
|
sed -i -e "s@{{pillar\['kube-apiserver_docker_tag'\]}}@${kube_apiserver_docker_tag}@g" "${src_file}"
|
||||||
sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
|
sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
|
||||||
|
sed -i -e "s@{{liveness_probe_initial_delay}}@${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-15}@g" "${src_file}"
|
||||||
sed -i -e "s@{{secure_port}}@443@g" "${src_file}"
|
sed -i -e "s@{{secure_port}}@443@g" "${src_file}"
|
||||||
sed -i -e "s@{{secure_port}}@8080@g" "${src_file}"
|
sed -i -e "s@{{secure_port}}@8080@g" "${src_file}"
|
||||||
sed -i -e "s@{{additional_cloud_config_mount}}@@g" "${src_file}"
|
sed -i -e "s@{{additional_cloud_config_mount}}@@g" "${src_file}"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
{% if pillar.get('storage_backend', 'etcd3') == 'etcd3' -%}
|
{% if pillar.get('storage_backend', 'etcd3') == 'etcd3' -%}
|
||||||
{% set quota_bytes = '--quota-backend-bytes=4294967296' -%}
|
{% set quota_bytes = '--quota-backend-bytes=4294967296' -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
{% set liveness_probe_initial_delay = pillar.get('etcd_liveness_probe_initial_delay', 15) -%}
|
||||||
{% set srv_kube_path = "/srv/kubernetes" -%}
|
{% set srv_kube_path = "/srv/kubernetes" -%}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -67,7 +68,7 @@
|
||||||
"port": {{ port }},
|
"port": {{ port }},
|
||||||
"path": "/health"
|
"path": "/health"
|
||||||
},
|
},
|
||||||
"initialDelaySeconds": 15,
|
"initialDelaySeconds": {{ liveness_probe_initial_delay }},
|
||||||
"timeoutSeconds": 15
|
"timeoutSeconds": 15
|
||||||
},
|
},
|
||||||
"ports": [
|
"ports": [
|
||||||
|
|
|
@ -66,6 +66,8 @@
|
||||||
{% set storage_media_type = "--storage-media-type=" + pillar['storage_media_type'] -%}
|
{% set storage_media_type = "--storage-media-type=" + pillar['storage_media_type'] -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
{% set liveness_probe_initial_delay = pillar.get('kube_apiserver_liveness_probe_initial_delay', 15) -%}
|
||||||
|
|
||||||
{% set request_timeout = "" -%}
|
{% set request_timeout = "" -%}
|
||||||
{% if pillar['kube_apiserver_request_timeout_sec'] is defined -%}
|
{% if pillar['kube_apiserver_request_timeout_sec'] is defined -%}
|
||||||
{% set request_timeout = "--request-timeout=" + pillar['kube_apiserver_request_timeout_sec'] + "s" -%}
|
{% set request_timeout = "--request-timeout=" + pillar['kube_apiserver_request_timeout_sec'] + "s" -%}
|
||||||
|
@ -248,7 +250,7 @@
|
||||||
"port": 8080,
|
"port": 8080,
|
||||||
"path": "/healthz"
|
"path": "/healthz"
|
||||||
},
|
},
|
||||||
"initialDelaySeconds": 15,
|
"initialDelaySeconds": {{liveness_probe_initial_delay}},
|
||||||
"timeoutSeconds": 15
|
"timeoutSeconds": 15
|
||||||
},
|
},
|
||||||
"ports":[
|
"ports":[
|
||||||
|
|
Loading…
Reference in New Issue