apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.appName | default "sample-app" }}
  labels:
    app: {{ .Values.appName }}
    release: {{ .Release.Name }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ .Values.appName }}
  template:
    metadata:
      labels:
        app: {{ .Values.appName }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - containerPort: {{ .Values.service.targetPort }}
              name: http
          env:
            - name: LOG_LEVEL
              value: {{ .Values.env.LOG_LEVEL }}
            - name: NODE_ENV
              value: {{ .Values.env.NODE_ENV }}
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
