apiVersion: apps/v1
kind: Deployment
metadata:
  name: bdatgeo-rest-api
  namespace: bigdata-at-geo
spec:
  selector:
    matchLabels:
      app: bdatgeo-rest-api
  template:
    metadata:
      labels:
        app: bdatgeo-rest-api
    spec:
      priorityClassName: infrastructure
      containers:
#      - image: gitlab2.informatik.uni-wuerzburg.de:4567/dmir/bigdata-at-geo/bdatgeo-rest-api:3.1.2
      - image: gitlab2.informatik.uni-wuerzburg.de:4567/dmir/bigdata-at-geo/bdatgeo-rest-api:3.2.1
        name: bdatgeo-rest-api
        imagePullPolicy: Always
        env:
          # - name: PYTHONUTF8
          #   value: "1"
          - name: BDATG_REST_API_PATH
            value: /data
          - name: FIELD_CLIMATE_PUBLIC_KEY
            valueFrom:
              secretKeyRef:
                name: fieldclimate-keys
                key: PUBLICKEY
          - name: FIELD_CLIMATE_PRIVATE_KEY
            valueFrom:
              secretKeyRef:
                name: fieldclimate-keys
                key: PRIVATEKEY
          - name: CHAT_USERNAME
            valueFrom:
              secretKeyRef:
                name: chat-secret
                key: CHAT_USERNAME
          - name: CHAT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: chat-secret
                key: CHAT_PASSWORD
        command: [ "sh", "-c", "./run.sh" ]
        resources:
          requests:
            memory: "6Gi"
            cpu: "1"
          limits:
            memory: "10Gi"
            cpu: "1"
        ports:
        - containerPort: 5000
          name: api-port
        volumeMounts:
          - mountPath: /data
            name: data
        readinessProbe:
          httpGet:
            path: /index
            port: api-port
          initialDelaySeconds: 5
          periodSeconds: 5
      volumes:
        - name: data
          cephfs:
            monitors:
              - 132.187.14.16,132.187.14.17,132.187.14.19,132.187.14.20
            user: bigdata_at_geo
            path: "/bigdata_at_geo/data"
            secretRef:
              name: bigdata-at-geo-ceph-secret
      securityContext:
        runAsUser: 1000
        fsGroup: 1000
      imagePullSecrets:
        - name: gitlab-registry
