mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #26790 from rmmh/bash-range
Automatic merge from submit-queue Use bash ranges "{1..3}" instead of "$(seq 1 3)". []() <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/26790) <!-- Reviewable:end -->
This commit is contained in:
commit
cdee52e5e7
@ -1547,7 +1547,7 @@ function ssh-to-node {
|
|||||||
|
|
||||||
local ip=$(get_ssh_hostname ${node})
|
local ip=$(get_ssh_hostname ${node})
|
||||||
|
|
||||||
for try in $(seq 1 5); do
|
for try in {1..5}; do
|
||||||
if ssh -oLogLevel=quiet -oConnectTimeout=30 -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "echo test > /dev/null"; then
|
if ssh -oLogLevel=quiet -oConnectTimeout=30 -oStrictHostKeyChecking=no -i "${AWS_SSH_KEY}" ${SSH_USER}@${ip} "echo test > /dev/null"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -1533,7 +1533,7 @@ function ssh-to-node {
|
|||||||
local node="$1"
|
local node="$1"
|
||||||
local cmd="$2"
|
local cmd="$2"
|
||||||
# Loop until we can successfully ssh into the box
|
# Loop until we can successfully ssh into the box
|
||||||
for try in $(seq 1 5); do
|
for try in {1..5}; do
|
||||||
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -339,7 +339,7 @@ function ssh-to-node() {
|
|||||||
local node="$1"
|
local node="$1"
|
||||||
local cmd="$2"
|
local cmd="$2"
|
||||||
# Loop until we can successfully ssh into the box
|
# Loop until we can successfully ssh into the box
|
||||||
for try in $(seq 1 5); do
|
for try in {1..5}; do
|
||||||
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
if gcloud compute ssh --ssh-flag="-o LogLevel=quiet" --ssh-flag="-o ConnectTimeout=30" --project "${PROJECT}" --zone="${ZONE}" "${node}" --command "echo test > /dev/null"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -284,7 +284,7 @@ function pc-create-vm {
|
|||||||
|
|
||||||
# Wait for the VM to be started and connected to the network
|
# Wait for the VM to be started and connected to the network
|
||||||
have_network=0
|
have_network=0
|
||||||
for i in $(seq 120); do
|
for i in {1..120}; do
|
||||||
# photon -n vm networks print several fields:
|
# photon -n vm networks print several fields:
|
||||||
# NETWORK MAC IP GATEWAY CONNECTED?
|
# NETWORK MAC IP GATEWAY CONNECTED?
|
||||||
# We wait until CONNECTED is True
|
# We wait until CONNECTED is True
|
||||||
|
@ -230,7 +230,7 @@ $kubectl create -f bps-load-gen-rc.json --namespace=$NS
|
|||||||
#This script assumes the cloud provider is able to create a load balancer. If this not the case, you may want to check out other ways to make the frontend service accessible from outside (https://github.com/kubernetes/kubernetes/blob/master/docs/services.md#external-services)
|
#This script assumes the cloud provider is able to create a load balancer. If this not the case, you may want to check out other ways to make the frontend service accessible from outside (https://github.com/kubernetes/kubernetes/blob/master/docs/services.md#external-services)
|
||||||
function getIP {
|
function getIP {
|
||||||
echo "Waiting up to 1 min for a public IP to be assigned by the cloud provider..."
|
echo "Waiting up to 1 min for a public IP to be assigned by the cloud provider..."
|
||||||
for i in `seq 1 20`;
|
for i in {1..20};
|
||||||
do
|
do
|
||||||
PUBLIC_IP=$($kubectl get services/frontend --namespace=$NS -o template --template="{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}")
|
PUBLIC_IP=$($kubectl get services/frontend --namespace=$NS -o template --template="{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}")
|
||||||
if [ -n "$PUBLIC_IP" ]; then
|
if [ -n "$PUBLIC_IP" ]; then
|
||||||
@ -249,7 +249,7 @@ function pollfor {
|
|||||||
pass_http=0
|
pass_http=0
|
||||||
|
|
||||||
### Test HTTP Server comes up.
|
### Test HTTP Server comes up.
|
||||||
for i in `seq 1 150`;
|
for i in {1..150};
|
||||||
do
|
do
|
||||||
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
||||||
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "
|
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "
|
||||||
|
@ -267,7 +267,7 @@ function pollfor {
|
|||||||
pass_http=0
|
pass_http=0
|
||||||
|
|
||||||
### Test HTTP Server comes up.
|
### Test HTTP Server comes up.
|
||||||
for i in `seq 1 150`;
|
for i in {1..150};
|
||||||
do
|
do
|
||||||
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
||||||
echo "Trying curl frontend:3000 via $TEST_IP:$NODE_PORT, attempt ${i}. Expect a few failures while pulling images... "
|
echo "Trying curl frontend:3000 via $TEST_IP:$NODE_PORT, attempt ${i}. Expect a few failures while pulling images... "
|
||||||
|
@ -233,7 +233,7 @@ function pollfor {
|
|||||||
pass_http=0
|
pass_http=0
|
||||||
|
|
||||||
### Test HTTP Server comes up.
|
### Test HTTP Server comes up.
|
||||||
for i in `seq 1 150`;
|
for i in {1..150};
|
||||||
do
|
do
|
||||||
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
||||||
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "
|
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "
|
||||||
|
@ -236,7 +236,7 @@ fi
|
|||||||
if [[ -n "${CLOUDSDK_BUCKET:-}" ]]; then
|
if [[ -n "${CLOUDSDK_BUCKET:-}" ]]; then
|
||||||
# Retry the download a few times to mitigate transient server errors and
|
# Retry the download a few times to mitigate transient server errors and
|
||||||
# race conditions where the bucket contents change under us as we download.
|
# race conditions where the bucket contents change under us as we download.
|
||||||
for n in $(seq 3); do
|
for n in {1..3}; do
|
||||||
gsutil -mq cp -r "${CLOUDSDK_BUCKET}" ~ && break || sleep 1
|
gsutil -mq cp -r "${CLOUDSDK_BUCKET}" ~ && break || sleep 1
|
||||||
# Delete any temporary files from the download so that we start from
|
# Delete any temporary files from the download so that we start from
|
||||||
# scratch when we retry.
|
# scratch when we retry.
|
||||||
|
@ -92,7 +92,7 @@ function upload_version() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local -r json_file="${gcs_build_path}/started.json"
|
local -r json_file="${gcs_build_path}/started.json"
|
||||||
for upload_attempt in $(seq 3); do
|
for upload_attempt in {1..3}; do
|
||||||
echo "Uploading version to: ${json_file} (attempt ${upload_attempt})"
|
echo "Uploading version to: ${json_file} (attempt ${upload_attempt})"
|
||||||
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(
|
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(
|
||||||
echo "{"
|
echo "{"
|
||||||
@ -153,7 +153,7 @@ function upload_artifacts_and_build_result() {
|
|||||||
|
|
||||||
echo -n 'Run finished at '; date -d "@${timestamp}"
|
echo -n 'Run finished at '; date -d "@${timestamp}"
|
||||||
|
|
||||||
for upload_attempt in $(seq 3); do
|
for upload_attempt in {1..3}; do
|
||||||
echo "Uploading to ${gcs_build_path} (attempt ${upload_attempt})"
|
echo "Uploading to ${gcs_build_path} (attempt ${upload_attempt})"
|
||||||
echo "Uploading build result: ${build_result}"
|
echo "Uploading build result: ${build_result}"
|
||||||
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(
|
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" <(
|
||||||
|
@ -110,7 +110,7 @@ function kubectl-with-retry()
|
|||||||
{
|
{
|
||||||
ERROR_FILE="${KUBE_TEMP}/kubectl-error"
|
ERROR_FILE="${KUBE_TEMP}/kubectl-error"
|
||||||
preserve_err_file=${PRESERVE_ERR_FILE-false}
|
preserve_err_file=${PRESERVE_ERR_FILE-false}
|
||||||
for count in $(seq 0 3); do
|
for count in {0..3}; do
|
||||||
kubectl "$@" 2> ${ERROR_FILE} || true
|
kubectl "$@" 2> ${ERROR_FILE} || true
|
||||||
if grep -q "the object has been modified" "${ERROR_FILE}"; then
|
if grep -q "the object has been modified" "${ERROR_FILE}"; then
|
||||||
kube::log::status "retry $1, error: $(cat ${ERROR_FILE})"
|
kube::log::status "retry $1, error: $(cat ${ERROR_FILE})"
|
||||||
@ -694,7 +694,7 @@ runTests() {
|
|||||||
## If the resourceVersion is the same as the one stored in the server, the patch will be applied.
|
## If the resourceVersion is the same as the one stored in the server, the patch will be applied.
|
||||||
# Command
|
# Command
|
||||||
# Needs to retry because other party may change the resource.
|
# Needs to retry because other party may change the resource.
|
||||||
for count in $(seq 0 3); do
|
for count in {0..3}; do
|
||||||
resourceVersion=$(kubectl get "${kube_flags[@]}" pod valid-pod -o go-template='{{ .metadata.resourceVersion }}')
|
resourceVersion=$(kubectl get "${kube_flags[@]}" pod valid-pod -o go-template='{{ .metadata.resourceVersion }}')
|
||||||
kubectl patch "${kube_flags[@]}" pod valid-pod -p='{"spec":{"containers":[{"name": "kubernetes-serve-hostname", "image": "nginx"}]},"metadata":{"resourceVersion":"'$resourceVersion'"}}' 2> "${ERROR_FILE}" || true
|
kubectl patch "${kube_flags[@]}" pod valid-pod -p='{"spec":{"containers":[{"name": "kubernetes-serve-hostname", "image": "nginx"}]},"metadata":{"resourceVersion":"'$resourceVersion'"}}' 2> "${ERROR_FILE}" || true
|
||||||
if grep -q "the object has been modified" "${ERROR_FILE}"; then
|
if grep -q "the object has been modified" "${ERROR_FILE}"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user