{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ printf "%s-envvars" (include "harbor.jobservice" .) }}
  namespace: {{ include "common.names.namespace" . | quote }}
  {{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.jobservice.image "chart" .Chart ) ) }}
  {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
  labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
    app.kubernetes.io/component: jobservice
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
data:
  CORE_URL: {{ include "harbor.core.url" . | quote }}
  TOKEN_SERVICE_URL: {{ include "harbor.tokenService.url" . | quote }}
  REGISTRY_URL: {{ include "harbor.registry.url" . | quote }}
  REGISTRY_CONTROLLER_URL: {{ include "harbor.registryCtl.url" . | quote }}
  REGISTRY_CREDENTIAL_USERNAME: {{ .Values.registry.credentials.username | quote }}
  {{- if has "jobservice" .Values.proxy.components }}
  HTTP_PROXY: {{ .Values.proxy.httpProxy | quote }}
  HTTPS_PROXY: {{ .Values.proxy.httpsProxy | quote }}
  NO_PROXY: {{ include "harbor.noProxy" . | quote }}
  {{- end }}
  LOG_LEVEL: {{ .Values.logLevel | quote }}
  {{- if .Values.metrics.enabled}}
  METRIC_NAMESPACE: harbor
  METRIC_SUBSYSTEM: jobservice
  {{- end }}
  {{- if .Values.tracing.enabled }}
  TRACE_SERVICE_NAME: "harbor-jobservice"
  {{- include "harbor.tracing.envvars" . | nindent 2}}
  {{- end }}
