Yylzhangahupdate file
9175c74a创建于 2025年10月10日历史提交
{{- if .Values.euler_copilot.rag.enabled -}}
---
apiVersion: v1
kind: Service
metadata:
  name: rag-service
  namespace: {{ .Release.Namespace }}
spec:
  type: {{ default "ClusterIP" .Values.euler_copilot.rag.service.type }}
  selector:
    app: rag
  ports:
    - name: rag
      port: 9988
      targetPort: 9988
      nodePort: {{ default nil .Values.euler_copilot.rag.service.nodePort }}
    - name: rag-sql
      port: 9015
      targetPort: 9015

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rag-deploy
  namespace: {{ .Release.Namespace }}
  labels:
    app: rag
spec:
  replicas: {{ default 1 .Values.globals.replicaCount }}
  selector:
    matchLabels:
      app: rag
  template:
    metadata:
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/rag/rag-config.yaml") . | sha256sum }}
      labels:
        app: rag
    spec:
      automountServiceAccountToken: false
      containers:
        - name: rag
          image: {{ .Values.euler_copilot.rag.image | default (printf "%s/neocopilot/data_chain_back_end:0.10.0-%s" (.Values.globals.imageRegistry | default "hub.oepkgs.net") (.Values.globals.arch | default "x86")) }}
          imagePullPolicy: {{ default "IfNotPresent" .Values.globals.imagePullPolicy }}
          ports:
            - containerPort: 9988
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /health_check
              port: 9988
              scheme: HTTP
            failureThreshold: 5
            initialDelaySeconds: 60
            periodSeconds: 90
          env:
            - name: TZ
              value: "Asia/Shanghai"
          volumeMounts:
            - mountPath: /rag-service/data_chain/common/.env
              name: rag-shared
              subPath: .env
            - mountPath: /rag-service/chat2db/common/.env
              name: rag-shared
              subPath: .env-sql
          resources:
            requests:
              cpu: 0.25
              memory: 512Mi
            limits:
              {{ toYaml .Values.euler_copilot.rag.resourceLimits | nindent 14 }}
      initContainers:
        - name: rag-copy-secret
          image: {{ .Values.euler_copilot.secretInject.image | default (printf "%s/neocopilot/secret_inject:dev-%s" (.Values.globals.imageRegistry | default "hub.oepkgs.net") (.Values.globals.arch | default "x86")) }}
          imagePullPolicy: {{ default "IfNotPresent" .Values.globals.imagePullPolicy }}
          command:
            - python3
            - ./main.py
            - --config
            - config.yaml
            - --copy
          volumeMounts:
            - mountPath: /config/.env
              name: rag-config-vl
              subPath: .env
            - mountPath: /config/.env-sql
              name: rag-config-vl
              subPath: .env-sql
            - mountPath: /app/config.yaml
              name: rag-config-vl
              subPath: copy-config.yaml
            - mountPath: /config-rw
              name: rag-shared
            - mountPath: /db-secrets
              name: database-secret
            - mountPath: /system-secrets
              name: system-secret
      volumes:
        - name: rag-config-vl
          configMap:
            name: rag-config
        - name: database-secret
          secret:
            secretName: euler-copilot-database
        - name: system-secret
          secret:
            secretName: euler-copilot-system
        - name: rag-shared
          emptyDir:
            medium: Memory
{{- end -}}