---
version: 1
kind: component

requires:
  - kubernetes
  - helm

parameters:

- name: ingress
  parameters:
  - name: protocol
    value: https
    env: INGRESS_PROTOCOL
  - name: class
    empty: allow
  - name: ssoUrlPrefix
    value: dex
  - name: hosts
    empty: allow

- name: kubernetes
  parameters:
  - name: namespace
    value: kube-ingress
    env: NAMESPACE

- name: dex
  parameters:
  - name: issuer
    value: ${ingress.protocol}://${ingress.hosts}
  - name: image.repo
    value: ghcr.io/dexidp/dex
  - name: image.tag
    value: v2.32.0

  - name: passwordDb
    empty: allow
    parameters:
    - name: email
    - name: password

  - name: connectors
    empty: allow
    parameters:
    - name: ldap
      empty: allow
      parameters:
      - name: host
      - name: dn
      - name: usernamePrompt
        value: Username
      - name: password
      - name: search.dn
      - name: search.usernameAttr
        value: uid
      - name: search.filter
        value: (objectClass=user)
      - name: search.idAttr
        value: uid
      - name: groupSearch.dn
        value: ${dex.connectors.ldap.search.dn}

    - name: okta
      empty: allow
      parameters:
      - name: issuer
      - name: clientId
      - name: clientSecret

- name: helm
  parameters:
  - name: repo
    value: https://charts.dexidp.io
    env: HELM_REPO
  - name: chart
    value: dex
    env: HELM_CHART
  - name: version
    value: 0.13.0
    env: HELM_CHART_VERSION

outputs:
  - name: dex.api.endpoint
    value: ${hub.componentName}.${kubernetes.namespace}.svc.cluster.local
  - name: dex.issuer

templates:
  extra:
  - kind: go
    files:
    - "*.gotemplate"
