mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 21:25:09 +00:00
Generate a kube_uuid salt pillar.
This commit is contained in:
@@ -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::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]*)?$"
|
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.
|
# Generate kubeconfig data for the created cluster.
|
||||||
# Assumed vars:
|
# Assumed vars:
|
||||||
# KUBE_USER
|
# 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)
|
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() {
|
function load-or-gen-kube-basicauth() {
|
||||||
if [[ ! -z "${KUBE_CONTEXT:-}" ]]; then
|
if [[ ! -z "${KUBE_CONTEXT:-}" ]]; then
|
||||||
@@ -456,6 +464,7 @@ function build-kube-env {
|
|||||||
local file=$2
|
local file=$2
|
||||||
|
|
||||||
build-runtime-config
|
build-runtime-config
|
||||||
|
gen-uuid
|
||||||
|
|
||||||
rm -f ${file}
|
rm -f ${file}
|
||||||
cat >$file <<EOF
|
cat >$file <<EOF
|
||||||
@@ -503,6 +512,7 @@ KUBE_DOCKER_REGISTRY: $(yaml-quote ${KUBE_DOCKER_REGISTRY:-})
|
|||||||
KUBE_ADDON_REGISTRY: $(yaml-quote ${KUBE_ADDON_REGISTRY:-})
|
KUBE_ADDON_REGISTRY: $(yaml-quote ${KUBE_ADDON_REGISTRY:-})
|
||||||
MULTIZONE: $(yaml-quote ${MULTIZONE:-})
|
MULTIZONE: $(yaml-quote ${MULTIZONE:-})
|
||||||
NON_MASQUERADE_CIDR: $(yaml-quote ${NON_MASQUERADE_CIDR:-})
|
NON_MASQUERADE_CIDR: $(yaml-quote ${NON_MASQUERADE_CIDR:-})
|
||||||
|
KUBE_UUID: $(yaml-quote ${KUBE_UUID:-})
|
||||||
EOF
|
EOF
|
||||||
if [ -n "${KUBELET_PORT:-}" ]; then
|
if [ -n "${KUBELET_PORT:-}" ]; then
|
||||||
cat >>$file <<EOF
|
cat >>$file <<EOF
|
||||||
|
@@ -439,6 +439,7 @@ manifest_url: '$(echo "$MANIFEST_URL" | sed -e "s/'/''/g")'
|
|||||||
manifest_url_header: '$(echo "$MANIFEST_URL_HEADER" | sed -e "s/'/''/g")'
|
manifest_url_header: '$(echo "$MANIFEST_URL_HEADER" | sed -e "s/'/''/g")'
|
||||||
num_nodes: $(echo "${NUM_NODES}" | 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")'
|
e2e_storage_test_environment: '$(echo "$E2E_STORAGE_TEST_ENVIRONMENT" | sed -e "s/'/''/g")'
|
||||||
|
kube_uuid: '$(echo "${KUBE_UUID}" | sed -e "s/'/''/g")'
|
||||||
EOF
|
EOF
|
||||||
if [ -n "${KUBELET_PORT:-}" ]; then
|
if [ -n "${KUBELET_PORT:-}" ]; then
|
||||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||||
|
Reference in New Issue
Block a user