apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: ng-monitoring
  name: ng-monitoring
spec:
  persistentVolumeClaimRetentionPolicy:
    whenDeleted: Retain
    whenScaled: Retain
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: ng-monitoring
  serviceName: ng-monitoring-service
  template:
    metadata:
      labels:
        app: ng-monitoring
    spec:
      containers:
        - args:
            - -c
            - /etc/config/config.yaml
          command:
            - /ngm_api
          image: ngm_api:feat-ed6fc3165f95f4a831fe69feb38bdefd3870f860
          imagePullPolicy: IfNotPresent
          name: ng-monitoring
          ports:
            - containerPort: 12021
              protocol: TCP
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /root/.config/gcloud/
              name: gcp-credentials
              readOnly: true
            - mountPath: /etc/config
              name: api-config
              readOnly: true
            - mountPath: /cache
              name: ngm-cache
      dnsPolicy: ClusterFirst
      nodeSelector:
        clinic.node.type: ngm
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      tolerations:
        - effect: NoExecute
          key: clinic.service
          operator: Equal
          value: ngm
      volumes:
        - configMap:
            defaultMode: 420
            name: ngm-gcp-credentials
          name: gcp-credentials
        - configMap:
            defaultMode: 420
            name: ngm-api-config
          name: api-config
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
  volumeClaimTemplates:
    - apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        name: ngm-cache
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 200Gi
        storageClassName: gp2-delete
        volumeMode: Filesystem
