apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: simdg
  name: simdg
  namespace: simdg
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  selector:
    matchLabels:
      app: simdg
  template:
    metadata:
      labels:
        app: simdg
    spec:
      containers:
        - image: trendev/simdg
          imagePullPolicy: Always
          name: simdg
          ports:
            - containerPort: 8080
          env:
            - name: MY_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: MY_POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: RECORDS_MAX_SIZE
              value: "20"
            - name: CLUSTERED_OBJECT_TYPE
            # different options :
            # - hazelcast-replicated-map
            # - clustered-singleton
            # - hazelcast-distributed-map 
              value: clustered-singleton
          args:
            - "--clustermode"
            - "kubernetes:$(MY_POD_NAMESPACE),simdg"
            - "--group"
            - "ig_$(MY_POD_NAMESPACE)" 
            - "--clustername" 
            - "dg_$(MY_POD_NAMESPACE)"
            - "--deploymentDir"
            - "/opt/payara/deployments"
          livenessProbe:
            httpGet:
              path: /health/live
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 3
          readinessProbe:
            httpGet:
              path: /health/ready
              port: 8080
            initialDelaySeconds: 20
            periodSeconds: 2
            failureThreshold: 30
          # version 1.16 - alpha
          # startupProbe:
          #   httpGet:
          #     path: /health/live
          #     port: 8080
          #   failureThreshold: 12
          #   periodSeconds: 5
          #   initialDelaySeconds: 20
          resources: {}
