# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Secret
metadata:
  name: dynamo-deployment-env
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "dynamo-operator.labels" . | nindent 4 }}
type: Opaque
stringData:
  YATAI_ENDPOINT: {{ .Values.dynamo.yatai.endpoint | quote }}
  YATAI_CLUSTER_NAME: {{ .Values.dynamo.yatai.clusterName | quote }}
  YATAI_SYSTEM_NAMESPACE: {{ default .Release.Namespace .Values.dynamo.yataiSystem.namespace }}
  YATAI_DEPLOYMENT_NAMESPACE: {{ .Release.Namespace }}
  YATAI_IMAGE_BUILDER_NAMESPACE: {{ .Release.Namespace }}

  YATAI_API_TOKEN: {{ include "dynamo-operator.yataiApiToken" . | quote }}

  INTERNAL_IMAGES_METRICS_TRANSFORMER: {{ .Values.dynamo.internalImages.metricsTransformer | quote }}
  INTERNAL_IMAGES_DEBUGGER: {{ .Values.dynamo.internalImages.debugger | quote }}
  INTERNAL_IMAGES_MONITOR_EXPORTER: {{ .Values.dynamo.internalImages.monitorExporter | quote }}
  INTERNAL_IMAGES_PROXY: {{ .Values.dynamo.internalImages.proxy | quote }}

  {{- if .Values.dynamo.disableAutomateBentoImageBuilder }}
  DISABLE_AUTOMATE_BENTO_IMAGE_BUILDER: "true"
  {{- end }}

  {{- if .Values.dynamo.enableRestrictedSecurityContext }}
  ENABLE_RESTRICTED_SECURITY_CONTEXT: "true"
  {{- end }}

  {{- if .Values.dynamo.dynamoIngressSuffix }}
  DYNAMO_INGRESS_SUFFIX: {{ .Values.dynamo.dynamoIngressSuffix | quote }}
  {{- end }}

  DOCKER_REGISTRY_SERVER: {{ .Values.dynamo.dockerRegistry.server | quote }}
  DOCKER_REGISTRY_IN_CLUSTER_SERVER: {{ .Values.dynamo.dockerRegistry.inClusterServer | quote }}
  {{- with include "dynamo-operator.extractDockerCredentials" . | fromYaml }}
  DOCKER_REGISTRY_USERNAME: {{ .username | quote }}
  DOCKER_REGISTRY_PASSWORD: {{ .password | quote }}
  {{- end }}
  DOCKER_REGISTRY_SECURE: {{ .Values.dynamo.dockerRegistry.secure | quote }}
  DOCKER_REGISTRY_BENTO_REPOSITORY_NAME: {{ .Values.dynamo.dockerRegistry.bentoRepositoryName | quote }}

  INTERNAL_IMAGES_BENTO_DOWNLOADER: {{ .Values.dynamo.internalImages.bentoDownloader | quote }}
  INTERNAL_IMAGES_KANIKO: {{ .Values.dynamo.internalImages.kaniko | quote }}
  INTERNAL_IMAGES_BUILDKIT: {{ .Values.dynamo.internalImages.buildkit | quote }}
  INTERNAL_IMAGES_BUILDKIT_ROOTLESS: {{ .Values.dynamo.internalImages.buildkitRootless | quote }}
  BUILDKIT_URL: tcp://{{ include "dynamo-operator.fullname" . }}-buildkitd:1234

  BENTO_IMAGE_BUILD_ENGINE: {{ .Values.dynamo.bentoImageBuildEngine | quote }}

  DISABLE_YATAI_COMPONENT_REGISTRATION: {{ .Values.dynamo.disableYataiComponentRegistration | quote }}

  ADD_NAMESPACE_PREFIX_TO_IMAGE_NAME: {{ .Values.dynamo.addNamespacePrefixToImageName | quote }}

  ESTARGZ_ENABLED: {{ .Values.dynamo.estargz.enabled | quote }}

  KANIKO_CACHE_REPO: {{ .Values.dynamo.kaniko.cacheRepo | quote }}
  KANIKO_SNAPSHOT_MODE: {{ .Values.dynamo.kaniko.snapshotMode | quote }}