apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  # This uses a "fullname" template (see _helpers)
  # Basing names on .Release.Name means that the same chart can be installed
  # multiple times into the same namespace.
  name: {{template "fullname" .}}
  labels:
    # The "heritage" label is used to track which tool deployed a given chart.
    # It is useful for admins who want to see what releases a particular tool
    # is responsible for.
    heritage: {{ .Release.Service | quote }}
    # This makes it easy to search for all components of a release using kubectl.
    release: {{ .Release.Name | quote }}
    # This makes it easy to audit chart usage.
    chart: "{{.Chart.Name}}-{{.Chart.Version}}"
spec:
  replicas: {{default 1 .Values.replicaCount}}
  template:
    metadata:
      labels:
        app: {{template "fullname" .}}
        release: {{.Release.Name | quote }}
    spec:
      containers:
      - name: nginx
        # Making image configurable is not necessary. Making imageTag configurable
        # is a nice option for the user. Especially in the strange cases like
        # nginx where the base distro is determined by the tag. Using :latest
        # is frowned upon, using :stable isn't that great either.
        image: "{{default "nginx" .Values.image}}:{{default "stable-alpine" .Values.imageTag}}"
        imagePullPolicy: {{default "IfNotPresent" .Values.pullPolicy}}
        ports:
        - containerPort: 80
        # This (and the volumes section below) mount the config map as a volume.
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: wwwdata-volume
      volumes:
        - name: wwwdata-volume
          configMap:
            name: {{template "fullname" .}}
