mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #24112 from cjcullen/rmcomments
Automatic merge from submit-queue Strip comments from configure-vm.sh for gce We are getting very close to the 32KiB limit on GCE metadata entry length. We used to strip comments before putting the value in metadata, but I think we removed it in a refactor because it wasn't absolutely necessary, and leaving it out made the scripts slightly cleaner. It's close to being necessary again. Removing comments reduces the size from 31,609B to 27,221B: https://www.diffchecker.com/0xmmecvw.
This commit is contained in:
commit
26c99fee00
@ -39,6 +39,7 @@ function create-master-instance {
|
||||
fi
|
||||
|
||||
write-master-env
|
||||
prepare-startup-script
|
||||
gcloud compute instances create "${MASTER_NAME}" \
|
||||
${address_opt} \
|
||||
--project "${PROJECT}" \
|
||||
@ -51,7 +52,7 @@ function create-master-instance {
|
||||
--scopes "storage-ro,compute-rw,monitoring,logging-write" \
|
||||
--can-ip-forward \
|
||||
--metadata-from-file \
|
||||
"startup-script=${KUBE_ROOT}/cluster/gce/configure-vm.sh,kube-env=${KUBE_TEMP}/master-kube-env.yaml,cluster-name=${KUBE_TEMP}/cluster-name.txt" \
|
||||
"startup-script=${KUBE_TEMP}/configure-vm.sh,kube-env=${KUBE_TEMP}/master-kube-env.yaml,cluster-name=${KUBE_TEMP}/cluster-name.txt" \
|
||||
--disk "name=${MASTER_NAME}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no" \
|
||||
${preemptible_master}
|
||||
}
|
||||
@ -59,8 +60,9 @@ function create-master-instance {
|
||||
# $1: template name (required)
|
||||
function create-node-instance-template {
|
||||
local template_name="$1"
|
||||
prepare-startup-script
|
||||
create-node-template "$template_name" "${scope_flags}" \
|
||||
"startup-script=${KUBE_ROOT}/cluster/gce/configure-vm.sh" \
|
||||
"startup-script=${KUBE_TEMP}/configure-vm.sh" \
|
||||
"kube-env=${KUBE_TEMP}/node-kube-env.yaml" \
|
||||
"cluster-name=${KUBE_TEMP}/cluster-name.txt"
|
||||
}
|
||||
|
@ -1185,10 +1185,11 @@ function prepare-push() {
|
||||
function push-master {
|
||||
echo "Updating master metadata ..."
|
||||
write-master-env
|
||||
add-instance-metadata-from-file "${KUBE_MASTER}" "kube-env=${KUBE_TEMP}/master-kube-env.yaml" "startup-script=${KUBE_ROOT}/cluster/gce/configure-vm.sh"
|
||||
prepare-startup-script
|
||||
add-instance-metadata-from-file "${KUBE_MASTER}" "kube-env=${KUBE_TEMP}/master-kube-env.yaml" "startup-script=${KUBE_TEMP}/configure-vm.sh"
|
||||
|
||||
echo "Pushing to master (log at ${OUTPUT}/push-${KUBE_MASTER}.log) ..."
|
||||
cat ${KUBE_ROOT}/cluster/gce/configure-vm.sh | gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone "${ZONE}" "${KUBE_MASTER}" --command "sudo bash -s -- --push" &> ${OUTPUT}/push-"${KUBE_MASTER}".log
|
||||
cat ${KUBE_TEMP}/configure-vm.sh | gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone "${ZONE}" "${KUBE_MASTER}" --command "sudo bash -s -- --push" &> ${OUTPUT}/push-"${KUBE_MASTER}".log
|
||||
}
|
||||
|
||||
# Push binaries to kubernetes node
|
||||
@ -1196,10 +1197,11 @@ function push-node() {
|
||||
node=${1}
|
||||
|
||||
echo "Updating node ${node} metadata... "
|
||||
add-instance-metadata-from-file "${node}" "kube-env=${KUBE_TEMP}/node-kube-env.yaml" "startup-script=${KUBE_ROOT}/cluster/gce/configure-vm.sh"
|
||||
prepare-startup-script
|
||||
add-instance-metadata-from-file "${node}" "kube-env=${KUBE_TEMP}/node-kube-env.yaml" "startup-script=${KUBE_TEMP}/configure-vm.sh"
|
||||
|
||||
echo "Start upgrading node ${node} (log at ${OUTPUT}/push-${node}.log) ..."
|
||||
cat ${KUBE_ROOT}/cluster/gce/configure-vm.sh | gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone "${ZONE}" "${node}" --command "sudo bash -s -- --push" &> ${OUTPUT}/push-"${node}".log
|
||||
cat ${KUBE_TEMP}/configure-vm.sh | gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --project "${PROJECT}" --zone "${ZONE}" "${node}" --command "sudo bash -s -- --push" &> ${OUTPUT}/push-"${node}".log
|
||||
}
|
||||
|
||||
# Push binaries to kubernetes cluster
|
||||
@ -1354,3 +1356,8 @@ function ssh-to-node {
|
||||
function prepare-e2e() {
|
||||
detect-project
|
||||
}
|
||||
|
||||
# Writes configure-vm.sh to a temporary location with comments stripped.
|
||||
function prepare-startup-script() {
|
||||
sed '/^\s*#\([^!].*\)*$/ d' ${KUBE_ROOT}/cluster/gce/configure-vm.sh > ${KUBE_TEMP}/configure-vm.sh
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user