apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp-demo
  labels:
    app: lol
spec:
  replicas: 1
  selector:
    matchLabels:
      app: webapp
  template:
    metadata:
      name: webapp
      labels:
        app: webapp
      annotations:
        build: best
        builder: tim
    spec:
      terminationGracePeriodSeconds: 45
      containers:
        - name: webapp
          image: tthebst/flask-webapp
          imagePullPolicy: "Always"
          ports:
            - containerPort: 8088
          env:
            - name: accesstoken_wavefront
              valueFrom:
                secretKeyRef:
                  name: wavefront-key
                  key: wavefront_accesskey
        - name: flask-podinfo-sidecar
          image: tthebst/flask-podinfo-sidecar
          imagePullPolicy: "Always"
          ports:
            - containerPort: 8080
          env:
            - name: accesstoken_ipinfo
              valueFrom:
                secretKeyRef:
                  name: ipinfo-key
                  key: ipinfo_accesskey
            - name: NODENAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: PODIP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: HOSTIP
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
          volumeMounts:
            - name: podinfo
              mountPath: /etc/podinfo
      volumes:
        - name: podinfo
          downwardAPI:
            items:
              - path: "labels"
                fieldRef:
                  fieldPath: metadata.labels
              - path: "annotations"
                fieldRef:
                  fieldPath: metadata.annotations
              - path: "name"
                fieldRef:
                  fieldPath: metadata.name
