{{- if and (not .Values.agent) (not .Values.cloudAgent) (.Values.kubecostDeployment) (.Values.kubecostDeployment.queryServiceReplicas) }} {{- if gt .Values.kubecostDeployment.queryServiceReplicas 0 }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: {{ template "query-service.serviceAccountName" . }} namespace: {{ .Release.Namespace }} labels: {{ include "query-service.commonLabels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: {{ template "query-service.serviceAccountName" . }} subjects: - kind: ServiceAccount name: {{ template "query-service.serviceAccountName" . }} namespace: {{ .Release.Namespace }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: {{ template "query-service.serviceAccountName" . }} labels: {{ include "query-service.commonLabels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: {{ template "query-service.serviceAccountName" . }} subjects: - kind: ServiceAccount name: {{ template "query-service.serviceAccountName" . }} namespace: {{ .Release.Namespace }} {{- end }} {{- end }}