kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: doris-cluster-fe
  namespace: zyly
  labels:
    app.kubernetes.io/component: doris-cluster-fe
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: doris-cluster-fe
  template:
    metadata:
      name: doris-cluster-fe
      labels:
        app.kubernetes.io/component: doris-cluster-fe
    spec:
      imagePullSecrets:
        - name: harborsecret
      volumes:
        - name: meta
          persistentVolumeClaim:
#            claimName: meta
            claimName: doris-fe-meta-pvc
        - name: log
          persistentVolumeClaim:
    #            claimName: meta
            claimName: doris-fe-log-pvc
        - name: podinfo
          downwardAPI:
            items:
              - path: labels
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.labels
              - path: annotations
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.annotations
            defaultMode: 420
        - name: doris-cluster-fe-conf
          configMap:
            name: doris-cluster-fe-conf
            defaultMode: 420
      containers:
        - name: doris-cluster-fe
          image: 'hncm-fc766f84.ecis.changsha-2.cmecloud.cn/cmii/doris.fe-amd64:2.1.6'
          command:
            - /opt/apache-doris/fe_entrypoint.sh
          args:
            - $(ENV_FE_ADDR)
          ports:
            - name: http-port
              containerPort: 8030
              protocol: TCP
            - name: rpc-port
              containerPort: 9020
              protocol: TCP
            - name: query-port
              containerPort: 9030
              protocol: TCP
            - name: edit-log-port
              containerPort: 9010
              protocol: TCP
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: POD_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.podIP
            - name: HOST_IP
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: status.hostIP
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
            - name: CONFIGMAP_MOUNT_PATH
              value: /etc/doris
            - name: USER
              value: root
            - name: DORIS_ROOT
              value: /opt/apache-doris
            - name: ENV_FE_ADDR
              value: doris-cluster-fe-service
            - name: FE_QUERY_PORT
              value: '9030'
            - name: ELECT_NUMBER
              value: '3'
          resources:
            limits:
              cpu: '2'
              memory: 2Gi
            requests:
              cpu: '1'
              memory: 1Gi
          volumeMounts:
            - name: podinfo
              mountPath: /etc/podinfo
            - name: log
              mountPath: /opt/apache-doris/fe/log
            - name: meta
              mountPath: /opt/apache-doris/fe/doris-meta
            - name: doris-cluster-fe-conf
              mountPath: /etc/doris
          livenessProbe:
            tcpSocket:
              port: 9030
            initialDelaySeconds: 80
            timeoutSeconds: 180
            periodSeconds: 5
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /api/health
              port: 8030
              scheme: HTTP
            timeoutSeconds: 1
            periodSeconds: 5
            successThreshold: 1
            failureThreshold: 3
          startupProbe:
            tcpSocket:
              port: 9030
            timeoutSeconds: 1
            periodSeconds: 5
            successThreshold: 1
            failureThreshold: 60
          lifecycle:
            preStop:
              exec:
                command:
                  - /opt/apache-doris/fe_prestop.sh
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: app.kubernetes.io/component
                      operator: In
                      values:
                        - doris-cluster-fe
                topologyKey: kubernetes.io/hostname
      schedulerName: default-scheduler
#  volumeClaimTemplates:
#    - kind: PersistentVolumeClaim
#      apiVersion: v1
#      metadata:
#        name: meta
#      spec:
#        accessModes:
#          - ReadWriteOnce
#        resources:
#          requests:
#            storage: 10G
#        storageClassName: hcms-efs-class
#        volumeMode: Filesystem
#    - kind: PersistentVolumeClaim
#      apiVersion: v1
#      metadata:
#        name: log
#      spec:
#        accessModes:
#          - ReadWriteOnce
#        resources:
#          requests:
#            storage: '10'
#        storageClassName: hcms-efs-class
#        volumeMode: Filesystem
  serviceName: doris-cluster-fe-internal
  podManagementPolicy: Parallel