apiVersion: apps/v1
kind: Deployment
metadata:
  name: datagate
  namespace: imxc
  labels:
    app: datagate
spec:
  selector:
    matchLabels:
      app: datagate
  replicas: 2
  template:
    metadata:
      labels:
        app: datagate
    spec:
      containers:
        - image: {{ .Values.global.IMXC_IN_REGISTRY }}/datagate:{{ .Values.global.DATAGATE_VERSION }}
          imagePullPolicy: IfNotPresent
          name: datagate
          ports:
            - containerPort: 50051
              protocol: TCP
            - containerPort: 14268
              protocol: TCP
            - containerPort: 14269
              protocol: TCP
          readinessProbe:
            httpGet:
              path: "/"
              port: 14269
          env:
            - name: REDIS_ADDR
              value: redis-master:6379
            - name: REDIS_PW
              value: dkagh1234!
            - name: REDIS_DB
              value: "0"
            - name: REDIS_TYPE
              value: normal
            - name: STORAGE_TYPE
              value: kafka
            - name: KAFKA_PRODUCER_BROKERS
              value: kafka-broker:9094
            - name: LOG_LEVEL
              value: "INFO"
          resources:
            requests:
              cpu: "100m"
              memory: "100Mi"
            limits:
              cpu: "2000m"
              memory: "1Gi"
---
apiVersion: v1
kind: Service
metadata:
  name: datagate
  namespace: imxc
  labels:
    app: datagate
spec:
  ports:
    - name: datagate-grpc
      port: 50051
      protocol: TCP
      targetPort: 50051
      nodePort: 30051
    - name: datagate-http
      port: 14268
      targetPort: 14268
#      nodePort: 31268
    - name: datagate-readiness
      port: 14269
      targetPort: 14269
  selector:
    app: datagate
  type: NodePort
