apiVersion: v1
kind: Pod
metadata:
  name: "test-pod"
spec:
  restartPolicy: Never
  containers:
  - name: mock-ip-test
    imagePullPolicy: "IfNotPresent"
    image: "mirror.gcr.io/library/centos:latest"
    command:
    - "bash"
    - "-c"
    - |
      SERVICE_NAME="AMAZON_EC2_METADATA_MOCK_SERVICE"
      HOST_VAR=$(echo "${SERVICE_NAME}_SERVICE_HOST")
      PORT_VAR=$(echo "${SERVICE_NAME}_SERVICE_PORT")
      sleep 3
      ACTUAL=$(curl http://${!HOST_VAR}:${!PORT_VAR}/latest/meta-data/spot/termination-time)
      EXPECTED="1994-05-15T00:00:00Z"
      [[ "$ACTUAL" == "$EXPECTED" ]] && exit 0 || exit 1