apiVersion: apps/v1
kind: Deployment
metadata:
  name: cmii-uav-gateway
  namespace: uavcloud-dev
  labels:
    cmii.type: backend
    cmii.app: cmii-uav-gateway
    octopus/control: backend-app-1.0.0
    app.kubernetes.io/managed-by: octopus/control
    app.kubernetes.io/app-version: 5.2.0
spec:
  replicas: 2
  strategy:
    rollingUpdate:
      maxUnavailable: 1
  selector:
    matchLabels:
      cmii.type: backend
      cmii.app: cmii-uav-gateway
  template:
    metadata:
      labels:
        cmii.type: backend
        cmii.app: cmii-uav-gateway
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: uavcloud.env
                    operator: In
                    values:
                      - demo
      imagePullSecrets:
        - name: harborsecret
      containers:
        - name: cmii-uav-gateway
          image: \"harbor.cdcyy.com.cn/cmii/cmii-uav-gateway:5.2.0-123\"
          imagePullPolicy: Always
          env:
            - name: K8S_NAMESPACE
              value: \"uavcloud-dev\"
            - name: APPLICATION_NAME
              value: \"cmii-uav-gateway\"
            - name: CUST_JAVA_OPTS
              value: \"-Xms500m -Xmx1500m -Dlog4j2.formatMsgNoLookups=true\"
            - name: NACOS_REGISTRY
              value: \"helm-nacos:8848\"
            - name: NACOS_DISCOVERY_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: NACOS_DISCOVERY_PORT
              value: \"8080\"
            - name: BIZ_CONFIG_GROUP
            - name: SYS_CONFIG_GROUP
            - name: IMAGE_VERSION
              value: 5.2.0
            - name: NACOS_USERNAME
              value: \"developer\"
            - name: NACOS_PASSWORD
              value: \"Deve@9128201\"
          ports:
            - name: pod-port
              containerPort: 8080
              protocol: TCP
          resources:
            limits:
              memory: 2Gi
              cpu: 2c
            requests:
              memory: 1Gi
              cpu: 200m
          livenessProbe:
            httpGet:
              path: /cmii/ping
              port: pod-port
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 5
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /cmii/ping
              port: pod-port
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 5
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 3
          startupProbe:
            httpGet:
              path: /cmii/ping
              port: pod-port
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 3
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 5
          volumeMounts:
            - name: glusterfs-backend-log-volume
              mountPath: /cmii/logs
              readOnly: false
              subPath: uavcloud-dev/cmii-uav-gateway
      volumes:
        - name: glusterfs-backend-log-volume
          persistentVolumeClaim:
            claimName: glusterfs-backend-log-pvc
