Skip to content

Commit

Permalink
Merge pull request #26413 from mwielgus/gci-ca
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

Support for cluster autoscaler in GCE Trusty and GCI images

Fixes: #26346
Ref: #26197

cc: @fgrzadkowski  @vulpecula @piosz @jszczepkowski
  • Loading branch information
k8s-merge-robot committed May 27, 2016
2 parents ae28564 + 5f2695b commit e7269a1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ function kube::release::package_kube_manifests_tarball() {
mkdir -p "${dst_dir}"

local salt_dir="${KUBE_ROOT}/cluster/saltbase/salt"
cp "${salt_dir}/cluster-autoscaler/cluster-autoscaler.manifest" "${dst_dir}/"
cp "${salt_dir}/fluentd-es/fluentd-es.yaml" "${release_stage}/"
cp "${salt_dir}/fluentd-gcp/fluentd-gcp.yaml" "${release_stage}/"
cp "${salt_dir}/kube-registry-proxy/kube-registry-proxy.yaml" "${release_stage}/"
Expand Down
17 changes: 17 additions & 0 deletions cluster/gce/gci/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,22 @@ function start-kube-scheduler {
cp "${src_file}" /etc/kubernetes/manifests
}

# Starts cluster autoscaler.
function start-cluster-autoscaler {
if [ "${ENABLE_NODE_AUTOSCALER:-}" = "true" ]; then
touch /etc/kubernetes/start-cluster-autoscaler-enabled

# Remove salt comments and replace variables with values
src_file="${KUBE_HOME}/kube-manifests/kubernetes/gci-trusty/cluster-autoscaler.manifest"
remove-salt-config-comments "${src_file}"

local params=`sed 's/^/"/;s/ /","/g;s/$/",/' <<< "${AUTOSCALER_MIG_CONFIG}"`
sed -i -e "s@\"{{param}}\",@${params}@g" "${src_file}"
sed -i -e "s@{%.*%}@@g" "${src_file}"
cp "${src_file}" /etc/kubernetes/manifests
fi
}

# A helper function for copying addon manifests and set dir/files
# permissions.
#
Expand Down Expand Up @@ -812,6 +828,7 @@ if [[ "${KUBERNETES_MASTER:-}" == "true" ]]; then
start-kube-controller-manager
start-kube-scheduler
start-kube-addons
start-cluster-autoscaler
else
start-kube-proxy
# Kube-registry-proxy.
Expand Down
14 changes: 14 additions & 0 deletions cluster/gce/trusty/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,20 @@ start_kube_scheduler() {
cp "${src_file}" /etc/kubernetes/manifests
}

# Starts k8s cluster autoscaler.
start_cluster_autoscaler() {
if [ "${ENABLE_NODE_AUTOSCALER:-}" = "true" ]; then
# Remove salt comments and replace variables with values
src_file="${kube_home}/kube-manifests/kubernetes/gci-trusty/cluster-autoscaler.manifest"
remove_salt_config_comments "${src_file}"

local params=`sed 's/^/"/;s/ /","/g;s/$/",/' <<< "${AUTOSCALER_MIG_CONFIG}"`
sed -i -e "s@\"{{param}}\",@${params}@g" "${src_file}"
sed -i -e "s@{%.*%}@@g" "${src_file}"
cp "${src_file}" /etc/kubernetes/manifests
fi
}

# Starts a fluentd static pod for logging.
start_fluentd() {
if [ "${ENABLE_NODE_LOGGING:-}" = "true" ]; then
Expand Down
1 change: 1 addition & 0 deletions cluster/gce/trusty/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ script
start_kube_controller_manager
start_kube_scheduler
start_kube_addons
start_cluster_autoscaler
} 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB}
end script

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% if pillar.get('enable_node_autoscaler', '').lower() == 'true' %}
{% set params = pillar['autoscaler_mig_config'] -%}
{
"kind": "Pod",
Expand Down Expand Up @@ -56,3 +57,4 @@
"restartPolicy": "Always"
}
}
{% endif %}

0 comments on commit e7269a1

Please sign in to comment.