From 574d915986c05062f7570d0fb117dee0a31a0944 Mon Sep 17 00:00:00 2001 From: Andre Ziviani Date: Fri, 30 Dec 2022 18:02:28 -0300 Subject: [PATCH] feat: Update eks-cost-exporter and add rbac manifests --- charts/eks-cost-exporter/Chart.yaml | 4 +- charts/eks-cost-exporter/README.md | 3 ++ charts/eks-cost-exporter/templates/rbac.yaml | 56 ++++++++++++++++++++ charts/eks-cost-exporter/values.yaml | 5 ++ 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 charts/eks-cost-exporter/templates/rbac.yaml diff --git a/charts/eks-cost-exporter/Chart.yaml b/charts/eks-cost-exporter/Chart.yaml index f81649e..f9d8e7a 100644 --- a/charts/eks-cost-exporter/Chart.yaml +++ b/charts/eks-cost-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: eks-cost-exporter description: Exports the cost of each Kubernetes pod as prometheus metrics type: application -appVersion: v0.2.1 -version: 0.1.0 +appVersion: v0.3.0 +version: 0.2.1 maintainers: - name: AndreZiviani diff --git a/charts/eks-cost-exporter/README.md b/charts/eks-cost-exporter/README.md index 075355d..66c0a85 100644 --- a/charts/eks-cost-exporter/README.md +++ b/charts/eks-cost-exporter/README.md @@ -30,6 +30,9 @@ helm repo add andreziviani https://andreziviani.github.io/helm-charts | podPortName | string | `"http-metrics"` | | | podSecurityContext | object | `{}` | | | priorityClassName | string | `"system-node-critical"` | | +| rbac.annotations | object | `{}` | | +| rbac.create | bool | `true` | | +| rbac.labels | object | `{}` | | | replicas | int | `1` | | | resources.requests.cpu | string | `"50m"` | | | resources.requests.memory | string | `"128Mi"` | | diff --git a/charts/eks-cost-exporter/templates/rbac.yaml b/charts/eks-cost-exporter/templates/rbac.yaml new file mode 100644 index 0000000..9cdb490 --- /dev/null +++ b/charts/eks-cost-exporter/templates/rbac.yaml @@ -0,0 +1,56 @@ +{{- if .Values.rbac.create }} +{{- $root := . -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "eks-cost-exporter.labels" . | nindent 4 }} + {{- with .Values.rbac.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.rbac.annotations }} + annotations: + {{- tpl (toYaml . | nindent 4) $root }} + {{- end }} + name: {{ include "eks-cost-exporter.fullname" . }} +rules: +- apiGroups: + - "" + resources: + - nodes + - pods + verbs: + - get + - list + - watch +- apiGroups: + - metrics.k8s.io + resources: + - pods + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + {{- include "eks-cost-exporter.labels" . | nindent 4 }} + {{- with .Values.rbac.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.rbac.annotations }} + annotations: + {{- tpl (toYaml . | nindent 4) $root }} + {{- end }} + name: {{ include "eks-cost-exporter.fullname" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "eks-cost-exporter.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ include "eks-cost-exporter.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/eks-cost-exporter/values.yaml b/charts/eks-cost-exporter/values.yaml index c192502..2999a1e 100644 --- a/charts/eks-cost-exporter/values.yaml +++ b/charts/eks-cost-exporter/values.yaml @@ -63,6 +63,11 @@ serviceMonitor: scrapeTimeout: 30s relabelings: [] +rbac: + create: true + labels: {} + annotations: {} + #nodeSelector: | # selector: label #