Skip to content

Commit

Permalink
Merge pull request kubernetes#110200 from lajay-lawrence/b227506769
Browse files Browse the repository at this point in the history
Adds Verification Commands.
  • Loading branch information
k8s-ci-robot committed May 26, 2022
2 parents 908a830 + 9a035e3 commit 771c62d
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions cluster/gce/windows/k8s-node-setup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 771c62d

Please sign in to comment.