mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #41843 from yujuhong/do-not-run-kubelet
Automatic merge from submit-queue (batch tested with PRs 40665, 41094, 41351, 41721, 41843) Do not run kubelet in test-cmd.sh The tests are intended to test only `kubectl` commands and do not require kubelet. This fixes #41834 /cc @Random-Liu @dchen1107 @nikhiljindal
This commit is contained in:
		@@ -68,50 +68,9 @@ function run_kube_controller_manager() {
 | 
				
			|||||||
  kube::util::wait_for_url "http://127.0.0.1:${CTLRMGR_PORT}/healthz" "controller-manager"
 | 
					  kube::util::wait_for_url "http://127.0.0.1:${CTLRMGR_PORT}/healthz" "controller-manager"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function run_kubelet() {
 | 
					# Creates a node object with name 127.0.0.1. This is required because we do not
 | 
				
			||||||
  # Only run kubelet on platforms it supports
 | 
					# run kubelet.
 | 
				
			||||||
  if [[ "$(go env GOHOSTOS)" == "linux" ]]; then
 | 
					 | 
				
			||||||
    kube::log::status "Building kubelet"
 | 
					 | 
				
			||||||
    make -C "${KUBE_ROOT}" WHAT="cmd/kubelet"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    kube::log::status "Starting kubelet in masterless mode"
 | 
					 | 
				
			||||||
    "${KUBE_OUTPUT_HOSTBIN}/kubelet" \
 | 
					 | 
				
			||||||
      --really-crash-for-testing=true \
 | 
					 | 
				
			||||||
      --root-dir=/tmp/kubelet.$$ \
 | 
					 | 
				
			||||||
      --cert-dir="${TMPDIR:-/tmp/}" \
 | 
					 | 
				
			||||||
      --docker-endpoint="fake://" \
 | 
					 | 
				
			||||||
      --hostname-override="127.0.0.1" \
 | 
					 | 
				
			||||||
      --address="127.0.0.1" \
 | 
					 | 
				
			||||||
      --port="$KUBELET_PORT" \
 | 
					 | 
				
			||||||
      --healthz-port="${KUBELET_HEALTHZ_PORT}" 1>&2 &
 | 
					 | 
				
			||||||
    KUBELET_PID=$!
 | 
					 | 
				
			||||||
    kube::util::wait_for_url "http://127.0.0.1:${KUBELET_HEALTHZ_PORT}/healthz" "kubelet(masterless)"
 | 
					 | 
				
			||||||
    kill ${KUBELET_PID} 1>&2 2>/dev/null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    kube::log::status "Starting kubelet in masterful mode"
 | 
					 | 
				
			||||||
    "${KUBE_OUTPUT_HOSTBIN}/kubelet" \
 | 
					 | 
				
			||||||
      --really-crash-for-testing=true \
 | 
					 | 
				
			||||||
      --root-dir=/tmp/kubelet.$$ \
 | 
					 | 
				
			||||||
      --cert-dir="${TMPDIR:-/tmp/}" \
 | 
					 | 
				
			||||||
      --docker-endpoint="fake://" \
 | 
					 | 
				
			||||||
      --hostname-override="127.0.0.1" \
 | 
					 | 
				
			||||||
      --address="127.0.0.1" \
 | 
					 | 
				
			||||||
      --api-servers="${API_HOST}:${API_PORT}" \
 | 
					 | 
				
			||||||
      --port="$KUBELET_PORT" \
 | 
					 | 
				
			||||||
      --healthz-port="${KUBELET_HEALTHZ_PORT}" 1>&2 &
 | 
					 | 
				
			||||||
    KUBELET_PID=$!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    kube::util::wait_for_url "http://127.0.0.1:${KUBELET_HEALTHZ_PORT}/healthz" "kubelet"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Creates a node object with name 127.0.0.1 if it doesnt exist already.
 | 
					 | 
				
			||||||
# This is required for non-linux platforms where we do not run kubelet.
 | 
					 | 
				
			||||||
function create_node() {
 | 
					function create_node() {
 | 
				
			||||||
  if [[ "$(go env GOHOSTOS)" == "linux" ]]; then
 | 
					 | 
				
			||||||
    kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/api/v1/nodes/127.0.0.1" "apiserver(nodes)"
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    # create a fake node
 | 
					 | 
				
			||||||
  kubectl create -f - -s "http://127.0.0.1:${API_PORT}" << __EOF__
 | 
					  kubectl create -f - -s "http://127.0.0.1:${API_PORT}" << __EOF__
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "kind": "Node",
 | 
					  "kind": "Node",
 | 
				
			||||||
@@ -126,7 +85,6 @@ function create_node() {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
__EOF__
 | 
					__EOF__
 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kube::log::status "Running kubectl tests for kube-apiserver"
 | 
					kube::log::status "Running kubectl tests for kube-apiserver"
 | 
				
			||||||
@@ -134,7 +92,6 @@ kube::log::status "Running kubectl tests for kube-apiserver"
 | 
				
			|||||||
setup
 | 
					setup
 | 
				
			||||||
run_kube_apiserver
 | 
					run_kube_apiserver
 | 
				
			||||||
run_kube_controller_manager
 | 
					run_kube_controller_manager
 | 
				
			||||||
run_kubelet
 | 
					 | 
				
			||||||
create_node
 | 
					create_node
 | 
				
			||||||
SUPPORTED_RESOURCES=("*")
 | 
					SUPPORTED_RESOURCES=("*")
 | 
				
			||||||
# WARNING: Do not wrap this call in a subshell to capture output, e.g. output=$(runTests)
 | 
					# WARNING: Do not wrap this call in a subshell to capture output, e.g. output=$(runTests)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user