mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #67695 from ipuustin/start-kubemark
start-kubemark.sh: clean up the shell script.
This commit is contained in:
commit
dbd3be9213
@ -21,7 +21,7 @@ set -o nounset
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
TMP_ROOT="$(dirname "${BASH_SOURCE}")/../.."
|
TMP_ROOT="$(dirname "${BASH_SOURCE}")/../.."
|
||||||
KUBE_ROOT=$(readlink -e ${TMP_ROOT} 2> /dev/null || perl -MCwd -e 'print Cwd::abs_path shift' ${TMP_ROOT})
|
KUBE_ROOT=$(readlink -e "${TMP_ROOT}" 2> /dev/null || perl -MCwd -e 'print Cwd::abs_path shift' "${TMP_ROOT}")
|
||||||
|
|
||||||
source "${KUBE_ROOT}/test/kubemark/skeleton/util.sh"
|
source "${KUBE_ROOT}/test/kubemark/skeleton/util.sh"
|
||||||
source "${KUBE_ROOT}/test/kubemark/cloud-provider-config.sh"
|
source "${KUBE_ROOT}/test/kubemark/cloud-provider-config.sh"
|
||||||
@ -97,7 +97,7 @@ function generate-pki-config {
|
|||||||
kube::util::ensure-temp-dir
|
kube::util::ensure-temp-dir
|
||||||
gen-kube-bearertoken
|
gen-kube-bearertoken
|
||||||
gen-kube-basicauth
|
gen-kube-basicauth
|
||||||
create-certs ${MASTER_IP}
|
create-certs "${MASTER_IP}"
|
||||||
KUBELET_TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
|
KUBELET_TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
|
||||||
KUBE_PROXY_TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
|
KUBE_PROXY_TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
|
||||||
NODE_PROBLEM_DETECTOR_TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
|
NODE_PROBLEM_DETECTOR_TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
|
||||||
@ -213,11 +213,11 @@ function create-and-upload-hollow-node-image {
|
|||||||
fi
|
fi
|
||||||
echo "Copying kubemark binary to ${MAKE_DIR}"
|
echo "Copying kubemark binary to ${MAKE_DIR}"
|
||||||
cp "${KUBEMARK_BIN}" "${MAKE_DIR}"
|
cp "${KUBEMARK_BIN}" "${MAKE_DIR}"
|
||||||
CURR_DIR=`pwd`
|
CURR_DIR=$(pwd)
|
||||||
cd "${MAKE_DIR}"
|
cd "${MAKE_DIR}"
|
||||||
REGISTRY=${KUBEMARK_IMAGE_REGISTRY} IMAGE_TAG=${KUBEMARK_IMAGE_TAG} run-cmd-with-retries "${build_cmd[@]}"
|
REGISTRY=${KUBEMARK_IMAGE_REGISTRY} IMAGE_TAG=${KUBEMARK_IMAGE_TAG} run-cmd-with-retries "${build_cmd[@]}"
|
||||||
rm kubemark
|
rm kubemark
|
||||||
cd $CURR_DIR
|
cd "$CURR_DIR"
|
||||||
fi
|
fi
|
||||||
echo "Created and uploaded the kubemark hollow-node image to docker registry."
|
echo "Created and uploaded the kubemark hollow-node image to docker registry."
|
||||||
# Cleanup the kubemark image after the script exits.
|
# Cleanup the kubemark image after the script exits.
|
||||||
@ -235,27 +235,27 @@ function delete-kubemark-image {
|
|||||||
# templates, and finally create these resources through kubectl.
|
# templates, and finally create these resources through kubectl.
|
||||||
function create-kube-hollow-node-resources {
|
function create-kube-hollow-node-resources {
|
||||||
# Create kubeconfig for Kubelet.
|
# Create kubeconfig for Kubelet.
|
||||||
KUBELET_KUBECONFIG_CONTENTS=$(echo "apiVersion: v1
|
KUBELET_KUBECONFIG_CONTENTS="apiVersion: v1
|
||||||
kind: Config
|
kind: Config
|
||||||
users:
|
users:
|
||||||
- name: kubelet
|
- name: kubelet
|
||||||
user:
|
user:
|
||||||
client-certificate-data: "${KUBELET_CERT_BASE64}"
|
client-certificate-data: ${KUBELET_CERT_BASE64}
|
||||||
client-key-data: "${KUBELET_KEY_BASE64}"
|
client-key-data: ${KUBELET_KEY_BASE64}
|
||||||
clusters:
|
clusters:
|
||||||
- name: kubemark
|
- name: kubemark
|
||||||
cluster:
|
cluster:
|
||||||
certificate-authority-data: "${CA_CERT_BASE64}"
|
certificate-authority-data: ${CA_CERT_BASE64}
|
||||||
server: https://${MASTER_IP}
|
server: https://${MASTER_IP}
|
||||||
contexts:
|
contexts:
|
||||||
- context:
|
- context:
|
||||||
cluster: kubemark
|
cluster: kubemark
|
||||||
user: kubelet
|
user: kubelet
|
||||||
name: kubemark-context
|
name: kubemark-context
|
||||||
current-context: kubemark-context")
|
current-context: kubemark-context"
|
||||||
|
|
||||||
# Create kubeconfig for Kubeproxy.
|
# Create kubeconfig for Kubeproxy.
|
||||||
KUBEPROXY_KUBECONFIG_CONTENTS=$(echo "apiVersion: v1
|
KUBEPROXY_KUBECONFIG_CONTENTS="apiVersion: v1
|
||||||
kind: Config
|
kind: Config
|
||||||
users:
|
users:
|
||||||
- name: kube-proxy
|
- name: kube-proxy
|
||||||
@ -271,10 +271,10 @@ contexts:
|
|||||||
cluster: kubemark
|
cluster: kubemark
|
||||||
user: kube-proxy
|
user: kube-proxy
|
||||||
name: kubemark-context
|
name: kubemark-context
|
||||||
current-context: kubemark-context")
|
current-context: kubemark-context"
|
||||||
|
|
||||||
# Create kubeconfig for Heapster.
|
# Create kubeconfig for Heapster.
|
||||||
HEAPSTER_KUBECONFIG_CONTENTS=$(echo "apiVersion: v1
|
HEAPSTER_KUBECONFIG_CONTENTS="apiVersion: v1
|
||||||
kind: Config
|
kind: Config
|
||||||
users:
|
users:
|
||||||
- name: heapster
|
- name: heapster
|
||||||
@ -290,10 +290,10 @@ contexts:
|
|||||||
cluster: kubemark
|
cluster: kubemark
|
||||||
user: heapster
|
user: heapster
|
||||||
name: kubemark-context
|
name: kubemark-context
|
||||||
current-context: kubemark-context")
|
current-context: kubemark-context"
|
||||||
|
|
||||||
# Create kubeconfig for Cluster Autoscaler.
|
# Create kubeconfig for Cluster Autoscaler.
|
||||||
CLUSTER_AUTOSCALER_KUBECONFIG_CONTENTS=$(echo "apiVersion: v1
|
CLUSTER_AUTOSCALER_KUBECONFIG_CONTENTS="apiVersion: v1
|
||||||
kind: Config
|
kind: Config
|
||||||
users:
|
users:
|
||||||
- name: cluster-autoscaler
|
- name: cluster-autoscaler
|
||||||
@ -309,10 +309,10 @@ contexts:
|
|||||||
cluster: kubemark
|
cluster: kubemark
|
||||||
user: cluster-autoscaler
|
user: cluster-autoscaler
|
||||||
name: kubemark-context
|
name: kubemark-context
|
||||||
current-context: kubemark-context")
|
current-context: kubemark-context"
|
||||||
|
|
||||||
# Create kubeconfig for NodeProblemDetector.
|
# Create kubeconfig for NodeProblemDetector.
|
||||||
NPD_KUBECONFIG_CONTENTS=$(echo "apiVersion: v1
|
NPD_KUBECONFIG_CONTENTS="apiVersion: v1
|
||||||
kind: Config
|
kind: Config
|
||||||
users:
|
users:
|
||||||
- name: node-problem-detector
|
- name: node-problem-detector
|
||||||
@ -328,10 +328,10 @@ contexts:
|
|||||||
cluster: kubemark
|
cluster: kubemark
|
||||||
user: node-problem-detector
|
user: node-problem-detector
|
||||||
name: kubemark-context
|
name: kubemark-context
|
||||||
current-context: kubemark-context")
|
current-context: kubemark-context"
|
||||||
|
|
||||||
# Create kubeconfig for Kube DNS.
|
# Create kubeconfig for Kube DNS.
|
||||||
KUBE_DNS_KUBECONFIG_CONTENTS=$(echo "apiVersion: v1
|
KUBE_DNS_KUBECONFIG_CONTENTS="apiVersion: v1
|
||||||
kind: Config
|
kind: Config
|
||||||
users:
|
users:
|
||||||
- name: kube-dns
|
- name: kube-dns
|
||||||
@ -347,7 +347,7 @@ contexts:
|
|||||||
cluster: kubemark
|
cluster: kubemark
|
||||||
user: kube-dns
|
user: kube-dns
|
||||||
name: kubemark-context
|
name: kubemark-context
|
||||||
current-context: kubemark-context")
|
current-context: kubemark-context"
|
||||||
|
|
||||||
# Create kubemark namespace.
|
# Create kubemark namespace.
|
||||||
"${KUBECTL}" create -f "${RESOURCE_DIRECTORY}/kubemark-ns.json"
|
"${KUBECTL}" create -f "${RESOURCE_DIRECTORY}/kubemark-ns.json"
|
||||||
@ -453,7 +453,7 @@ function wait-for-hollow-nodes-to-run-or-timeout {
|
|||||||
echo "${running} hollow-nodes are reported as 'Running'"
|
echo "${running} hollow-nodes are reported as 'Running'"
|
||||||
not_running=$(($(echo "${pods}" | grep -v "Running" | wc -l) - 1))
|
not_running=$(($(echo "${pods}" | grep -v "Running" | wc -l) - 1))
|
||||||
echo "${not_running} hollow-nodes are reported as NOT 'Running'"
|
echo "${not_running} hollow-nodes are reported as NOT 'Running'"
|
||||||
echo $(echo "${pods}" | grep -v "Running")
|
echo "${pods}" | grep -v Running
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
nodes=$("${KUBECTL}" --kubeconfig="${LOCAL_KUBECONFIG}" get node 2> /dev/null) || true
|
nodes=$("${KUBECTL}" --kubeconfig="${LOCAL_KUBECONFIG}" get node 2> /dev/null) || true
|
||||||
|
Loading…
Reference in New Issue
Block a user