apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: nextgen-metering-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nextgen-metering-server
  serviceName: nextgen-metering-server
  template:
    metadata:
      labels:
        app: nextgen-metering-server
    spec:
      serviceAccountName: nextgen-metering-server-manager
      terminationGracePeriodSeconds: 10
      containers:
        - name: nextgen-metering-server
          image: cp9.local/nextgen-metering-server:placeholder
          imagePullPolicy: IfNotPresent
          command:
            - /usr/local/bin/entrypoint.sh
          args:
            - nextgenmetering
          env:
            - name: AWS_DEFAULT_REGION
              value: __CP9_TARGET_REGION__
            - name: AWS_REGION
              value: __CP9_TARGET_REGION__
          ports:
            - name: http
              containerPort: 8081
            - name: metrics
              containerPort: 8083
          readinessProbe:
            tcpSocket:
              port: http
            initialDelaySeconds: 5
            periodSeconds: 5
          resources:
            limits:
              cpu: "1"
              memory: 2Gi
            requests:
              cpu: 100m
              memory: 256Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
          volumeMounts:
            - name: nextgenmetering
              mountPath: /configs
              readOnly: true
            - name: data
              mountPath: /data
      volumes:
        - name: nextgenmetering
          configMap:
            name: nextgenmetering-config
        - name: data
          emptyDir:
            sizeLimit: 2Gi
