# Default values for artifactory-federation.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
  ## Docker image registry, default: releases-docker.jfrog.io
  imageRegistry: ""
  ## Optionally specify an array of imagePullSecrets.
  ## Secrets must be manually created in the namespace.
  ## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
  ## Example:
  ## imagePullSecrets:
  ##   - myRegistryKeySecretName
  imagePullSecrets: []

  # jfrogUrl: ""

  ## artifactory-federation requires a unique master key.
  ## You can generate one with the command: "openssl rand -hex 32"
  ## An initial one is auto generated on first startup.
  # masterKey: ""

  ## Alternatively, you can use a pre-existing secret with a key
  ## called "master-key" by specifying "masterKeySecretName"
  # masterKeySecretName: ""

  ## Join Key to connect other services to Artifactory
  ## IMPORTANT: Setting this value overrides the existing joinKey
  # joinKey: ""

  ## Alternatively, you can use a pre-existing secret with a key
  ## called "join-key" by specifying "joinKeySecretName"
  # joinKeySecretName: ""

image:
  registry: releases-docker.jfrog.io
  repository: jfrog/artifactory-federation
  pullPolicy: IfNotPresent
  tag: ""


jfrogUrl: ""

## artifactory-federation requires a unique master key.
## You can generate one with the command: "openssl rand -hex 32"
## An initial one is auto generated on first startup.
# masterKey: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
## Alternatively, you can use a pre-existing secret with a key called master-key by specifying masterKeySecretName
# masterKeySecretName:

## Join Key to connect other services to Artifactory
## IMPORTANT: Setting this value overrides the existing joinKey
## IMPORTANT: You should NOT use the example joinKey for a production deployment!
# joinKey: "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
## Alternatively, you can use a pre-existing secret with a key called join-key by specifying joinKeySecretName
# joinKeySecretName:

replicaCount: 1

## Pod disruption budget configuration
##
pdb:
  ## @param pdb.create Enable PodDisruptionBudget resource creation
  ##
  create: false
  ## @param pdb.minAvailable Minimum number/percentage of pods that must stay available during voluntary disruptions
  ## NOTE: Do not set together with pdb.maxUnavailable
  ##
  minAvailable: ""
  ## @param pdb.maxUnavailable Maximum number/percentage of pods that may be unavailable during voluntary disruptions
  ## NOTE: Do not set together with pdb.minAvailable
  ##
  maxUnavailable: ""

## Autoscaling configuration
##

autoscaling:
  ## @param autoscaling.enabled Enable replica autoscaling settings
  ##
  enabled: false
  ## @param autoscaling.minReplicas Minimum replicas for the pod autoscaling
  ##
  minReplicas: 1
  ## @param autoscaling.maxReplicas Maximum replicas for the pod autoscaling
  ##
  maxReplicas: 11
  ## @param autoscaling.targetCPU Percentage of CPU to consider when autoscaling
  ##
  targetCPU: ""
  ## @param autoscaling.targetMemory Percentage of Memory to consider when autoscaling
  ##
  targetMemory: ""


internalRestPort: 8025
apiContext: rtfs

database:
  type: "postgresql"
  driver: "org.postgresql.Driver"
  url: ""
  username: ""
  password: ""

persistence:
  mountPath: "/var/opt/jfrog/federation"
  federationProperties: {}
#  customFederationPropertiesConfig:

## @param federationProperties Configuration to be added to the config map, overriding Spring configuration.
## @param customFederationPropertiesConfig Specifies the name of a custom configMap to use instead of the default one.
## The name of the custom configMap will be initialized from the value of customFederationPropertiesConfig.

## @param extraEnvironmentVariables that can be used to tune PDN Server to your needs.
## Example:
## extraEnvironmentVariables:
##   - name: MY_ENV_VAR
##     value: ""
extraEnvironmentVariables: []
javaOpts: ""

systemYaml: |
  router:
    serviceRegistry:
      insecure: {{ .Values.router.serviceRegistry.insecure }}
  rtfs:
    database:
      type: {{ .Values.database.type }}
      driver: {{ .Values.database.driver }}

service:
  type: ClusterIP
  restPort: 8025
  grpcPort: 8026

  ## @param service.loadBalancerSourceRanges Address(es) that are allowed when service is `LoadBalancer`
  ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
  ## e.g:
  ## loadBalancerSourceRanges:
  ## - 10.10.10.0/24
  ##
  loadBalancerSourceRanges: []

  ## @param service.externalIPs Set the ExternalIPs
  ##
  externalIPs: []

  ## @param service.externalTrafficPolicy Enable client source IP preservation
  ## ref https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
  ##
  externalTrafficPolicy: Cluster

  ## @param service.loadBalancerIP Set the LoadBalancerIP
  ##
  loadBalancerIP: ""

  ## @param service.labels Service labels. Evaluated as a template
  labels: {}

  ## @param service.annotations Service annotations. Evaluated as a template
  ## Example:
  ## annotations:
  ##   service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
  annotations: {}


## @param podLabels topology Pod labels. Evaluated as a template
## Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
##
podLabels: {}

## @param commonAnnotations Annotations to add to all deployed objects
##
commonAnnotations: {}

## @param deploymentLabels topology deployment labels. Evaluated as a template
## Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
##
deploymentLabels: {}

livenessProbe:
  enabled: true
  config: |
    exec:
      command:
        - sh
        - -c
        - curl -s -k --fail --max-time {{ .Values.probes.timeoutSeconds }} http://localhost:{{ .Values.internalRestPort }}/{{ .Values.apiContext }}/api/v1/system/liveness
    initialDelaySeconds: {{ if semverCompare "<v1.20.0-0" .Capabilities.KubeVersion.Version }}30{{ else }}0{{ end }}
    periodSeconds: 10
    timeoutSeconds: {{ .Values.probes.timeoutSeconds }}
    failureThreshold: 5
    successThreshold: 1

startupProbe:
  enabled: true
  config: |
    exec:
      command:
        - sh
        - -c
        - curl -s -k --fail --max-time {{ .Values.probes.timeoutSeconds }} http://localhost:{{ .Values.internalRestPort }}/{{ .Values.apiContext }}/api/v1/system/readiness
    initialDelaySeconds: 5
    periodSeconds: 5
    timeoutSeconds: {{ .Values.probes.timeoutSeconds }}
    failureThreshold: 30
    successThreshold: 1

resources: {}
    # We usually recommend not to specify default resources and to leave this as a conscious
    # choice for the user. This also increases chances charts run on environments with little
    # resources, such as Minikube. If you do want to specify resources, uncomment the following
    # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
    # limits:
    #   cpu: 100m
    #   memory: 128Mi
    # requests:
    #   cpu: 100m
    #   memory: 128Mi

## @param extraVolumeMounts Optionally specify extra list of additional volumeMounts
## Examples:
## extraVolumeMounts:
##   - name: extras
##     mountPath: /usr/share/extras
##     readOnly: true
##
extraVolumeMounts: []

# Add lifecycle hooks for observability container
lifecycle: {}
  # postStart:
  #   exec:
  #     command: ["/bin/sh", "-c", "echo Hello from the postStart handler"]
  # preStop:
#   exec:
#     command: ["/bin/sh","-c","echo Hello from the preStop handler"]

imagePullSecrets: []

fullnameOverride: ""

# not required/relevant when working with ServiceMonitor (leaving for potential other future usage, OnPrem limitations?)
# podAnnotations: |
#   prometheus.io/scrape: "true"
#   prometheus.io/path: "/{{ .Values.apiContext }}/api/v1/metrics"
#   prometheus.io/port: "{{ .Values.service.restPort }}"

podSecurityContext:
  enabled: true
  runAsNonRoot: true
  runAsUser: 1030
  runAsGroup: 1030
  fsGroup: 1030

containerSecurityContext:
  enabled: true
  runAsNonRoot: true
  allowPrivilegeEscalation: false
  seccompProfile:
    type: RuntimeDefault
  capabilities:
    drop:
      - ALL


initContainers:
  image:
    registry: releases-docker.jfrog.io
    repository: ubi9/ubi-minimal
    tag: 9.7.1777857961
    pullPolicy: IfNotPresent

  resources: {}


## Router
router:
  name: router
  image:
    registry: releases-docker.jfrog.io
    repository: jfrog/router
    tag: 7.320.13
    imagePullPolicy: IfNotPresent
  serviceRegistry:
    ## Service registry (Access) TLS verification skipped if enabled
    insecure: false
  internalPort: 8046
  externalPort: 8082
  tlsEnabled: false
  resources: {}
  #  requests:
  #    memory: "100Mi"
  #    cpu: "100m"
  #  limits:
  #    memory: "1Gi"
  #    cpu: "1"

  ## @param router.extraEnvironmentVariables that can be used to tune router to your needs.
  ## Example:
  ## extraEnvironmentVariables:
  ##   - name: MY_ENV_VAR
  ##     value: ""
  extraEnvironmentVariables: []

  extraVolumeMounts: []

  ## To use newProbes set .Values.newProbes to true
  livenessProbe:
    enabled: true
    config: |
      httpGet:
        path: /router/api/v1/system/liveness
        port: {{ .Values.router.externalPort }}
        scheme: {{ include "rtfs.scheme" . | upper }}
      initialDelaySeconds: {{ if semverCompare "<v1.20.0-0" .Capabilities.KubeVersion.Version }}30{{ else }}0{{ end }}
      periodSeconds: 10
      timeoutSeconds: {{ .Values.probes.timeoutSeconds }}
      failureThreshold: 5
      successThreshold: 1

  readinessProbe:
    enabled: true
    config: |
      httpGet:
        path: /router/api/v1/system/readiness
        port: {{ .Values.router.externalPort }}
        scheme: {{ include "rtfs.scheme" . | upper}}
      initialDelaySeconds: {{ if semverCompare "<v1.20.0-0" .Capabilities.KubeVersion.Version }}30{{ else }}0{{ end }}
      periodSeconds: 10
      timeoutSeconds: {{ .Values.probes.timeoutSeconds }}
      failureThreshold: 5
      successThreshold: 1

  # Add lifecycle hooks for observability container
  lifecycle: {}
    # postStart:
    #   exec:
    #     command: ["/bin/sh", "-c", "echo Hello from the postStart handler"]
    # preStop:
    #   exec:
  #     command: ["/bin/sh","-c","echo Hello from the preStop handler"]

  persistence:
    mountPath: "/var/opt/jfrog/router"

## @section observability image parameters
## @param observability.image.registry observability image registry
## @param observability.image.repository observability image repository
## @param observability.image.tag observability image tag (immutable tags are recommended)
## @param observability.image.pullPolicy observability image pull policy
## @param observability.image.pullSecrets Specify docker-registry secret names as an array
## @param observability.image.debug Set to true if you would like to see extra information on logs
##
observability:
  enabled: false
  image:
    registry: releases-docker.jfrog.io
    repository: jfrog/observability
    tag: 2.37.0

    ## Specify a imagePullPolicy
    ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
    ## ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images
    ##
    pullPolicy: IfNotPresent

  ## @param observability.extraVolumeMounts Optionally specify extra list of additional volumeMounts
  ## Examples:
  ## extraVolumeMounts:
  ##   - name: extras
  ##     mountPath: /usr/share/extras
  ##     readOnly: true
  ##
  extraVolumeMounts: []

  ## @param observability.extraEnvironmentVariables that can be used to tune observability to your needs.
  ## Example:
  ## extraEnvironmentVariables:
  ##   - name: MY_ENV_VAR
  ##     value: ""
  extraEnvironmentVariables: []

  ## observability containers' resource requests and limits
  ## ref: https://kubernetes.io/docs/user-guide/compute-resources/
  ## We usually recommend not to specify default resources and to leave this as a conscious
  ## choice for the user. This also increases chances charts run on environments with little
  ## resources, such as Minikube. If you do want to specify resources, uncomment the following
  ## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  ## @param observability.resources.limits The resources limits for observability containers
  ## @param observability.resources.requests The requested resources for observability containers
  ##
  resources: {}
    ## Example:
    ## limits:
    ##    cpu: 1000m
    ##    memory: 2Gi
    ##
    ## Examples:
    ## requests:
    ##    cpu: 1000m
    ##    memory: 2Gi
  ##
  # Add lifecycle hooks for observability container
  lifecycle: {}
    # postStart:
    #   exec:
    #     command: ["/bin/sh", "-c", "echo Hello from the postStart handler"]
    # preStop:
    #   exec:
  #     command: ["/bin/sh","-c","echo Hello from the preStop handler"]
  internalPort: 8036

  ## The following settings are to configure the frequency of the liveness and startup probes
  livenessProbe:
    enabled: true
    config: |
      exec:
        command:
          - sh
          - -c
          - curl --fail --max-time {{ .Values.probes.timeoutSeconds }} http://localhost:{{ .Values.observability.internalPort }}/api/v1/system/liveness
      initialDelaySeconds: {{ if semverCompare "<v1.20.0-0" .Capabilities.KubeVersion.Version }}30{{ else }}0{{ end }}
      failureThreshold: 5
      timeoutSeconds: {{ .Values.probes.timeoutSeconds }}
      periodSeconds: 10
      successThreshold: 1

  startupProbe:
    enabled: true
    config: |
      exec:
        command:
          - sh
          - -c
          - curl --fail --max-time {{ .Values.probes.timeoutSeconds }} http://localhost:{{ .Values.observability.internalPort }}/api/v1/system/readiness
      initialDelaySeconds: 5
      failureThreshold: 30
      periodSeconds: 5
      timeoutSeconds: {{ .Values.probes.timeoutSeconds }}

  persistence:
    mountPath: "/var/opt/jfrog/observability"

nodeSelector: {}

tolerations: []

affinity: {}

## @param extraVolumes Optionally specify extra list of additional volumes .
## Example:
## extraVolumes:
##   - name: extras
##     emptyDir: {}
##
extraVolumes: []

probes:
  timeoutSeconds: 5

ingress:
  enabled: false

## @param serviceMonitor Declaratively specifies how groups of Kubernetes services should be monitored.
## Ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md
serviceMonitor:
  enabled: true
  # name: federation-be-metrics-service
  interval: 60s
  scrapeTimeout: 15s
  # TODO [elads] - federation-be-metrics ? (in case of future FE micro-frontend service)
  jobLabel: federation-metrics
  # port: http-distro
  bearerTokenFile: /etc/prometheus/secrets/kube-prom-services-store-token-gen/token
  kubePromApp: "federation"
  kubePromFullName: "federation"
  # region: "FILLED-BY-SAAS-VALUES"
