Skip to content

Commit 8d80956

Browse files
authored
🌱 Update hack dir (#1668)
Update output-for-watch.sh and tail-controller-logs.sh: support caph running in a different namespace (not fix to capi-system). update-operator-dev-deployment.sh: Be sure to not update the cluster, if connected via oidc (avoid accidentally changing a non-test system)
1 parent d750d27 commit 8d80956

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

hack/output-for-watch.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ kubectl get hetznerbaremetalhost -A
4242

4343
print_heading events:
4444

45-
kubectl get events -A --sort-by=lastTimestamp | grep -vP 'LeaderElection' | tail -8
45+
kubectl get events -A --sort-by=lastTimestamp | grep -vP 'LeaderElection' | tail -6
4646

4747
print_heading caph:
4848

@@ -54,15 +54,16 @@ regex='^I\d\d\d\d|\
5454
.*failed to retrieve Spec.ProviderID|\
5555
.*failed to patch Machine default
5656
'
57-
capi_logs=$(kubectl logs -n capi-system deployments/capi-controller-manager --since 7m | grep -vP "$(echo "$regex" | tr -d '\n')" | tail -5)
57+
capi_ns=$(kubectl get deployments -A | grep capi-con | cut -d' ' -f1)
58+
capi_logs=$(kubectl logs -n "$capi_ns" deployments/capi-controller-manager --since 10m | grep -vP "$(echo "$regex" | tr -d '\n')" | tail -5)
5859
if [ -n "$capi_logs" ]; then
5960
print_heading capi
6061
echo "$capi_logs"
6162
fi
6263

6364
echo
6465

65-
if [ $(kubectl get machine -l cluster.x-k8s.io/control-plane 2>/dev/null | wc -l) -eq 0 ]; then
66+
if [[ $(kubectl get machine -l cluster.x-k8s.io/control-plane 2>/dev/null | wc -l) -eq 0 ]]; then
6667
echo "❌ no control-plane machine exists."
6768
exit 1
6869
fi

hack/tail-controller-logs.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
pod=$(kubectl -n caph-system get pods | grep caph-controller-manager | cut -d' ' -f1)
17+
ns=$(kubectl get deployments.apps -A | grep caph-controller-manager | cut -d' ' -f1)
18+
pod=$(kubectl -n "$ns" get pods | grep caph-controller-manager | cut -d' ' -f1)
1819

1920
if [ -z "$pod" ]; then
2021
echo "failed to find caph-controller-manager pod"
2122
exit 1
2223
fi
2324

24-
kubectl -n caph-system logs "$pod" --tail 200 | \
25-
./hack/filter-caph-controller-manager-logs.py - | \
26-
tail -n 20
25+
kubectl -n "$ns" logs "$pod" --tail 200 |
26+
./hack/filter-caph-controller-manager-logs.py - |
27+
tail -n 10

hack/update-operator-dev-deployment.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
trap 'echo "Warning: A command has failed. Exiting the script. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0")"; exit 3' ERR
2626
set -Eeuo pipefail
2727

28+
if [[ $(kubectl config current-context) == *oidc@* ]]; then
29+
echo "found oidc@ in the current kubectl context. It is likely that you are connected"
30+
echo "to the wrong cluster"
31+
exit 1
32+
fi
33+
2834
image_path="ghcr.io/syself"
2935

3036
while [[ "$#" -gt 0 ]]; do

hack/upgrade-builder-image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
# This script is executed in the Update-Bot container.
18+
# Call it via `make builder-image-push`.
1819
# It checks if the Dockerfile for the build container has changed.
1920
# If so, it uses the version of the main branch as the basis for creating a new image tag.
2021
# The script also checks if the image tag for the build image exists in the main branch.

0 commit comments

Comments
 (0)