apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    component: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      component: nginx
  template:
    metadata:
      labels:
        component: nginx
    spec:
      securityContext:
        fsGroup: 10000
      containers:
      - name: nginx
        image: "{{ .Values.images.nginx }}"
        imagePullPolicy: Always
        livenessProbe:
          exec:
            command:
            - /bin/sh
            - -c
            - "[ -f /tmp/nginx.pid ] && ps -A | grep nginx"
          initialDelaySeconds: 10
          periodSeconds: 10
        readinessProbe:
          httpGet:
            scheme: HTTP
            path: /index.html
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 10
        ports:
        - containerPort: 8080
        volumeMounts:
        - name: config
          mountPath: /etc/nginx/nginx.conf
          subPath: nginx.conf
      volumes:
      - name: config
        configMap:
          name: nginx
