From 2ec06f8d4a632c83b775c2fad91c0e1ef8cb57ee Mon Sep 17 00:00:00 2001 From: Prashanth Balasubramanian Date: Mon, 4 Apr 2016 17:04:54 -0700 Subject: [PATCH] Generate a kube_uuid salt pillar. --- cluster/common.sh | 12 +++++++++++- cluster/gce/configure-vm.sh | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cluster/common.sh b/cluster/common.sh index de656d0dec3..9f91c7200d1 100755 --- a/cluster/common.sh +++ b/cluster/common.sh @@ -38,7 +38,6 @@ 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 @@ -202,6 +201,15 @@ 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. +# +# Vars set: +# KUBE_UUID +function gen-uuid { + KUBE_UUID=$(cat /proc/sys/kernel/random/uuid) +} + function load-or-gen-kube-basicauth() { if [[ ! -z "${KUBE_CONTEXT:-}" ]]; then @@ -456,6 +464,7 @@ function build-kube-env { local file=$2 build-runtime-config + gen-uuid rm -f ${file} cat >$file <>$file <>/srv/salt-overlay/pillar/cluster-params.sls