{{- if .Values.api.awsIamAuth.enabled }}
apiVersion: v1
kind: Config
clusters:
- cluster:
    server: https://{{ .Values.api.endpoint }}
  name: {{ .Values.global.clusterName }}
contexts:
- context:
    cluster: {{ .Values.global.clusterName }}
    user: kubernetes-admin
  name: kubernetes-admin@{{ .Values.global.clusterName }}
current-context: kubernetes-admin@{{ .Values.global.clusterName }}
preferences: {}
users:
- name: kubernetes-admin
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      command: aws-iam-authenticator
      args:
        - "token"
        - "-i"
        - "{{ .Values.global.clusterName }}"
        - "-r"
        - "{{ .Values.api.awsIamAuth.kubeAdminRole }}"
{{- end }}