apiVersion: v1
kind: Service
metadata:
  name: hishtory-api
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    app: hishtory-api
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hishtory-api
spec:
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app: hishtory-api
  replicas: 1
  template:
    metadata:
      labels:
        app: hishtory-api
    spec:
      containers:
      - name: hishtory-api
        image: gcr.io/dworken-k8s/hishtory-api
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        volumeMounts:
        - name: aws-secret-volume
          mountPath: /root/awscreds/
        env:
        - name: AWS_SHARED_CREDENTIALS_FILE
          value: /root/.aws/credentials
        - name: DOGSTATSD_HOST_IP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP

      volumes:
        - name: aws-secret-volume
          secret:
            secretName: aws-secret
