apiVersion: batch/v1
kind: Job
metadata:
  name: busybox-master
spec:
  template:
    spec:
      initContainers:
      - name: init-resolver
        image: busybox:1.31.1
        command: ['sh', '-c', 'until nc -nvz $(grep nameserver /etc/resolv.conf | cut -d" " -f2) 53; do echo waiting for container DNS resolver access; sleep 3; done;']
      - name: init-dns
        image: busybox:1.31.1
        command: ['sh', '-c', 'until nslookup mcr.microsoft.com; do echo waiting for successful container DNS resolution; sleep 3; done;']
      - name: init-outbound
        image: busybox:1.31.1
        command: ['sh', '-c', 'until nc -vz 8.8.8.8 53 || 8.8.4.4 53; do echo waiting for outbound internet connectivity; sleep 3; done;']
      containers:
      - image: busybox:1.31.1
        name: busybox-master
        command: ['sh', '-c', '[ $(echo "Hello, World!" | sha256sum | cut -d" " -f1) = "c98c24b677eff44860afea6f493bbaec5bb1c4cbb209c6fc2bbb47f66ff2ad31" ]']
      restartPolicy: Never
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
        operator: "Exists"
      - operator: "Exists"
        effect: NoExecute
      - operator: "Exists"
        effect: NoSchedule
      nodeSelector:
        kubernetes.io/role: master
        beta.kubernetes.io/os: linux
  backoffLimit: 0
