{{- if .Values.kubeconfig.enabled -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "kube-state-metrics.fullname" . }}-kubeconfig
  namespace: {{ template "kube-state-metrics.namespace" . }}
  labels:
    app.kubernetes.io/name: {{ template "kube-state-metrics.name" . }}
    helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    app.kubernetes.io/instance: "{{ .Release.Name }}"
    app.kubernetes.io/managed-by: "{{ .Release.Service }}"
type: Opaque
data:
  config: '{{ .Values.kubeconfig.secret }}'
{{- end -}}
