Annotated Deployment

Deployment with various recommented labels, liveness probes, resource requests and limits, and a mounted pvc

Parameters

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ name }}
  labels:
    app: {{ name }}
spec:
  replicas: {{ replicas }}
  selector:
    matchLabels:
      app: {{ name }}
  template:
    metadata:
      labels:
        app: {{ name }}
    spec:
      containers:
       - name: {{ name }}
         image: {{ image }}
{% if port %}         ports:
          - containerPort: {{ port }}
{% endif %}         resources:
           requests:
             memory: {{ request_mem }}
             cpu: {{ request_cpu }}
           limits:
             memory: {{ limit_mem }}
             cpu: {{ limit_cpu }}
         readinessProbe:
           httpGet:
             path: {{ probe_path }}
             port: {{ probe_port }}
           initialDelaySeconds: 15
           periodSeconds: 30
         livenessProbe:
           httpGet:
             path:  {{ probe_path }}
             port: {{ probe_port }}
           initialDelaySeconds: 120
           periodSeconds: 60
{% if pvc %}         volumeMounts:
          - mountPath: {{ mount_path }}
            name: vol
      volumes:
        - name: vol
          persistentVolumeClaim:
            claimName: {{ pvc }}
{% endif %}