apiVersion: v1
kind: ConfigMap

metadata:
  name: swift-account-caretaker
  labels:
    system: openstack
    service: objectstore
    component: configuration

data:
  config.yaml: |
    {{- $caretaker := .Values.swift_account_caretaker }}
    common:
      os_auth_url: {{ $caretaker.auth_url }}
      os_user_domain_name: Default
      os_username: swift_caretaker
      os_password: { fromEnv: CARETAKER_PASSWORD }
      os_project_domain_name: cc3test
      os_project_name: swift_test
    verify:
      - cluster_name: cluster-3
        os_auth_url: {{ $caretaker.auth_url }}
        os_user_domain_name: Default
        os_username: swift_caretaker
        os_password: { fromEnv: CARETAKER_PASSWORD }
        os_project_domain_name: Default
        os_project_name: service
      {{- range $index, $config := $caretaker.additional_clusters }}
      - cluster_name: {{ $index }}
        os_auth_url: {{ $config.os_auth_url }}
        os_user_domain_name: {{ $config.os_user_domain_name }}
        os_username: {{ $config.os_username }}
        os_password:
          fromEnv: {{ $index | upper }}_PASSWORD
        os_project_domain_name: {{ $config.os_project_domain_name }}
        os_project_name: {{ $config.os_project_name }}
        scrape: {{ $config.scrape | default false }}
        {{- if $config.os_interface }}
        os_interface: {{ $config.os_interface }}
        {{- end }}
        insecure: {{ $config.insecure | default false }}
      {{- end }}
