---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: vault
  name: vault
spec:
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: vault
        release: {{ .Release.Name }}
    spec:
      containers:
      - name: vault
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        imagePullPolicy: Never
        command: ["vault", "server", "-dev", "-dev-listen-address=[::]:8202", "-config", "/vault/config/config.json"]
        # command: ["/bin/sh", "-c", "sleep 9999"]
        ports:
        - containerPort: 8200
          name: vaultport
          protocol: TCP
        resources:
          requests:
            cpu: 50m
            memory: 64Mi
          limits:
            cpu: 200m
            memory: 256Mi
        securityContext:
         capabilities:
           add:
             - IPC_LOCK
        env:
        - name: VAULT_DEV_ROOT_TOKEN_ID
          value: vault-root-token
        readinessProbe:
          httpGet:
            path: /v1/sys/health
            port: 8200
            scheme: HTTPS
        volumeMounts:
        - name: vault-config
          mountPath: /vault/config
        - name: vault-tls
          mountPath: /vault/tls
      volumes:
      - name: vault-config
        configMap:
          name: vault-config
      - name: vault-tls
        secret:
          secretName: vault-tls
