Skip to content

A desktop coding agent with free access to frontier models.

TypeScript
5.9 KB
Raw Blame
{{- include "omnirush-ee.customCa.validate" . }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "omnirush-ee.denApiServiceName" . }}
  labels:
    {{- include "omnirush-ee.componentLabels" (dict "root" . "component" "den-api") | nindent 4 }}
  {{- with .Values.denApi.service.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: {{ .Values.denApi.service.type }}
  {{- with .Values.denApi.service.loadBalancerClass }}
  loadBalancerClass: {{ . | quote }}
  {{- end }}
  {{- with .Values.denApi.service.loadBalancerSourceRanges }}
  loadBalancerSourceRanges:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  ports:
    - name: http
      port: {{ .Values.denApi.service.port }}
      targetPort: http
  selector:
    {{- include "omnirush-ee.componentSelectorLabels" (dict "root" . "component" "den-api") | nindent 4 }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "omnirush-ee.fullname" . }}-den-api
  labels:
    {{- include "omnirush-ee.componentLabels" (dict "root" . "component" "den-api") | nindent 4 }}
spec:
  replicas: {{ .Values.denApi.replicaCount }}
  selector:
    matchLabels:
      {{- include "omnirush-ee.componentSelectorLabels" (dict "root" . "component" "den-api") | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "omnirush-ee.componentSelectorLabels" (dict "root" . "component" "den-api") | nindent 8 }}
        {{- with .Values.denApi.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
        checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
        {{- with .Values.denApi.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- if .Values.installerArtifacts.enabled }}
      {{- if and .Values.installerArtifacts.existingClaim .Values.installerArtifacts.hostPath }}
      {{- fail "installerArtifacts.existingClaim and installerArtifacts.hostPath are mutually exclusive" }}
      {{- end }}
      {{- if not (or .Values.installerArtifacts.existingClaim .Values.installerArtifacts.hostPath) }}
      {{- fail "installerArtifacts.existingClaim or installerArtifacts.hostPath is required when installerArtifacts.enabled=true" }}
      {{- end }}
      {{- end }}
      {{- if or .Values.installerArtifacts.enabled .Values.customCa.enabled }}
      volumes:
        {{- if .Values.installerArtifacts.enabled }}
        - name: installer-artifacts
          {{- if .Values.installerArtifacts.existingClaim }}
          persistentVolumeClaim:
            claimName: {{ .Values.installerArtifacts.existingClaim | quote }}
          {{- else }}
          hostPath:
            path: {{ .Values.installerArtifacts.hostPath | quote }}
            type: Directory
          {{- end }}
        {{- end }}
        {{- if .Values.customCa.enabled }}
        {{- include "omnirush-ee.customCa.volume" . | nindent 8 }}
        {{- end }}
      {{- end }}
      containers:
        - name: den-api
          image: "{{ .Values.denApi.image.repository }}:{{ default .Values.image.tag .Values.denApi.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: {{ .Values.denApi.containerPort }}
          {{- if or .Values.installerArtifacts.enabled .Values.customCa.enabled }}
          volumeMounts:
            {{- if .Values.installerArtifacts.enabled }}
            - name: installer-artifacts
              mountPath: {{ .Values.installerArtifacts.mountPath | quote }}
              readOnly: true
            {{- end }}
            {{- if .Values.customCa.enabled }}
            {{- include "omnirush-ee.customCa.volumeMount" . | nindent 12 }}
            {{- end }}
          {{- end }}
          envFrom:
            - configMapRef:
                name: {{ include "omnirush-ee.configName" . }}
            - secretRef:
                name: {{ include "omnirush-ee.secretName" . }}
          env:
            - name: PORT
              value: {{ .Values.denApi.containerPort | quote }}
            {{- if not (hasKey .Values.denApi.env "NODE_OPTIONS") }}
            # Keep this as a direct value so upgrades from legacy denApi.env.NODE_OPTIONS
            # do not leave both value and valueFrom in Kubernetes' strategic merge patch.
            - name: NODE_OPTIONS
              value: {{ .Values.config.denApiNodeOptions | quote }}
              # Explicitly clear the valueFrom emitted by chart 0.17.24 during upgrades.
              valueFrom: null
            {{- end }}
            {{- if .Values.installerArtifacts.enabled }}
            - name: OMNIRUSH_INSTALLER_ARTIFACTS_DIR
              value: {{ .Values.installerArtifacts.mountPath | quote }}
            {{- end }}
            {{- if .Values.customCa.enabled }}
            {{- include "omnirush-ee.customCa.env" . | nindent 12 }}
            {{- end }}
            {{- if eq (include "omnirush-ee.allowPrivateMcpUrls" .) "1" }}
            - name: DEN_ALLOW_PRIVATE_MCP_URLS
              value: "1"
            {{- end }}
            {{- include "omnirush-ee.observabilityEnv" (dict "root" . "serviceName" .Values.observability.serviceNames.denApi) | nindent 12 }}
            {{- range $key, $value := .Values.denApi.env }}
            - name: {{ $key }}
              value: {{ $value | quote }}
            {{- end }}
          livenessProbe:
            httpGet:
              path: /health
              port: http
            {{- toYaml .Values.denApi.probes.liveness | nindent 12 }}
          readinessProbe:
            httpGet:
              path: /ready
              port: http
            {{- toYaml .Values.denApi.probes.readiness | nindent 12 }}
          {{- with .Values.denApi.resources }}
          resources:
            {{- toYaml . | nindent 12 }}
          {{- end }}