apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: azurite
  namespace: bytelyst-infra
  labels:
    app: azurite
spec:
  replicas: 1
  serviceName: azurite
  selector:
    matchLabels:
      app: azurite
  template:
    metadata:
      labels:
        app: azurite
    spec:
      containers:
      - name: azurite
        image: mcr.microsoft.com/azure-storage/azurite:latest
        command: ["azurite", "--blobHost", "0.0.0.0", "--queueHost", "0.0.0.0", "--tableHost", "0.0.0.0", "-l", "/data"]
        ports:
        - containerPort: 10000
          name: blob
        - containerPort: 10001
          name: queue
        - containerPort: 10002
          name: table
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          tcpSocket:
            port: 10000
          initialDelaySeconds: 5
          periodSeconds: 10
        volumeMounts:
        - name: azurite-data
          mountPath: /data
  volumeClaimTemplates:
  - metadata:
      name: azurite-data
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 5Gi
---
apiVersion: v1
kind: Service
metadata:
  name: azurite
  namespace: bytelyst-infra
spec:
  selector:
    app: azurite
  ports:
  - name: blob
    port: 10000
    targetPort: 10000
---
apiVersion: v1
kind: Service
metadata:
  name: azurite-external
  namespace: bytelyst-infra
spec:
  type: NodePort
  selector:
    app: azurite
  ports:
  - name: blob
    port: 10000
    targetPort: 10000
    nodePort: 10000
