From 361264554d1363cb649ef3e2b7322a1547a0e7e6 Mon Sep 17 00:00:00 2001 From: Shipeng Xie Date: Thu, 9 Feb 2023 00:00:17 -0800 Subject: [PATCH] [FLINK-30757] Upgrade busybox version to a pinned version for operator --- .../docs/custom-resource/pod-template.md | 2 +- e2e-tests/data/flinkdep-cr.yaml | 2 +- e2e-tests/utils.sh | 39 ++++++++++++++----- examples/pod-template.yaml | 2 +- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/docs/content/docs/custom-resource/pod-template.md b/docs/content/docs/custom-resource/pod-template.md index 9a544c9d1a..401a7e5e0b 100644 --- a/docs/content/docs/custom-resource/pod-template.md +++ b/docs/content/docs/custom-resource/pod-template.md @@ -93,7 +93,7 @@ spec: initContainers: # Sample sidecar container - name: busybox - image: busybox:1.33.1 + image: busybox:1.36.0 command: [ 'sh','-c','echo hello from task manager' ] job: jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar diff --git a/e2e-tests/data/flinkdep-cr.yaml b/e2e-tests/data/flinkdep-cr.yaml index 8458cbc216..41f02690a9 100644 --- a/e2e-tests/data/flinkdep-cr.yaml +++ b/e2e-tests/data/flinkdep-cr.yaml @@ -44,7 +44,7 @@ spec: spec: initContainers: - name: artifacts-fetcher - image: busybox:1.33.1 + image: busybox:1.36.0 imagePullPolicy: IfNotPresent # Use wget or other tools to get user jars from remote storage command: [ 'wget', 'https://repo1.maven.org/maven2/org/apache/flink/flink-examples-streaming_2.12/1.14.4/flink-examples-streaming_2.12-1.14.4.jar', '-O', '/flink-artifact/myjob.jar' ] diff --git a/e2e-tests/utils.sh b/e2e-tests/utils.sh index 7149e2513b..da9ae50278 100755 --- a/e2e-tests/utils.sh +++ b/e2e-tests/utils.sh @@ -175,20 +175,39 @@ function debug_and_show_logs { echo "Flink logs:" kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | while read pod;do + init_containers=(`kubectl get pods $pod -o jsonpath='{.spec.initContainers[*].name}'`) + print_pod_container_logs "$pod" "$init_containers" true containers=(`kubectl get pods $pod -o jsonpath='{.spec.containers[*].name}'`) - i=0 - for container in "${containers[@]}"; do - echo "Current logs for $pod:$container: " - kubectl logs $pod $container; - restart_count=$(kubectl get pod $pod -o jsonpath='{.status.containerStatuses['$i'].restartCount}') - if [[ ${restart_count} -gt 0 ]];then - echo "Previous logs for $pod: " - kubectl logs $pod $container --previous - fi - done + print_pod_container_logs "$pod" "$containers" false done } +function print_pod_container_logs { + pod=$1 + containers=$2 + is_init_container=$3 + + if [[ -z "$containers" ]];then + return 0 + fi + + i=0 + for container in "${containers[@]}"; do + echo "Current logs for $pod:$container: " + kubectl logs $pod $container; + if $is_init_container;then + restart_count=$(kubectl get pod $pod -o jsonpath='{.status.initContainerStatuses['$i'].restartCount}') + else + restart_count=$(kubectl get pod $pod -o jsonpath='{.status.containerStatuses['$i'].restartCount}') + fi + if [[ ${restart_count} -gt 0 ]];then + echo "Previous logs for $pod:$container: " + kubectl logs $pod $container --previous + fi + ((i++)) + done +} + function start_minikube { if ! retry_times 5 30 start_minikube_if_not_running; then echo "Could not start minikube. Aborting..." diff --git a/examples/pod-template.yaml b/examples/pod-template.yaml index 17ca46eabf..a7c81ad45d 100644 --- a/examples/pod-template.yaml +++ b/examples/pod-template.yaml @@ -65,7 +65,7 @@ spec: initContainers: # Sample init container for fetching remote artifacts - name: busybox - image: busybox:1.33.1 + image: busybox:1.36.0 volumeMounts: - mountPath: /opt/flink/downloads name: downloads