Merge pull request #110200 from lajay-lawrence/b227506769

Adds Verification Commands.
This commit is contained in:
Kubernetes Prow Robot 2022-05-26 13:01:55 -07:00 committed by GitHub
commit 771c62d802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1118,12 +1118,34 @@ function WaitFor_KubeletAndKubeProxyReady {
}
# Runs 'kubectl get nodes'.
# TODO(pjh): run more verification commands.
# Runs additional verification commands to ensure node successfully joined cluster
# and that it connects to the API Server.
function Verify-WorkerServices {
Log-Output ("kubectl get nodes:`n" +
$(& "${env:NODE_DIR}\kubectl.exe" get nodes | Out-String))
$timeout = 12
$retries = 0
$retryDelayInSeconds = 5
Log-Output ("Testing node connection to API server...")
do {
$retries++
$nodes_list = & "${env:NODE_DIR}\kubectl.exe" get nodes -o=custom-columns=:.metadata.name -A | Out-String
$host_status = & "${env:NODE_DIR}\kubectl.exe" get nodes (hostname) -o=custom-columns=:.status.conditions[4].type | Out-String
Start-Sleep $retryDelayInSeconds
} while (((-Not $nodes_list) -or (-Not $nodes_list.contains((hostname))) -or (-Not $host_status.contains("Ready")))-and ($retries -le $timeout))
If (-Not $nodes_list){
Throw ("Node: '$(hostname)' failed to connect to API server")
}ElseIf (-Not $nodes_list.contains((hostname))) {
Throw ("Node: '$(hostname)' failed to join the cluster; NODES: '`n $($nodes_list)'")
}ELseIf (-Not $host_status.contains("Ready")) {
Throw ("Node: '$(hostname)' is not in Ready state")
}
Log-Output ("Node: $(hostname) successfully joined cluster `n NODES: `n $($nodes_list)")
Verify_GceMetadataServerRouteIsPresent
Log_Todo "run more verification commands."
}
# Downloads the Windows crictl package and installs its contents (e.g.