Templatize l7 rc

pull/6/head
Prashanth Balasubramanian 2016-04-04 17:28:52 -07:00
parent 2ec06f8d4a
commit b066cb5357
4 changed files with 18 additions and 9 deletions

View File

@ -1,3 +1,8 @@
{% set kube_uid = "" -%}
{% if pillar['kube_uid'] is defined -%}
{% set kube_uid = pillar['kube_uid'] %}
{% endif -%}
apiVersion: v1
kind: ReplicationController
metadata:
@ -65,4 +70,5 @@ spec:
memory: 50Mi
args:
- --default-backend-service=kube-system/default-http-backend
- --sync-period=300s
- --sync-period=60s
- --cluster-uid={{kube_uid}}

View File

@ -38,6 +38,7 @@ KUBE_RELEASE_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*
# kube::release::parse_and_validate_ci_version()
KUBE_CI_VERSION_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)-(beta|alpha)\\.(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*)\\+[-0-9a-z]*)?$"
# Generate kubeconfig data for the created cluster.
# Assumed vars:
# KUBE_USER
@ -201,13 +202,14 @@ function gen-kube-bearertoken() {
KUBE_BEARER_TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
}
# Generate uuid
# This function only works on systems with /proc/sys/kernel/random/uuid.
# Generate uid
# This function only works on systems with python. It generates a time based
# UID instead of a UUID because GCE has a name length limit.
#
# Vars set:
# KUBE_UUID
function gen-uuid {
KUBE_UUID=$(cat /proc/sys/kernel/random/uuid)
# KUBE_UID
function gen-uid {
KUBE_UID=$(python -c 'import uuid; print uuid.uuid1().fields[0]')
}
@ -464,7 +466,7 @@ function build-kube-env {
local file=$2
build-runtime-config
gen-uuid
gen-uid
rm -f ${file}
cat >$file <<EOF
@ -512,7 +514,7 @@ KUBE_DOCKER_REGISTRY: $(yaml-quote ${KUBE_DOCKER_REGISTRY:-})
KUBE_ADDON_REGISTRY: $(yaml-quote ${KUBE_ADDON_REGISTRY:-})
MULTIZONE: $(yaml-quote ${MULTIZONE:-})
NON_MASQUERADE_CIDR: $(yaml-quote ${NON_MASQUERADE_CIDR:-})
KUBE_UUID: $(yaml-quote ${KUBE_UUID:-})
KUBE_UID: $(yaml-quote ${KUBE_UID:-})
EOF
if [ -n "${KUBELET_PORT:-}" ]; then
cat >>$file <<EOF

View File

@ -439,7 +439,7 @@ manifest_url: '$(echo "$MANIFEST_URL" | sed -e "s/'/''/g")'
manifest_url_header: '$(echo "$MANIFEST_URL_HEADER" | sed -e "s/'/''/g")'
num_nodes: $(echo "${NUM_NODES}" | sed -e "s/'/''/g")
e2e_storage_test_environment: '$(echo "$E2E_STORAGE_TEST_ENVIRONMENT" | sed -e "s/'/''/g")'
kube_uuid: '$(echo "${KUBE_UUID}" | sed -e "s/'/''/g")'
kube_uid: '$(echo "${KUBE_UID}" | sed -e "s/'/''/g")'
EOF
if [ -n "${KUBELET_PORT:-}" ]; then
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls

View File

@ -35,6 +35,7 @@ addon-dir-create:
file.recurse:
- source: salt://kube-addons/cluster-loadbalancing/glbc
- include_pat: E@(^.+\.yaml$|^.+\.json$)
- template: jinja
- user: root
- group: root
- dir_mode: 755