Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

4.2 KB
Raw Blame
{{- if gt (int .Values.replicaCount) 1 }}
{{- fail "replicaCount must be 1. OpenViking uses RocksDB which does not support concurrent access from multiple pods sharing the same PVC." }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "openviking.fullname" . }}
  labels:
    {{- include "openviking.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "openviking.selectorLabels" . | nindent 6 }}
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
        {{- with .Values.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        {{- include "openviking.labels" . | nindent 8 }}
        {{- with .Values.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- if or .Values.serviceAccount.create .Values.serviceAccount.name }}
      serviceAccountName: {{ include "openviking.serviceAccountName" . }}
      {{- end }}
      {{- with .Values.podSecurityContext }}
      securityContext:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
        - name: {{ .Chart.Name }}
          {{- with .Values.securityContext }}
          securityContext:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          image: {{ include "openviking.image" . | quote }}
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
            {{- if and .Values.gateway.enabled .Values.gateway.existingSecret }}
            - name: OPENVIKING_GATEWAY_MANAGEMENT_KEY
              valueFrom:
                secretKeyRef:
                  name: {{ .Values.gateway.existingSecret }}
                  key: management-key
                  optional: true
            - name: OPENVIKING_GATEWAY_ENCRYPTION_KEY
              valueFrom:
                secretKeyRef:
                  name: {{ .Values.gateway.existingSecret }}
                  key: encryption-key
                  optional: true
            {{- end }}
            - name: OPENVIKING_CONFIG_FILE
              value: {{ printf "%s/ov.conf" .Values.persistence.mountPath | quote }}
            - name: OPENVIKING_CLI_CONFIG_FILE
              value: {{ printf "%s/ovcli.conf" .Values.persistence.mountPath | quote }}
            - name: OPENVIKING_WITH_BOT
              value: {{ ternary "1" "0" .Values.bot.enabled | quote }}
            {{- with .Values.extraEnv }}
            {{- toYaml . | nindent 12 }}
            {{- end }}
          ports:
            - name: http
              containerPort: {{ .Values.config.server.port | default 1933 }}
              protocol: TCP
          {{- with .Values.livenessProbe }}
          livenessProbe:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          {{- with .Values.readinessProbe }}
          readinessProbe:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          {{- with .Values.resources }}
          resources:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          volumeMounts:
            - name: data
              mountPath: {{ .Values.persistence.mountPath }}
            - name: config
              mountPath: {{ printf "%s/ov.conf" .Values.persistence.mountPath | quote }}
              subPath: ov.conf
              readOnly: true
      volumes:
        - name: config
          configMap:
            name: {{ include "openviking.fullname" . }}-config
        - name: data
          {{- if .Values.persistence.enabled }}
          persistentVolumeClaim:
            claimName: {{ .Values.persistence.existingClaim | default (printf "%s-data" (include "openviking.fullname" .)) }}
          {{- else }}
          emptyDir: {}
          {{- end }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}