# doris-fe-app.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: doris-fe-app
  namespace: uavcloud-devflight
spec:
  replicas: 1
  selector:
    matchLabels:
      app: doris-fe-app
  template:
    metadata:
      labels:
        app: doris-fe-app
    spec:
      imagePullSecrets:
        - name: harborsecret
      containers:
        - name: doris-fe-app
          image: harbor.cdcyy.com.cn/cmii/doris.fe-amd64:2.1.6
          env:
            - name: FE_SERVERS
              value: "fe1:doris-fe-service:9010"  # 使用Service名称进行服务发现
            - name: FE_ID
              value: "1"
          ports:
            - containerPort: 8030
            - containerPort: 9030
            - containerPort: 9010  # 添加内部通信端口
          volumeMounts:
            - name: fe-meta
              mountPath: /opt/apache-doris/fe/doris-meta
            - name: fe-log
              mountPath: /opt/apache-doris/fe/log
          resources:
            limits:
              memory: 2Gi
              cpu: "2"
            requests:
              memory: 2Gi
              cpu: "1"
      volumes:
        - name: fe-meta
          persistentVolumeClaim:
            claimName: doris-fe-meta-pvc
        - name: fe-log
          persistentVolumeClaim:
            claimName: doris-fe-log-pvc

---
# doris-fe-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: doris-fe-service
  namespace: uavcloud-devflight
spec:
  selector:
    app: doris-fe-app
  ports:
    - name: http
      port: 8030
      targetPort: 8030
    - name: query
      port: 9030
      targetPort: 9030
    - name: edit
      port: 9010  # 暴露FE内部通信端口
      targetPort: 9010

---
# doris-be-app.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: doris-be-app
  namespace: uavcloud-devflight
spec:
  replicas: 1
  selector:
    matchLabels:
      app: doris-be-app
  template:
    metadata:
      labels:
        app: doris-be-app
    spec:
      imagePullSecrets:
        - name: harborsecret
#      initContainers:
#        - name: wait-for-fe
#          image: harbor.cdcyy.com.cn/cmii/busybox:latest
#          command: ['sh', '-c', 'until nc -z doris-fe-service 9010; do echo waiting for fe; sleep 2; done;']
#          resources:
#            limits:
#              memory: 2Gi
#              cpu: "2"
#            requests:
#              memory: 200Mi
#              cpu: 200m
      containers:
        - name: doris-be-app
          image: harbor.cdcyy.com.cn/cmii/doris.be-amd64:2.1.6
          env:
            - name: FE_SERVERS
              value: "fe1:doris-fe-service:9010"
            - name: BE_ADDR
              value: "doris-be-service:9050"  # 使用Service名称
          ports:
            - containerPort: 8040
            - containerPort: 9050  # 添加BE通信端口
          volumeMounts:
            - name: doris-be-storage
              mountPath: /opt/apache-doris/be/storage
            - name: doris-be-log
              mountPath: /opt/apache-doris/be/log
          resources:
            limits:
              memory: 2Gi
              cpu: "2"
            requests:
              memory: 2Gi
              cpu: "1"
      volumes:
        - name: doris-be-storage
          persistentVolumeClaim:
            claimName: doris-be-storage-pvc
        - name: doris-be-log
          persistentVolumeClaim:
            claimName: doris-be-log-pvc

---
# doris-be-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: doris-be-service
  namespace: uavcloud-devflight
spec:
  selector:
    app: doris-be-app
  ports:
    - name: http
      port: 8040
      targetPort: 8040
    - name: be-port
      port: 9050  # 暴露BE通信端口
      targetPort: 9050


