apiVersion: v2.edp.epam.com/v1
kind: Jenkins
metadata:
  name: jenkins
  annotations:
    edp.epam.com/admin-token: jenkins-admin-token
  labels:
  {{- include "jenkins-operator.metaLabels" . | nindent 4 }}
spec:
  edpSpec:
    dnsWildcard: {{ .Values.dnsWildcard }}
  {{- if .Values.jenkins.basePath }}
  basePath: "{{ .Values.jenkins.basePath }}"
  {{- end }}
  sharedLibraries:
    {{- $rootJenkins := .Values.jenkins -}}
    {{- range $key, $value := $rootJenkins.sharedLibraries }}
    - name: {{ $key }}
      url: {{ tpl $value.url $ }}
      {{- if and (eq $key "edp-library-stages") ($rootJenkins.edp_library_stages_version) }}
      tag: {{ $rootJenkins.edp_library_stages_version }}
      {{- else if and (eq $key "edp-library-pipelines") ($rootJenkins.edp_library_pipelines_version) }}
      tag: {{ $rootJenkins.edp_library_pipelines_version }}
      {{- else }}
      tag: {{ $value.tag }}
      {{- end }}
      {{- if $value.secret }}
      secret: {{ $value.secret }}
      type: {{ $value.type }}
    {{- end }}
    {{- end }}
  keycloakSpec:
    enabled: {{ .Values.keycloakIntegration.enabled }}
    realm: {{ template "keycloak.realm" . }}
