apiVersion: v1
kind: Pod
metadata:
    name: dapi-envars-resourcefieldref
spec:
    containers:
        - name: test-ctr
          image: k8s.gcr.io/busybox:1.24
          command: [ "sh", "-c" ]
          args:
              - while true; do
                  echo -en '\n';
                  printenv MY_CPU_REQUEST MY_CPU_LIMIT;
                  printenv MY_MEM_REQUEST MY_MEM_LIMIT;
                  sleep 10;
                done;
          resources:
              requests:
                  memory: "32Mi"
                  cpu: "125m"
              limits:
                  memory: "64Mi"
                  cpu: "250m"
          env:
              - name: MY_CPU_REQUEST
                valueFrom:
                    resourceFieldRef:
                        containerName: test-ctr
                        resource: requests.cpu
              - name: MY_CPU_LIMIT
                valueFrom:
                    resourceFieldRef:
                        containerName: test-ctr
                        resource: limits.cpu
              - name: MY_MEM_REQUEST
                valueFrom:
                    resourceFieldRef:
                        containerName: test-ctr
                        resource: requests.memory
              - name: MY_MEM_LIMIT
                valueFrom:
                    resourceFieldRef:
                        containerName: test-ctr
                        resource: limits.memory
    restartPolicy: Never
