Merge pull request #57425 from yguo0905/passing-sched-policy-config

Automatic merge from submit-queue (batch tested with PRs 57906, 57425, 56939, 57317, 57762). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

cluster/gce/gci: Support passing kube-scheduler policy config

**What this PR does / why we need it**:

This allows us to specify a customized scheduler policy configuration.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

I'm aware of the ConfigMap but passing a file is much simpler in our case.

This PR is low risk, we will want to cherry pick this into 1.9.

**Release note**:

```release-note
None
```
This commit is contained in:
Kubernetes Submit Queue 2018-01-05 17:52:36 -08:00 committed by GitHub
commit 8dfd6dec4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -992,6 +992,14 @@ current-context: kube-scheduler
EOF
}
function create-kubescheduler-policy-config {
echo "Creating kube-scheduler policy config file"
mkdir -p /etc/srv/kubernetes/kube-scheduler
cat <<EOF >/etc/srv/kubernetes/kube-scheduler/policy-config
${SCHEDULER_POLICY_CONFIG}
EOF
}
function create-node-problem-detector-kubeconfig {
echo "Creating node-problem-detector kubeconfig file"
mkdir -p /var/lib/node-problem-detector
@ -1882,6 +1890,11 @@ function start-kube-scheduler {
if [[ -n "${SCHEDULING_ALGORITHM_PROVIDER:-}" ]]; then
params+=" --algorithm-provider=${SCHEDULING_ALGORITHM_PROVIDER}"
fi
if [[ -n "${SCHEDULER_POLICY_CONFIG:-}" ]]; then
create-kubescheduler-policy-config
params+=" --use-legacy-policy-config"
params+=" --policy-config-file=/etc/srv/kubernetes/kube-scheduler/policy-config"
fi
local -r kube_scheduler_docker_tag=$(cat "${KUBE_HOME}/kube-docker-files/kube-scheduler.docker_tag")
# Remove salt comments and replace variables with values.