Skip to content

Commit

Permalink
feat: Update eks-cost-explorer and add option to map labels to the me…
Browse files Browse the repository at this point in the history
…trics
  • Loading branch information
AndreZiviani committed Jan 4, 2023
1 parent adabf54 commit 14afe80
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
4 changes: 2 additions & 2 deletions charts/eks-cost-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.0
version: 0.5.0
appVersion: v0.6.0
version: 0.6.0
maintainers:
- name: AndreZiviani
2 changes: 2 additions & 0 deletions charts/eks-cost-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ helm repo add andreziviani https://andreziviani.github.io/helm-charts

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| addNodeLabels | list | `[]` | |
| addPodLabels | list | `[]` | |
| annotations | object | `{}` | |
| args | list | `[]` | |
| containerSecurityContext.privileged | bool | `false` | |
Expand Down
16 changes: 16 additions & 0 deletions charts/eks-cost-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,19 @@ Create the name of the service account
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Convert a list of options to csv
*/}}
{{- define "eks-cost-exporter.addPodLabels" -}}
{{- if gt (len .Values.addPodLabels) 0 }}
{{- $tmp := join "," .Values.addPodLabels }}
{{- list "--addPodLabels" $tmp | toYaml }}
{{- end }}
{{- end }}
{{- define "eks-cost-exporter.addNodeLabels" -}}
{{- if gt (len .Values.addNodeLabels) 0 }}
{{- $tmp := join "," .Values.addNodeLabels }}
{{- list "--addNodeLabels" $tmp | toYaml }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion charts/eks-cost-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ spec:
- name: eks-cost-exporter
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.args }}
args:
{{- with .Values.args }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "eks-cost-exporter.addPodLabels" . | nindent 12 }}
{{ include "eks-cost-exporter.addNodeLabels" . | nindent 12 }}
{{- with .Values.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
Expand Down
10 changes: 10 additions & 0 deletions charts/eks-cost-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ image:

imagePullSecrets: []

addPodLabels: []
addNodeLabels: []
#addPodLabels:
# - app
# - app.kubernetes.io/name
#
#addNodeLabels:
# - kubernetes.io/os
# - kubernetes.io/arch

args: []

annotations: {}
Expand Down

0 comments on commit 14afe80

Please sign in to comment.