apiVersion: apps/v1
kind: Deployment
metadata:
  name: tls-app
  labels:
    app: tls-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tls-app
  template:
    metadata:
      labels:
        app: tls-app
    spec:
      initContainers:
        - name: certificate-init-container
          image: proofpoint/certificate-init-container:0.4.0
          env:
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          args:
            - "-namespace=$(NAMESPACE)"
            - "-pod-name=$(POD_NAME)"
            - "-query-k8s"
          volumeMounts:
            - name: tls
              mountPath: /etc/tls
      containers:
        - name: tls-app
          image: gcr.io/hightowerlabs/tls-app:1.0.0
          args:
            - "-tls-cert=/etc/tls/tls.crt"
            - "-tls-key=/etc/tls/tls.key"
          ports:
            - containerPort: 443 
          resources:
            limits:
              memory: "50Mi"
              cpu: "100m"
          volumeMounts:
            - name: tls
              mountPath: /etc/tls
      volumes:
        - name: tls
          emptyDir: {}
