apiVersion: v1
kind: Pod
metadata:
  name: downward
  namespace: chp08-set813
  # Labels and annotations exposed via downwardAPI volume
  labels:
    foo: bar
  annotations: 
    key1: value1
    key2: |
      multi
      line
      value
    keyGeorge: value2
spec:
  containers:
  - name: main
    image: busybox
    command: ["sleep", "9999999"]
# These settings do not work!
#    resources:
#      requests:
#        cpu: 15m
#        memory: 100Ki
#      limits:
#        cpu: 100m
#        memory: 4Mi
    # Mount the downward volume under /etc/downward
    volumeMounts:
    - name: downward
      mountPath: /etc/downward

  volumes: 
  # Define a downwardAPI volume with name downward
  - name: downward
    downwardAPI:
      items:
      - path: "podName"
        fieldRef:
          fieldPath: metadata.name

      - path: "podNamespace"
        fieldRef:
          fieldPath: metadata.namespace

      - path: "podUID"
        fieldRef:
          fieldPath: metadata.uid

      - path: "labels"
        fieldRef:
          fieldPath: metadata.labels

      - path: "annotations"
        fieldRef:
          fieldPath: metadata.annotations

#      - path: "podIP"
#        fieldRef:
#          fieldPath: status.podIP

#      - path: "hostIP"
#        fieldRef:
#          fieldPath: status.hostIP

#      - path: "nodeName"
#        fieldRef:
#          fieldPath: spec.nodeName

#      - path: "serviceAccount"
#        fieldRef:
#          fieldPath: spec.serviceAccountName

      - path: "containerCpuRequestMilliCores"
        resourceFieldRef:
          containerName: main
          resource: requests.cpu
          divisor: 1m

      - path: "containerMemoryLimitBytes"
        resourceFieldRef:
          containerName: main
          resource: limits.memory
          divisor: 1

