apiVersion: apps/v1
kind: Deployment
metadata:
  name: gratibot
  labels:
    chart: '{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}'
spec:
  selector:
    matchLabels:
      app: gratibot
  template:
    metadata:
      labels:
        app: gratibot
    spec:
      containers:
      - name: gratibot
        image: "{{ .Values.gratibot.image }}"
        ports:
          - containerPort: 3000
        resources:
          requests:
            memory: "256Mi"
            cpu: "10m"
          limits:
            memory: "512Mi"
            cpu: "500m" 
        env:
          - name: botHostname
            value: "http://gratibot.{{ .Values.domain }}/oauth"
          - name: mongodbUri
            value: "{{ .Values.mongodbUri }}" 
          - name: clientId
            valueFrom:
              secretKeyRef:
                name: gratibot
                key: clientId
          - name: clientSecret
            valueFrom:
              secretKeyRef:
                name: gratibot
                key: clientsecret
          - name: clientSigningSecret
            valueFrom:
              secretKeyRef:
                name: gratibot
                key: signingsecret
