---
apiVersion: v1
data:
  config: |-
    apiVersion: v1
    clusters:
    - cluster:
        {% if service_account_token %}
        certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        server: https://kubernetes.default.svc
        {% else %}
        insecure-skip-tls-verify: true
        server: {{ https_server_address }}
        {% endif %}
      name: {{ source_cluster_id }}
    contexts:
    - context:
        cluster: {{ source_cluster_id }}
        user: {{ username }}
        namespace: default
      name: {{ source_cluster_id }}
    current-context: {{ source_cluster_id }}
    kind: Config
    users:
    - name: {{ username }}
      user:
        {% if service_account_token %}
        token: {{ service_account_token }}
        {% else %}
        token: {{ user_token }}
        {% endif %}
kind: ConfigMap
metadata:
  name: kube-config-{{ source_cluster_id | lower }}-u{{ username_slug }}