From 9d26d3701ea745c3edf7c16e276fab2d9bd83e68 Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Tue, 6 Sep 2016 17:24:57 +0300 Subject: [PATCH] Set eviction-hard for vagrant cluster In order to test eviction related functionality it will be convenient to have reasonable eviction defaults. At this moment exactly same flags are used by GCE environment kubelet will have a following flag: --eviction-hard=memory.available<100Mi,nodefs.available<10% Change-Id: I56ca03bc3c5467c8450150e292f7a346fa7772a9 --- cluster/vagrant/config-default.sh | 3 +++ cluster/vagrant/config-test.sh | 3 +++ cluster/vagrant/provision-utils.sh | 6 ++++++ cluster/vagrant/util.sh | 1 + 4 files changed, 13 insertions(+) diff --git a/cluster/vagrant/config-default.sh b/cluster/vagrant/config-default.sh index 1f97b9bb833..53e4b80248a 100755 --- a/cluster/vagrant/config-default.sh +++ b/cluster/vagrant/config-default.sh @@ -115,3 +115,6 @@ E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false} # Default fallback NETWORK_IF_NAME, will be used in case when no 'VAGRANT-BEGIN' comments were defined in network-script export DEFAULT_NETWORK_IF_NAME="eth0" + +# Evict pods whenever compute resource availability on the nodes gets below a threshold. +EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%}" diff --git a/cluster/vagrant/config-test.sh b/cluster/vagrant/config-test.sh index 876e26ae4f4..f6dc030ce2e 100644 --- a/cluster/vagrant/config-test.sh +++ b/cluster/vagrant/config-test.sh @@ -26,3 +26,6 @@ REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false} # Optional: if set to true, kube-up will configure the cluster to run e2e tests. E2E_STORAGE_TEST_ENVIRONMENT=${KUBE_E2E_STORAGE_TEST_ENVIRONMENT:-false} + +# Evict pods whenever compute resource availability on the nodes gets below a threshold. +EVICTION_HARD="${EVICTION_HARD:-memory.available<100Mi,nodefs.available<10%}" diff --git a/cluster/vagrant/provision-utils.sh b/cluster/vagrant/provision-utils.sh index 59c62e5b758..9c066a23c82 100755 --- a/cluster/vagrant/provision-utils.sh +++ b/cluster/vagrant/provision-utils.sh @@ -78,6 +78,12 @@ opencontrail_public_subnet: '$(echo "$OPENCONTRAIL_PUBLIC_SUBNET" | sed -e "s/'/ e2e_storage_test_environment: '$(echo "$E2E_STORAGE_TEST_ENVIRONMENT" | sed -e "s/'/''/g")' EOF +if [ -n "${EVICTION_HARD:-}" ]; then + cat <>/srv/salt-overlay/pillar/cluster-params.sls +eviction_hard: '$(echo "${EVICTION_HARD}" | sed -e "s/'/''/g")' +EOF +fi + cat </etc/salt/minion.d/log-level-debug.conf log_level: warning log_level_logfile: warning diff --git a/cluster/vagrant/util.sh b/cluster/vagrant/util.sh index 536233ea34b..3d9841e29d9 100755 --- a/cluster/vagrant/util.sh +++ b/cluster/vagrant/util.sh @@ -188,6 +188,7 @@ function echo-kube-env() { echo "OPENCONTRAIL_PUBLIC_SUBNET='${OPENCONTRAIL_PUBLIC_SUBNET:-}'" echo "E2E_STORAGE_TEST_ENVIRONMENT='${E2E_STORAGE_TEST_ENVIRONMENT:-}'" echo "CUSTOM_FEDORA_REPOSITORY_URL='${CUSTOM_FEDORA_REPOSITORY_URL:-}'" + echo "EVICTION_HARD='${EVICTION_HARD:-}'" } function verify-cluster {