---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: dynamodb
  labels:
    name: dynamodb
    app: dynamodb
spec:
  revisionHistoryLimit: 1
  updateStrategy:
    type: RollingUpdate
  serviceName: "dynamodb"
  replicas: 1
  selector:
    matchLabels:
      app: dynamodb
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8000"
      labels:
        name: dynamodb
        app: dynamodb
    spec:
      terminationGracePeriodSeconds: 60
      restartPolicy: Always
      containers:
        - image: docker.io/saidsef/aws-dynamodb-local:latest
          imagePullPolicy: Always
          tty: true
          name: dynamodb
          ports:
            - protocol: TCP
              containerPort: 8000
              name: dynamodb
          resources:
            requests:
              memory: 512Mi
              cpu: 100m
            limits:
              memory: 1Gi
              cpu: 200m
          volumeMounts:
            - name: dynamodb-storage
              mountPath: /data
              subPath: data
          livenessProbe:
            tcpSocket:
              port: 8000
            initialDelaySeconds: 5
            periodSeconds: 3
            successThreshold: 1
            failureThreshold: 2
            timeoutSeconds: 1
          readinessProbe:
            tcpSocket:
              port: 8000
            initialDelaySeconds: 5
            periodSeconds: 3
            successThreshold: 1
            failureThreshold: 2
            timeoutSeconds: 1
          securityContext:
            allowPrivilegeEscalation: false
            privileged: false
            runAsGroup: 1000
            runAsUser: 1000
            capabilities:
             drop:
               - ALL
             add:
               - NET_BIND_SERVICE
               - SYS_TIME
      volumes:
        - name: dynamodb-storage
          emptyDir: {}
