apiVersion: v1
kind: Service
metadata:
  name: jackson-dynamodb
  labels:
    app: dynamodb
spec:
  type: ClusterIP
  ports:
    - name: dynamodb
      port: 8000
      targetPort: 8000
  selector:
    app: dynamodb
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: jackson-dynamodb
spec:
  selector:
    matchLabels:
      app: dynamodb
  serviceName: jackson-dynamodb
  template:
    metadata:
      labels:
        app: dynamodb
    spec:
      containers:
        - name: dynamodb
          image: amazon/dynamodb-local:latest
          imagePullPolicy: IfNotPresent
          command:
            - java
            - -jar
            - DynamoDBLocal.jar
            - -sharedDb
            - -dbPath
            - ./data
          ports:
            - name: dynamodb
              containerPort: 8000
          # readinessProbe:
          #   exec:
          #     command:
          #       - curl
          #       - -f
          #       - http://localhost:8000/shell/
          #   initialDelaySeconds: 5
          #   timeoutSeconds: 1
          #   periodSeconds: 10
          volumeMounts:
            - name: jackson-dynamodb-data
              mountPath: /home/dynamodblocal/data
      volumes:
        - name: jackson-dynamodb-data
          emptyDir: {}
