apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/instance: metrics-integration-svc
  name: metrics-integration-workflow
spec:
  persistentVolumeClaimRetentionPolicy:
    whenDeleted: Retain
    whenScaled: Retain
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: metrics-integration-workflow
  serviceName: metrics-integration-workflow
  template:
    metadata:
      labels:
        app: metrics-integration-workflow
    spec:
      containers:
        - args:
            - workflow
            - --config=/etc/metrics-integration/config.yaml
          command:
            - /metrics-integration
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: AWS_DEFAULT_REGION
              value: us-west-2
            - name: AWS_REGION
              value: us-west-2
            - name: AWS_DEFAULT_PROFILE
              value: dbaas
            - name: AWS_CONFIG_FILE
              value: /etc/aws/config
            - name: AWS_SDK_LOAD_CONFIG
              value: "1"
          image: REPLACE_IMAGE_WORKFLOW
          imagePullPolicy: IfNotPresent
          name: metrics-integration-workflow
          resources:
            limits:
              cpu: "1"
              memory: 2Gi
            requests:
              cpu: "1"
              memory: 2Gi
          volumeMounts:
            - mountPath: /etc/metrics-integration
              name: metrics-integration-config
              readOnly: true
            - mountPath: /etc/aws
              name: aws-shared-config
              readOnly: true
            - mountPath: /var/run/secrets/eks.amazonaws.com/serviceaccount
              name: aws-iam-token
              readOnly: true
      restartPolicy: Always
      serviceAccount: metrics-integration
      serviceAccountName: metrics-integration
      terminationGracePeriodSeconds: 30
      volumes:
        - configMap:
            defaultMode: 420
            name: metrics-integration-conf
          name: metrics-integration-config
        - name: aws-iam-token
          projected:
            defaultMode: 420
            sources:
              - serviceAccountToken:
                  audience: sts.amazonaws.com
                  expirationSeconds: 86400
                  path: token
        - configMap:
            defaultMode: 420
            name: aws-shared-config
          name: aws-shared-config
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
