Make heapster config creation dynamic

This commit is contained in:
Brendan Burns 2015-10-21 13:11:43 -07:00
parent b02b5b9f87
commit 90d9e6e935
9 changed files with 34 additions and 5 deletions

View File

@ -1,3 +1,8 @@
{% set heapster_memory = "300Mi" -%}
{% if pillar['num_nodes'] is defined -%}
{% set heapster_memory = (200 + pillar['num_nodes'] * 12)|string + "Mi" -%}
{% endif -%}
apiVersion: v1
kind: ReplicationController
metadata:
@ -25,7 +30,7 @@ spec:
resources:
limits:
cpu: 100m
memory: 300Mi
memory: {{ heapster_memory }}
command:
- /heapster
- --source=kubernetes:''

View File

@ -1,3 +1,8 @@
{% set heapster_memory = "300Mi" -%}
{% if pillar['num_nodes'] is defined -%}
{% set heapster_memory = (200 + pillar['num_nodes'] * 12)|string + "Mi" -%}
{% endif -%}
apiVersion: v1
kind: ReplicationController
metadata:
@ -25,7 +30,7 @@ spec:
resources:
limits:
cpu: 100m
memory: 300Mi
memory: {{ heapster_memory }}
command:
- /heapster
- --source=kubernetes:''

View File

@ -1,3 +1,8 @@
{% set heapster_memory = "300Mi" -%}
{% if pillar['num_nodes'] is defined -%}
{% set heapster_memory = (200 + pillar['num_nodes'] * 12)|string + "Mi" -%}
{% endif -%}
apiVersion: v1
kind: ReplicationController
metadata:
@ -25,7 +30,7 @@ spec:
resources:
limits:
cpu: 100m
memory: 300Mi
memory: {{ heapster_memory }}
command:
- /heapster
- --source=kubernetes:''

View File

@ -1,3 +1,8 @@
{% set heapster_memory = "300Mi" -%}
{% if pillar['num_nodes'] is defined -%}
{% set heapster_memory = (200 + pillar['num_nodes'] * 12)|string + "Mi" -%}
{% endif -%}
apiVersion: v1
kind: ReplicationController
metadata:
@ -25,7 +30,7 @@ spec:
resources:
limits:
cpu: 100m
memory: 300Mi
memory: {{ heapster_memory }}
command:
- /heapster
- --source=kubernetes:''

View File

@ -40,6 +40,7 @@ network_provider: '$(echo "$NETWORK_PROVIDER")'
opencontrail_tag: '$(echo "$OPENCONTRAIL_TAG")'
opencontrail_kubernetes_tag: '$(echo "$OPENCONTRAIL_KUBERNETES_TAG")'
opencontrail_public_subnet: '$(echo "$OPENCONTRAIL_PUBLIC_SUBNET")'
num_nodes: $(echo "${NUM_MINIONS}")
EOF
if [ -n "${ENABLE_EXPERIMENTAL_API:-}" ]; then

View File

@ -284,6 +284,7 @@ opencontrail_public_subnet: '$(echo "$OPENCONTRAIL_PUBLIC_SUBNET")'
enable_manifest_url: '$(echo "$ENABLE_MANIFEST_URL" | sed -e "s/'/''/g")'
manifest_url: '$(echo "$MANIFEST_URL" | sed -e "s/'/''/g")'
manifest_url_header: '$(echo "$MANIFEST_URL_HEADER" | sed -e "s/'/''/g")'
num_nodes: $(echo "${NUM_MINIONS}")
EOF
if [ -n "${APISERVER_TEST_ARGS:-}" ]; then

View File

@ -69,6 +69,7 @@ KUBELET_KEY: $(yaml-quote ${KUBELET_KEY_BASE64:-})
KUBECFG_CERT: $(yaml-quote ${KUBECFG_CERT_BASE64:-})
KUBECFG_KEY: $(yaml-quote ${KUBECFG_KEY_BASE64:-})
KUBELET_APISERVER: $(yaml-quote ${KUBELET_APISERVER:-})
NUM_MINIONS: $(yaml-quote ${NUM_MINIONS})
EOF
else
cat >>$file <<EOF
@ -86,6 +87,7 @@ LOGGING_DESTINATION=${LOGGING_DESTINATION:-}
ELASTICSEARCH_LOGGING_REPLICAS=${ELASTICSEARCH_LOGGING_REPLICAS:-}
ENABLE_CLUSTER_DNS=${ENABLE_CLUSTER_DNS:-false}
ENABLE_CLUSTER_REGISTRY=${ENABLE_CLUSTER_REGISTRY:-false}
NUM_MINIONS=${NUM_MINIONS}
DNS_REPLICAS=${DNS_REPLICAS:-}
DNS_SERVER_IP=${DNS_SERVER_IP:-}
DNS_DOMAIN=${DNS_DOMAIN:-}

View File

@ -91,6 +91,7 @@ KUBELET_APISERVER: $(yaml-quote ${KUBELET_APISERVER:-})
ENABLE_MANIFEST_URL: $(yaml-quote ${ENABLE_MANIFEST_URL:-false})
MANIFEST_URL: $(yaml-quote ${MANIFEST_URL:-})
MANIFEST_URL_HEADER: $(yaml-quote ${MANIFEST_URL_HEADER:-})
NUM_MINIONS: $(yaml-quote ${NUM_MINIONS})
EOF
if [ -n "${APISERVER_TEST_ARGS:-}" ]; then
cat >>$file <<EOF

View File

@ -23,6 +23,7 @@ addon-dir-create:
file.recurse:
- source: salt://kube-addons/cluster-monitoring/influxdb
- include_pat: E@(^.+\.yaml$|^.+\.json$)
- template: jinja
- user: root
- group: root
- dir_mode: 755
@ -34,6 +35,7 @@ addon-dir-create:
file.recurse:
- source: salt://kube-addons/cluster-monitoring/google
- include_pat: E@(^.+\.yaml$|^.+\.json$)
- template: jinja
- user: root
- group: root
- dir_mode: 755
@ -45,6 +47,7 @@ addon-dir-create:
file.recurse:
- source: salt://kube-addons/cluster-monitoring/standalone
- include_pat: E@(^.+\.yaml$|^.+\.json$)
- template: jinja
- user: root
- group: root
- dir_mode: 755
@ -57,6 +60,7 @@ addon-dir-create:
- source: salt://kube-addons/cluster-monitoring
- include_pat: E@(^.+\.yaml$|^.+\.json$)
- exclude_pat: E@(^.+heapster-controller\.yaml$|^.+heapster-controller\.json$)
- template: jinja
- user: root
- group: root
- dir_mode: 755
@ -196,4 +200,4 @@ kube-addons:
- file: {{ pillar.get('systemd_system_path') }}/kube-addons.service
{% else %}
- file: /etc/init.d/kube-addons
{% endif %}
{% endif %}