---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cmii-uavms-node
  namespace: uavcloud-devoperation
  labels:
    cmii.type: backend
    cmii.app: cmii-uavms-node
    octopus/control: backend-app-1.0.0
    app.kubernetes.io/managed-by: octopus
    app.kubernetes.io/app-version: 6.1.0
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxUnavailable: 1
  selector:
    matchLabels:
      cmii.type: backend
      cmii.app: cmii-uavms-node
  template:
    metadata:
      labels:
        cmii.type: backend
        cmii.app: cmii-uavms-node
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: uavcloud.env
                    operator: In
                    values:
                      - devoperation
      imagePullSecrets:
        - name: harborsecret
      containers:
        - name: cmii-uavms-node
          image: harbor.cdcyy.com.cn/cmii/cmii-uavms-node:6.1.0
          imagePullPolicy: Always
          env:
            - name: K8S_NAMESPACE
              value: uavcloud-devoperation
            - name: APPLICATION_NAME
              value: cmii-uavms-node
            - name: CUST_JAVA_OPTS
              value: "-Xms200m -Xmx800m -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
              value: 6.1.0
            - name: SYS_CONFIG_GROUP
              value: 6.1.0
            - name: IMAGE_VERSION
              value: 6.1.0
            - name: NACOS_USERNAME
              value: "developer"
            - name: NACOS_PASSWORD
              value: "Deve@9128201"
          ports:
            - name: pod-port
              containerPort: 8080
              protocol: TCP
          resources:
            limits:
              memory: 1Gi
              cpu: "2"
            requests:
              memory: 200Mi
              cpu: 200m
          livenessProbe:
            httpGet:
              path: /cmii/health
              port: pod-port
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 5
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /cmii/health
              port: pod-port
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 5
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 3
          startupProbe:
            httpGet:
              path: /cmii/health
              port: pod-port
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 3
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 5
          volumeMounts:
            - name: nfs-backend-log-volume
              mountPath: /cmii/logs
              readOnly: false
              subPath: uavcloud-devoperation/cmii-uavms-node
      volumes:
        - name: nfs-backend-log-volume
          persistentVolumeClaim:
            claimName: nfs-backend-log-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: cmii-uavms-node
  namespace: uavcloud-devoperation
  labels:
    cmii.type: backend
    cmii.app: cmii-uavms-node
    octopus/control: backend-app-1.0.0
    app.kubernetes.io/managed-by: octopus
    app.kubernetes.io/app-version: 6.1.0
spec:
  type: ClusterIP
  selector:
    cmii.type: backend
    cmii.app: cmii-uavms-node
  ports:
    - name: backend-tcp
      port: 8080
      protocol: TCP
      targetPort: 8080
---