{{- if .Values.apiService.create -}}
{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) }}
apiVersion: apiregistration.k8s.io/v1beta1
{{- else }}
apiVersion: apiregistration.k8s.io/v1
{{- end }}
kind: APIService
metadata:
  name: v1beta1.metrics.k8s.io
  labels: {{- include "common.labels.standard" . | nindent 4 }}
  {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
spec:
  service:
    name: {{ template "common.names.fullname" . }}
    namespace: {{ .Release.Namespace }}
  group: metrics.k8s.io
  version: v1beta1
  insecureSkipTLSVerify: {{ .Values.apiService.insecureSkipTLSVerify | default true }}
  {{- if .Values.apiService.caBundle }}
  caBundle: {{ .Values.apiService.caBundle }}
  {{- end }}
  groupPriorityMinimum: 100
  versionPriority: 100
{{- end -}}
