# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
{{- if ne .Values.storage.type "pvc" }}
{{- fail (printf "snapshot.storage.type=%q is not supported yet; only pvc is currently implemented" .Values.storage.type) }}
{{- end }}
metadata:
  name: {{ include "snapshot.fullname" . }}-config
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "snapshot.labels" . | nindent 4 }}
data:
  config.yaml: |
    storage:
      type: {{ .Values.storage.type | quote }}
      {{- if eq .Values.storage.type "pvc" }}
      basePath: {{ .Values.storage.pvc.basePath | quote }}
      {{- end }}

    overlay:
      exclusions: {{ toYaml .Values.config.overlay.exclusions | nindent 8 }}

    restore:
      nsRestorePath: {{ .Values.config.restore.nsRestorePath | quote }}
      restoreReadyTimeoutSeconds: {{ .Values.config.restore.restoreReadyTimeoutSeconds }}

    criu:
      binaryPath: {{ .Values.config.criu.binaryPath | quote }}
      ghostLimit: {{ .Values.config.criu.ghostLimit }}
      logLevel: {{ .Values.config.criu.logLevel }}
      workDir: {{ .Values.config.criu.workDir | quote }}
      leaveRunning: {{ .Values.config.criu.leaveRunning }}
      shellJob: {{ .Values.config.criu.shellJob }}
      tcpClose: {{ .Values.config.criu.tcpClose }}
      tcpEstablished: {{ .Values.config.criu.tcpEstablished }}
      fileLocks: {{ .Values.config.criu.fileLocks }}
      orphanPtsMaster: {{ .Values.config.criu.orphanPtsMaster }}
      extUnixSk: {{ .Values.config.criu.extUnixSk }}
      linkRemap: {{ .Values.config.criu.linkRemap }}
      extMasters: {{ .Values.config.criu.extMasters }}
      manageCgroupsMode: {{ .Values.config.criu.manageCgroupsMode | quote }}
      rstSibling: {{ .Values.config.criu.rstSibling }}
      mntnsCompatMode: {{ .Values.config.criu.mntnsCompatMode }}
      evasiveDevices: {{ .Values.config.criu.evasiveDevices }}
      forceIrmap: {{ .Values.config.criu.forceIrmap }}
      autoDedup: {{ .Values.config.criu.autoDedup }}
      lazyPages: {{ .Values.config.criu.lazyPages }}
      libDir: {{ .Values.config.criu.libDir | quote }}
      allowUprobes: {{ .Values.config.criu.allowUprobes }}
      skipInFlight: {{ .Values.config.criu.skipInFlight }}
