apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: prepull-test-containers
spec:
  selector:
    matchLabels:
      prepull-test-images: e2e
  template:
    metadata:
      labels:
        prepull-test-images: e2e
    spec:
      nodeSelector:
        kubernetes.io/os: windows
      # To see containers that are known to be used in e2e tests, run this
      # command against the build-log.txt output from a test run:
      #   grep -v 'Node Info: &Node' build-log.txt \
      #     | grep -ho -E 'e2eteam/([[:alnum:]_-]+):([[:alnum:]./_-]+)' \
      #     | sort | uniq
      # NOTE: this command captures only a subset of the test containers,
      # unfortunately; not all test containers will have their names printed in
      # the test output. Running the command against the output from multiple
      # test runs is also recommended. Filtering out the 'Node Info' lines
      # avoids capturing containers that are only found in the test log
      # *because* we prepulled them. Overall this command may be useful for
      # detecting newly-used test containers but there's not a great way to
      # prune unused containers from this manifest right now.
      #
      # Examining initImageConfigs() in https://github.com/kubernetes/kubernetes/blob/master/test/utils/image/manifest.go may also help, but many of the containers listed there are only used for Linux tests.
      #
      # DaemonSets do not support a RestartPolicy other than 'Always', so we
      # run ping in each container to keep it alive so that kubernetes does not
      # continually restart the containers while we're prepulling.
      containers:
      - image: registry.k8s.io/e2e-test-images/agnhost:2.36
        name: agnhost-236
        resources:
          requests:
            cpu: 1m
        command: ['cmd.exe', '/c', 'ping -n 1800 127.0.0.1 >NUL']
