apiVersion: v1
kind: ConfigMap
metadata:
  name: happa-configmap
  namespace: giantswarm
  labels:
    app: happa
data:
  config.yaml: |
    passage-endpoint: {{ .Values.passage.address }}
    api-endpoint: {{ .Values.api.address }}
    mapi-endpoint: {{ .Values.happaapi.address }}
    audience: {{ .Values.api.address }}
    athena-endpoint: {{ .Values.athena.address }}
    mapi-audience: {{ .Values.oidc.issuerAddress }}
    ingress-base-domain: {{ .Values.guestCluster.base }}
    installation-name: {{ .Values.managementCluster.name }}
    {{- if eq .Values.managementCluster.provider.kind "aws" }}
    aws-capabilities-json: '{{ .Values.aws.instance.capabilities | toJson }}'
    {{- end }}
    {{- if eq .Values.managementCluster.provider.kind "azure" }}
    azure-capabilities-json: '{{ .Values.azure.vm.vmSize.capabilities | toJson }}'
    {{- end }}
    default-request-timeout-seconds: 10
    provider: {{ .Values.managementCluster.provider.kind }}
    mapi-auth-redirect-url: {{ .Values.happa.address }}
    mapi-auth-admin-group: {{ .Values.kubernetes.auth.controlPlaneAdminTargetGroup }}
    sentry-dsn: https://e2d0c60518114bf1b920f3cac4ee3f26@o346224.ingest.sentry.io/5739870
    sentry-environment: {{ .Values.managementCluster.name }}
    sentry-release-version: {{ .Values.image.tag }}
    sentry-debug: false
    sentry-sample-rate: 0.5

    # Enables real user monitoring (RUM)
    enable-rum: true

    # Feature flags
    feature-mapi-auth: {{ .Values.happa.featureFlags.mapiAuth }}
    feature-mapi-clusters: {{ .Values.happa.featureFlags.mapiClusters }}

    {{- if and (eq .Values.managementCluster.customer "giantswarm") (ne .Values.managementCluster.pipeline "testing") }}
    # Shared installations don't get the Monitoring feature
    feature-monitoring: false
    {{- else }}
    feature-monitoring: true
    {{- end }}

    info:
      general:
        provider: '{{ .Values.managementCluster.provider.kind }}'
        installationName: '{{ .Values.managementCluster.name }}'
        availabilityZones:
          default: 1
          {{- if eq .Values.managementCluster.provider.kind "aws" }}
          zones: '{{ .Values.aws.availabilityZones | join " " }}'
          {{- else if eq .Values.managementCluster.provider.kind "azure" }}
          zones: '{{ .Values.azure.availabilityZones | join " " }}'
          {{- end }}
        dataCenter: '{{ .Values.managementCluster.provider.region }}'
        kubernetesVersions: '{{ .Values.kubernetes.versions | toJson }}'
      workers:
        countPerCluster:
          default: 3
          max: 100
        instanceType:
          options: '{{ .Values.aws.instance.allowed | join " " }}'
          default: '{{ .Values.aws.instance.default }}'
        vmSize:
          options: '{{ .Values.azure.vm.vmSize.allowed | join " " }}'
          default: '{{ .Values.azure.vm.vmSize.default }}'
