apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ .Release.Name }}
spec:
  replicas: 1
# revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}
    spec:
      imagePullSecrets:
      - name: github-container-registry
      containers:
      - name: {{ .Release.Name }}
        image: {{ .Values.image }}
        imagePullPolicy: Always
        command:
        - {{ .Values.command | default "web" | quote }}
        resources:
          requests:
            memory: 128M
            cpu: 100m
          limits:
            memory: 512M
        ports:
        - containerPort: 5000
        envFrom:
        - configMapRef:
            name: {{ .Release.Name }}
        - secretRef:
            name: {{ .Release.Name }}
        - secretRef:
            name: "{{ .Release.Name }}-db-connection"
---
apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
spec:
  selector:
    app: {{ .Release.Name }}
  ports:
  - name: wp
    protocol: TCP
    port: 5000
    targetPort: 5000
