diff --git a/docs/content/docs/custom-resource/pod-template.md b/docs/content/docs/custom-resource/pod-template.md index 9a544c9d1a..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.33.1 + 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 8458cbc216..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.33.1 + 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/e2e-tests/utils.sh b/e2e-tests/utils.sh index 7149e2513b..7e8ddf1002 100755 --- a/e2e-tests/utils.sh +++ b/e2e-tests/utils.sh @@ -175,20 +175,37 @@ 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 + 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 } +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 "--------BEGIN CURRENT LOG for $pod:${containers[idx]}--------" + kubectl logs $pod ${containers[idx]}; + echo "--------END CURRENT LOG--------" + if [[ ${restart_counts[idx]} -gt 0 ]];then + echo "--------BEGIN PREVIOUS LOGS for $pod:${containers[idx]}--------" + kubectl logs $pod ${containers[idx]} --previous + echo "--------END PREVIOUS LOGS--------" + 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..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.33.1 + image: busybox:1.35.0 volumeMounts: - mountPath: /opt/flink/downloads name: downloads