poc1027b

Young-Kyoo Kim·2025년 10월 27일
apiVersion: batch/v1
kind: Job
metadata:
  name: iperf-test
spec:
  completions: 2       # TARGET 개수
  parallelism: 2       # 동시에 실행할 Job 개수
  completionMode: Indexed  # Job index를 사용
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: iperf-client
          image: networkstatic/iperf3
          command:
            - /bin/sh
            - -c
          args:
            - |
              TARGETS="10.40.23.221 10.40.23.220"
              INDEX=$((${JOB_COMPLETION_INDEX}))
              TARGET=$(echo $TARGETS | awk -v idx=$((INDEX+1)) '{print $idx}')
              echo "Testing target index $INDEX -> $TARGET"
              iperf3 -c "$TARGET" -t 30 -J > /results/iperf_${TARGET}.json
              echo "Done: $TARGET"
          env:
            - name: JOB_COMPLETION_INDEX
              valueFrom:
                fieldRef:
                  fieldPath: metadata.annotations['batch.kubernetes.io/job-completion-index']
          volumeMounts:
            - name: results
              mountPath: /results
      volumes:
        - name: results
          emptyDir: {}

0개의 댓글