@@ -1130,25 +1130,25 @@ function Verify-WorkerServices {
1130
1130
$timeout = 12
1131
1131
$retries = 0
1132
1132
$retryDelayInSeconds = 5
1133
-
1133
+
1134
1134
Log- Output (" Testing node connection to API server..." )
1135
1135
do {
1136
1136
$retries ++
1137
1137
$nodes_list = & " ${env: NODE_DIR} \kubectl.exe" get nodes - o= custom- columns= :.metadata.name - A | Out-String
1138
1138
$host_status = & " ${env: NODE_DIR} \kubectl.exe" get nodes (hostname) - o= custom- columns= :.status.conditions[4 ].type | Out-String
1139
1139
Start-Sleep $retryDelayInSeconds
1140
1140
} while (((-Not $nodes_list ) -or (-Not $nodes_list.contains ((hostname))) -or (-Not $host_status.contains (" Ready" )))-and ($retries -le $timeout ))
1141
-
1141
+
1142
1142
If (-Not $nodes_list ){
1143
1143
Throw (" Node: '$ ( hostname) ' failed to connect to API server" )
1144
-
1144
+
1145
1145
}ElseIf (-Not $nodes_list.contains ((hostname))) {
1146
1146
Throw (" Node: '$ ( hostname) ' failed to join the cluster; NODES: '`n $ ( $nodes_list ) '" )
1147
1147
1148
1148
}ELseIf (-Not $host_status.contains (" Ready" )) {
1149
1149
Throw (" Node: '$ ( hostname) ' is not in Ready state" )
1150
1150
}
1151
-
1151
+
1152
1152
Log- Output (" Node: $ ( hostname) successfully joined cluster `n NODES: `n $ ( $nodes_list ) " )
1153
1153
Verify_GceMetadataServerRouteIsPresent
1154
1154
@@ -1543,10 +1543,21 @@ function DownloadAndInstall-NodeProblemDetector {
1543
1543
# CA_CERT
1544
1544
# NODE_PROBLEM_DETECTOR_TOKEN
1545
1545
function Create-NodeProblemDetectorKubeConfig {
1546
- if (-not [string ]::IsNullOrEmpty(${env: NODEPROBLEMDETECTOR_KUBECONFIG_FILE} )) {
1547
- Create- Kubeconfig - Name ' node-problem-detector' `
1548
- - Path ${env: NODEPROBLEMDETECTOR_KUBECONFIG_FILE} `
1549
- - Token ${kube_env} [' NODE_PROBLEM_DETECTOR_TOKEN' ]
1546
+ if (" ${env: ENABLE_NODE_PROBLEM_DETECTOR} " -eq " standalone" ) {
1547
+ if (-not [string ]::IsNullOrEmpty(${kube_env]['NODE_PROBLEM_DETECTOR_TOKEN']} )) {
1548
+ Log- Output " Create-NodeProblemDetectorKubeConfig using Node Problem Detector token"
1549
+ Create- Kubeconfig - Name ' node-problem-detector' `
1550
+ - Path ${env: NODEPROBLEMDETECTOR_KUBECONFIG_FILE} `
1551
+ - Token ${kube_env} [' NODE_PROBLEM_DETECTOR_TOKEN' ]
1552
+ } elseif (Test-Path ${env: BOOTSTRAP_KUBECONFIG} ) {
1553
+ Log- Output " Create-NodeProblemDetectorKubeConfig creating kubeconfig from kubelet kubeconfig"
1554
+ Copy-Item ${env: BOOTSTRAP_KUBECONFIG} - Destination ${env: NODEPROBLEMDETECTOR_KUBECONFIG_FILE}
1555
+ Log- Output (" node-problem-detector bootstrap kubeconfig:`n " +
1556
+ " $ ( Get-Content - Raw ${env: NODEPROBLEMDETECTOR_KUBECONFIG_FILE} ) " )
1557
+ } else {
1558
+ Log- Output " Either NODE_PROBLEM_DETECTOR_TOKEN or ${env: BOOTSTRAP_KUBECONFIG} must be set"
1559
+ exit 1
1560
+ }
1550
1561
}
1551
1562
}
1552
1563
0 commit comments