From dfd1943e12701b9c9d3eee7de914ba20be4f6753 Mon Sep 17 00:00:00 2001 From: Shipeng Xie Date: Thu, 9 Feb 2023 00:00:17 -0800 Subject: [PATCH 1/3] [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 | 35 +++++++++++++------ examples/pod-template.yaml | 2 +- 4 files changed, 27 insertions(+), 14 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..e33c92a6a7 100755 --- a/e2e-tests/utils.sh +++ b/e2e-tests/utils.sh @@ -175,20 +175,33 @@ function debug_and_show_logs { echo "Flink logs:" kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | while read pod;do - 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" "{.spec.initContainers[*].name}" "{.status.initContainerStatuses[*].restartCount}" + print_pod_container_logs "$pod" "{.spec.containers[*].name}" "{.status.containerStatuses[*].restartCount}" done } +function print_pod_container_logs { + pod=$1 + container_path=$2 + restart_count_path=$3 + + containers=(`kubectl get pods $pod -o jsonpath=$container_path`) + restart_counts=(`kubectl get pod $pod -o jsonpath=$restart_count_path`) + + if [[ -z "$containers" ]];then + return 0 + fi + + for idx in "${!containers[@]}"; do + echo "Current logs for $pod:${containers[idx]}: " + kubectl logs $pod ${containers[idx]}; + if [[ ${restart_counts[idx]} -gt 0 ]];then + echo "Previous logs for $pod:${containers[idx]}: " + kubectl logs $pod ${containers[idx]} --previous + fi + 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 From f8c9d3567df9e17cf110c5eb84b80fd0f677a809 Mon Sep 17 00:00:00 2001 From: Shipeng Xie Date: Fri, 10 Feb 2023 15:52:54 -0800 Subject: [PATCH 2/3] [FLINK-30757] Pin busybox version to 1.35.0 --- docs/content/docs/custom-resource/pod-template.md | 2 +- e2e-tests/data/flinkdep-cr.yaml | 2 +- examples/pod-template.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/docs/custom-resource/pod-template.md b/docs/content/docs/custom-resource/pod-template.md index 401a7e5e0b..8a9360cdfb 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.36.0 + image: busybox:1.35.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 41f02690a9..2170fbe17a 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.36.0 + image: busybox:1.35.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/examples/pod-template.yaml b/examples/pod-template.yaml index a7c81ad45d..83199619d9 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.36.0 + image: busybox:1.35.0 volumeMounts: - mountPath: /opt/flink/downloads name: downloads From 2d3bc5e386cb5304c141bbe22497814a1f81fd4b Mon Sep 17 00:00:00 2001 From: Shipeng Xie Date: Sun, 12 Feb 2023 12:31:08 -0800 Subject: [PATCH 3/3] [FLINK-30757] Add log markers --- e2e-tests/utils.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/e2e-tests/utils.sh b/e2e-tests/utils.sh index e33c92a6a7..7e8ddf1002 100755 --- a/e2e-tests/utils.sh +++ b/e2e-tests/utils.sh @@ -175,7 +175,9 @@ function debug_and_show_logs { echo "Flink logs:" kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | while read pod;do + echo "Printing init container logs" print_pod_container_logs "$pod" "{.spec.initContainers[*].name}" "{.status.initContainerStatuses[*].restartCount}" + echo "Printing main container logs" print_pod_container_logs "$pod" "{.spec.containers[*].name}" "{.status.containerStatuses[*].restartCount}" done } @@ -193,11 +195,13 @@ function print_pod_container_logs { fi for idx in "${!containers[@]}"; do - echo "Current logs for $pod:${containers[idx]}: " + echo "--------BEGIN CURRENT LOG for $pod:${containers[idx]}--------" kubectl logs $pod ${containers[idx]}; + echo "--------END CURRENT LOG--------" if [[ ${restart_counts[idx]} -gt 0 ]];then - echo "Previous logs for $pod:${containers[idx]}: " + echo "--------BEGIN PREVIOUS LOGS for $pod:${containers[idx]}--------" kubectl logs $pod ${containers[idx]} --previous + echo "--------END PREVIOUS LOGS--------" fi done }