mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #31508 from wojtek-t/grab_etcd_logs_from_kubemark
Automatic merge from submit-queue Grab etcd logs from kubemark & retry etcd starts to avoid image pull errors Ref #31105 @gmarek
This commit is contained in:
		@@ -19,21 +19,33 @@
 | 
			
		||||
EVENT_STORE_IP=$1
 | 
			
		||||
EVENT_STORE_URL="http://${EVENT_STORE_IP}:4002"
 | 
			
		||||
NUM_NODES=$2
 | 
			
		||||
 | 
			
		||||
retry() {
 | 
			
		||||
	for i in {1..4}; do
 | 
			
		||||
		"$@" && return 0 || sleep $i
 | 
			
		||||
	done
 | 
			
		||||
	"$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [ "${EVENT_STORE_IP}" == "127.0.0.1" ]; then
 | 
			
		||||
	sudo docker run --net=host -v /var/etcd/data-events:/var/etcd/data -d \
 | 
			
		||||
		gcr.io/google_containers/etcd:3.0.4 /usr/local/bin/etcd \
 | 
			
		||||
	# Retry starting etcd to avoid pulling image errors.
 | 
			
		||||
	retry sudo docker run --net=host \
 | 
			
		||||
		-v /var/etcd/data-events:/var/etcd/data -v /var/log:/var/log -d \
 | 
			
		||||
		gcr.io/google_containers/etcd:3.0.4 /bin/sh -c "/usr/local/bin/etcd \
 | 
			
		||||
		--listen-peer-urls http://127.0.0.1:2381 \
 | 
			
		||||
		--advertise-client-urls=http://127.0.0.1:4002 \
 | 
			
		||||
		--listen-client-urls=http://0.0.0.0:4002 \
 | 
			
		||||
		--data-dir=/var/etcd/data
 | 
			
		||||
		--data-dir=/var/etcd/data 1>> /var/log/etcd-events.log 2>&1"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
sudo docker run --net=host -v /var/etcd/data:/var/etcd/data -d \
 | 
			
		||||
	gcr.io/google_containers/etcd:3.0.4 /usr/local/bin/etcd \
 | 
			
		||||
# Retry starting etcd to avoid pulling image errors.
 | 
			
		||||
retry sudo docker run --net=host \
 | 
			
		||||
	-v /var/etcd/data:/var/etcd/data -v /var/log:/var/log -d \
 | 
			
		||||
	gcr.io/google_containers/etcd:3.0.4 /bin/sh -c "/usr/local/bin/etcd \
 | 
			
		||||
	--listen-peer-urls http://127.0.0.1:2380 \
 | 
			
		||||
	--advertise-client-urls=http://127.0.0.1:2379 \
 | 
			
		||||
	--listen-client-urls=http://0.0.0.0:2379 \
 | 
			
		||||
	--data-dir=/var/etcd/data
 | 
			
		||||
	--data-dir=/var/etcd/data 1>> /var/log/etcd.log 2>&1"
 | 
			
		||||
 | 
			
		||||
# Increase the allowed number of open file descriptors
 | 
			
		||||
ulimit -n 65536
 | 
			
		||||
 
 | 
			
		||||
@@ -115,38 +115,6 @@ run-gcloud-compute-with-retries firewall-rules create "${INSTANCE_PREFIX}-kubema
 | 
			
		||||
  --target-tags "${MASTER_TAG}" \
 | 
			
		||||
  --allow "tcp:443"
 | 
			
		||||
 | 
			
		||||
if [ "${SEPARATE_EVENT_MACHINE:-false}" == "true" ]; then
 | 
			
		||||
  EVENT_STORE_NAME="${INSTANCE_PREFIX}-event-store"
 | 
			
		||||
    run-gcloud-compute-with-retries disks create "${EVENT_STORE_NAME}-pd" \
 | 
			
		||||
      ${GCLOUD_COMMON_ARGS} \
 | 
			
		||||
      --type "${MASTER_DISK_TYPE}" \
 | 
			
		||||
      --size "${MASTER_DISK_SIZE}"
 | 
			
		||||
 | 
			
		||||
    run-gcloud-compute-with-retries instances create "${EVENT_STORE_NAME}" \
 | 
			
		||||
      ${GCLOUD_COMMON_ARGS} \
 | 
			
		||||
      --machine-type "${MASTER_SIZE}" \
 | 
			
		||||
      --image-project="${MASTER_IMAGE_PROJECT}" \
 | 
			
		||||
      --image "${MASTER_IMAGE}" \
 | 
			
		||||
      --tags "${EVENT_STORE_NAME}" \
 | 
			
		||||
      --network "${NETWORK}" \
 | 
			
		||||
      --scopes "storage-ro,compute-rw,logging-write" \
 | 
			
		||||
      --disk "name=${EVENT_STORE_NAME}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
 | 
			
		||||
 | 
			
		||||
  EVENT_STORE_IP=$(gcloud compute instances describe ${EVENT_STORE_NAME} \
 | 
			
		||||
  --zone="${ZONE}" --project="${PROJECT}" | grep networkIP: | cut -f2 -d":" | sed "s/ //g")
 | 
			
		||||
 | 
			
		||||
  until gcloud compute ssh --zone="${ZONE}" --project="${PROJECT}" "${EVENT_STORE_NAME}" --command="ls" &> /dev/null; do
 | 
			
		||||
    sleep 1
 | 
			
		||||
  done
 | 
			
		||||
 | 
			
		||||
  gcloud compute ssh "${EVENT_STORE_NAME}" --zone="${ZONE}" --project="${PROJECT}" \
 | 
			
		||||
    --command="sudo docker run --net=host -d gcr.io/google_containers/etcd:3.0.4 /usr/local/bin/etcd \
 | 
			
		||||
      --listen-peer-urls http://127.0.0.1:2380 \
 | 
			
		||||
      --advertise-client-urls=http://127.0.0.1:4002 \
 | 
			
		||||
      --listen-client-urls=http://0.0.0.0:4002 \
 | 
			
		||||
      --data-dir=/var/etcd/data"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
ensure-temp-dir
 | 
			
		||||
gen-kube-bearertoken
 | 
			
		||||
create-certs ${MASTER_IP}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user