|
14 | 14 | # See the License for the specific language governing permissions and |
15 | 15 | # limitations under the License. |
16 | 16 |
|
| 17 | +############################################################# |
| 18 | +# This script creates an overview of the management cluster. |
| 19 | +# You can call it once, or continuously like this: |
| 20 | +# watch ./hack/output-for-watch.sh |
| 21 | +# |
| 22 | +# You can call it from a different directory, too: |
| 23 | +# ../cluster-api-provider-hetzner/hack/output-for-watch.sh |
| 24 | +############################################################# |
| 25 | + |
| 26 | +hack_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) |
| 27 | + |
17 | 28 | function print_heading() { |
18 | 29 | blue='\033[0;34m' |
19 | 30 | nc='\033[0m' # No Color |
@@ -47,16 +58,18 @@ kubectl get events -A --sort-by=lastTimestamp | grep -vP 'LeaderElection' | tail |
47 | 58 |
|
48 | 59 | print_heading caph: |
49 | 60 |
|
50 | | -./hack/tail-controller-logs.sh |
| 61 | +"$hack_dir"/tail-controller-logs.sh |
51 | 62 |
|
52 | 63 | regex='^I\d\d\d\d|\ |
53 | 64 | .*it may have already been deleted|\ |
54 | 65 | .*WARNING: ignoring DaemonSet-managed Pods|\ |
55 | 66 | .*failed to retrieve Spec.ProviderID|\ |
56 | 67 | .*failed to patch Machine default |
57 | 68 | ' |
58 | | -capi_ns=$(kubectl get deployments -A | grep capi-con | cut -d' ' -f1) |
59 | | -capi_logs=$(kubectl logs -n "$capi_ns" deployments/capi-controller-manager --since 10m | grep -vP "$(echo "$regex" | tr -d '\n')" | tail -5) |
| 69 | +capi_ns=$("$hack_dir"/get-namespace-of-deployment.sh capi-controller-manager) |
| 70 | +capi_pod=$("$hack_dir"/get-leading-pod.sh capi-controller-manager "$capi_ns") |
| 71 | + |
| 72 | +capi_logs=$(kubectl logs -n "$capi_ns" "$capi_pod" --since 10m | grep -vP "$(echo "$regex" | tr -d '\n')" | tail -5) |
60 | 73 | if [ -n "$capi_logs" ]; then |
61 | 74 | print_heading capi |
62 | 75 | echo "$capi_logs" |
|
89 | 102 |
|
90 | 103 | echo |
91 | 104 |
|
92 | | -./hack/get-kubeconfig-of-workload-cluster.sh |
| 105 | +"$hack_dir"/get-kubeconfig-of-workload-cluster.sh |
93 | 106 |
|
94 | 107 | kubeconfig_wl=".workload-cluster-kubeconfig.yaml" |
95 | 108 |
|
@@ -120,9 +133,9 @@ print_heading "workload-cluster nodes" |
120 | 133 | KUBECONFIG=$kubeconfig_wl kubectl get nodes -o 'custom-columns=NAME:.metadata.name,STATUS:.status.phase,ROLES:.metadata.labels.kubernetes\.io/role,creationTimestamp:.metadata.creationTimestamp,VERSION:.status.nodeInfo.kubeletVersion,IP:.status.addresses[?(@.type=="ExternalIP")].address' |
121 | 134 |
|
122 | 135 | if [ "$(kubectl get machine | wc -l)" -ne "$(KUBECONFIG="$kubeconfig_wl" kubectl get nodes | wc -l)" ]; then |
123 | | - echo "❌ Number of nodes in wl-cluster does not match number of machines in mgt-cluster" |
| 136 | + echo "❌ Number of nodes in workload cluster does not match number of machines in management cluster" |
124 | 137 | else |
125 | | - echo "👌 number of nodes in wl-cluster is equal to number of machines in mgt-cluster" |
| 138 | + echo "👌 number of nodes in workload cluster is equal to number of machines in management cluster" |
126 | 139 | fi |
127 | 140 |
|
128 | 141 | rows=$(kubectl get hcloudremediation -A 2>/dev/null) |
|
0 commit comments