apiVersion: apps.nvidia.com/v1alpha1
kind: NIMService
metadata:
  name: {{ .Values.nimService.name }}
  labels:
    {{- include "nim.labels" . | nindent 4 }}
spec:
  labels:
    {{- toYaml .Values.nimService.labels | nindent 4 }}
  image:
    repository: {{ .Values.image.repository }}
    tag: {{ .Values.image.tag | quote }}
    pullPolicy: {{ .Values.image.pullPolicy }}
    pullSecrets:
      {{- range .Values.imagePullSecrets }}
      - {{ .name }}
      {{- end }}
  authSecret: {{ if ne .Values.nimService.existingAuthSecret "" }}{{ .Values.nimService.existingAuthSecret }}{{ else }}{{ .Values.nimService.authSecret }}{{ end }}
  replicas: {{ .Values.nimService.replicas }}
  storage:
    {{- if ne .Values.nimService.existingPVC "" }}
    pvc:
      name: {{ .Values.nimService.existingPVC }}
    readOnly: {{ .Values.nimService.storage.readOnly }}
    {{- else }}
    pvc:
      create: true
      storageClass: {{ .Values.nimService.storage.pvc.storageClass }}
      size: {{ .Values.nimService.storage.pvc.size }}
      volumeAccessMode: {{ .Values.nimService.storage.pvc.volumeAccessMode }}
    {{- end }}
  runtimeClassName: {{ .Values.nimService.runtimeClassName }}
  {{- if .Values.nimService.env }}
  env:
    {{- toYaml .Values.nimService.env | nindent 4 }}
  {{- end }}
  resources:
    {{- toYaml .Values.nimService.resources | nindent 4 }}
  expose:
    service:
      type: {{ .Values.nimService.expose.service.type }}
      port: {{ .Values.nimService.expose.service.port }}