From fe0db4a6607d0f0ae67ac07c66686df4e8bf5ff8 Mon Sep 17 00:00:00 2001 From: Cyril Corbon Date: Wed, 3 Feb 2021 17:46:13 +0100 Subject: [PATCH 01/31] feat: add helm chart for azure-resourcemanager-exporter --- .../azure-resourcemanager-exporter/Chart.yaml | 5 + .../templates/NOTES.txt | 10 ++ .../templates/_helpers.tpl | 53 ++++++++ .../templates/deployment.yaml | 100 ++++++++++++++ .../templates/ingress.yaml | 32 +++++ .../templates/prometheusrule.yaml | 23 ++++ .../templates/service.yaml | 30 +++++ .../templates/serviceaccount.yaml | 13 ++ .../templates/servicemonitor.yaml | 29 +++++ .../values.yaml | 123 ++++++++++++++++++ 10 files changed, 418 insertions(+) create mode 100644 helm/azure-resourcemanager-exporter/Chart.yaml create mode 100644 helm/azure-resourcemanager-exporter/templates/NOTES.txt create mode 100644 helm/azure-resourcemanager-exporter/templates/_helpers.tpl create mode 100644 helm/azure-resourcemanager-exporter/templates/deployment.yaml create mode 100644 helm/azure-resourcemanager-exporter/templates/ingress.yaml create mode 100644 helm/azure-resourcemanager-exporter/templates/prometheusrule.yaml create mode 100644 helm/azure-resourcemanager-exporter/templates/service.yaml create mode 100644 helm/azure-resourcemanager-exporter/templates/serviceaccount.yaml create mode 100644 helm/azure-resourcemanager-exporter/templates/servicemonitor.yaml create mode 100644 helm/azure-resourcemanager-exporter/values.yaml diff --git a/helm/azure-resourcemanager-exporter/Chart.yaml b/helm/azure-resourcemanager-exporter/Chart.yaml new file mode 100644 index 0000000..33ebe76 --- /dev/null +++ b/helm/azure-resourcemanager-exporter/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +description: Prometheus Azure Resource Manager Exporter +name: azure-resourcemanager-exporter +version: 1.0.0 +appVersion: 1.0.0 diff --git a/helm/azure-resourcemanager-exporter/templates/NOTES.txt b/helm/azure-resourcemanager-exporter/templates/NOTES.txt new file mode 100644 index 0000000..8d50aac --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/NOTES.txt @@ -0,0 +1,10 @@ +Thank you for installing {{ .Chart.Name }}. + +Your release is named {{ .Release.Name }}. + +To learn more about the release, try: + + $ helm status {{ .Release.Name }} + $ helm get all {{ .Release.Name }} + +You can find more documentation there : https://github.com/webdevops/azure-resourcemanager-exporter diff --git a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl new file mode 100644 index 0000000..e4b3f19 --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl @@ -0,0 +1,53 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "azure-resourcemanager-exporter.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "azure-resourcemanager-exporter.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "azure-resourcemanager-exporter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "azure-resourcemanager-exporter.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "azure-resourcemanager-exporter.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for rbac. +*/}} +{{- define "rbac.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/helm/azure-resourcemanager-exporter/templates/deployment.yaml b/helm/azure-resourcemanager-exporter/templates/deployment.yaml new file mode 100644 index 0000000..e9a3a94 --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/deployment.yaml @@ -0,0 +1,100 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "azure-resourcemanager-exporter.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + strategy: +{{ toYaml .Values.strategy | indent 4 }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} + {{- if .Values.pod.labels }} +{{ toYaml .Values.pod.labels | indent 8 }} + {{- end }} + annotations: + {{- if .Values.podAnnotations }} +{{ toYaml .Values.podAnnotations | indent 8 }} + {{- end }} + spec: + serviceAccountName: {{ template "azure-resourcemanager-exporter.serviceAccountName" . }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: +{{ toYaml .Values.tolerations | indent 6 }} + {{- end }} + {{- if .Values.image.pullSecrets }} + imagePullSecrets: + {{- range .Values.image.pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} + restartPolicy: {{ .Values.restartPolicy }} + containers: + - name: azure-resourcemanager-exporter + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + readOnlyRootFilesystem: {{ .Values.readOnlyRootFilesystem }} + runAsNonRoot: {{ .Values.runAsNonRoot }} + runAsUser: {{ .Values.runAsUser }} + env: +{{- if .Values.secret.enabled }} + - name: AZURE_SUBSCRIPTION_ID + valueFrom: + secretKeyRef: + name: {{ .Values.secret.name }} + key: AZURE_SUBSCRIPTION_ID + - name: AZURE_TENANT_ID + valueFrom: + secretKeyRef: + name: {{ .Values.secret.name }} + key: AZURE_TENANT_ID + - name: AZURE_CLIENT_ID + valueFrom: + secretKeyRef: + name: {{ .Values.secret.name }} + key: AZURE_CLIENT_ID + - name: AZURE_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: {{ .Values.secret.name }} + key: AZURE_CLIENT_SECRET +{{ end }} + {{- range $key, $value := .Values.extraEnv }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + args: + {{- if .Values.extraArgs }} +{{ toYaml .Values.extraArgs | indent 12 }} + {{- end }} + resources: +{{ toYaml .Values.resources | indent 12 }} + ports: + - containerPort: {{ .Values.containerPort }} + name: http + livenessProbe: + {{- toYaml .Values.livenessProbe | trim | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | trim | nindent 12 }} diff --git a/helm/azure-resourcemanager-exporter/templates/ingress.yaml b/helm/azure-resourcemanager-exporter/templates/ingress.yaml new file mode 100644 index 0000000..146cc69 --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- if semverCompare ">=1.14.0-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: networking.k8s.io/v1beta1 +{{- else }} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ template "azure-resourcemanager-exporter.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} + annotations: +{{ toYaml .Values.ingress.annotations | indent 4 }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: {{ $.Values.ingress.path }} + backend: + serviceName: {{ template "azure-resourcemanager-exporter.fullname" $ }} + servicePort: {{ $.Values.service.port }} + {{- end -}} + {{- if $.Values.ingress.tls }} + tls: +{{ toYaml $.Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/helm/azure-resourcemanager-exporter/templates/prometheusrule.yaml b/helm/azure-resourcemanager-exporter/templates/prometheusrule.yaml new file mode 100644 index 0000000..357c93f --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/prometheusrule.yaml @@ -0,0 +1,23 @@ +{{- if .Values.prometheusRule.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ template "azure-resourcemanager-exporter.fullname" . }} + {{- with .Values.prometheusRule.namespace }} + namespace: {{ . }} + {{- end }} + labels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} + {{- with .Values.prometheusRule.additionalLabels -}} +{{- toYaml . | nindent 4 -}} + {{- end }} +spec: + {{- with .Values.prometheusRule.rules }} + groups: + - name: {{ template "azure-resourcemanager-exporter.name" $ }} + rules: {{ tpl (toYaml .) $ | nindent 8 }} + {{- end }} +{{- end }} diff --git a/helm/azure-resourcemanager-exporter/templates/service.yaml b/helm/azure-resourcemanager-exporter/templates/service.yaml new file mode 100644 index 0000000..99deea1 --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/service.yaml @@ -0,0 +1,30 @@ +kind: Service +apiVersion: v1 +metadata: + name: {{ template "azure-resourcemanager-exporter.fullname" . }} + {{- if .Values.service.annotations }} + annotations: +{{ toYaml .Values.service.annotations | indent 4 }} +{{- end }} + labels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} +{{- if .Values.service.labels }} +{{ toYaml .Values.service.labels | indent 4 }} +{{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - name: http + port: {{ .Values.service.port }} + targetPort: http + protocol: TCP +{{- if .Values.service.externalIPs }} + externalIPs: +{{ toYaml .Values.service.externalIPs | indent 4 }} +{{- end }} + selector: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/helm/azure-resourcemanager-exporter/templates/serviceaccount.yaml b/helm/azure-resourcemanager-exporter/templates/serviceaccount.yaml new file mode 100644 index 0000000..ea9f187 --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "azure-resourcemanager-exporter.serviceAccountName" . }} + labels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} + annotations: +{{ toYaml .Values.serviceAccount.annotations | indent 4 }} +{{- end -}} diff --git a/helm/azure-resourcemanager-exporter/templates/servicemonitor.yaml b/helm/azure-resourcemanager-exporter/templates/servicemonitor.yaml new file mode 100644 index 0000000..be3bdbb --- /dev/null +++ b/helm/azure-resourcemanager-exporter/templates/servicemonitor.yaml @@ -0,0 +1,29 @@ +{{- if .Values.serviceMonitor.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "azure-resourcemanager-exporter.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} + {{- if or .Values.serviceMonitor.labels .labels }} + {{- toYaml (.labels | default .Values.serviceMonitor.labels) | nindent 4 }} + {{- end }} +spec: + endpoints: + - port: http + interval: {{ .Values.serviceMonitor.interval }} + scheme: {{ .Values.serviceMonitor.scheme }} + scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }} + jobLabel: "{{ .Release.Name }}" + selector: + matchLabels: + app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} diff --git a/helm/azure-resourcemanager-exporter/values.yaml b/helm/azure-resourcemanager-exporter/values.yaml new file mode 100644 index 0000000..1a2d28c --- /dev/null +++ b/helm/azure-resourcemanager-exporter/values.yaml @@ -0,0 +1,123 @@ +restartPolicy: Always + +extraEnv: + #AZURE_LOCATION: "" + +strategy: + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + type: RollingUpdate + +image: + repository: quay.io/webdevops/azure-resourcemanager-exporter + tag: 20.11.1 + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistrKeySecretName + + +## User to run container as +runAsUser: 1000 +readOnlyRootFilesystem: true +runAsNonRoot: true + +nodeSelector: {} +tolerations: [] +affinity: {} + +resources: {} + # limits: + # memory: 300Mi + # requests: + # memory: 50Mi + +service: + annotations: {} + labels: {} + type: ClusterIP + port: 8080 + +containerPort: 8080 + +serviceAccount: + # Specifies whether a ServiceAccount should be created + create: true + # The name of the ServiceAccount to use. + # If not set and create is true, a name is generated using the fullname template + name: + annotations: {} + +## An Ingress resource can provide name-based virtual hosting and TLS +## termination among other things for CouchDB deployments which are accessed +## from outside the Kubernetes cluster. +## ref: https://kubernetes.io/docs/concepts/services-networking/ingress/ +ingress: + enabled: false + hosts: [] + # - chart-example.local + path: '/' + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + tls: [] + # Secrets must be manually created in the namespace. + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +secret: + enabled: false + name: azure-resourcemanager-exporter-secret + ## secrets will need the following vars : + ## AZURE_CLIENT_ID: "" + ## AZURE_CLIENT_SECRET: "" + ## AZURE_SUBSCRIPTION_ID: "" + ## AZURE_TENANT_ID: "" + +podAnnotations: {} + +pod: + labels: {} + +extraArgs: [] + +replicas: 1 + +serviceMonitor: + ## If true, a ServiceMonitor CRD is created for a prometheus operator + ## https://github.com/coreos/prometheus-operator + ## + enabled: false + labels: {} + interval: 30s + scrapeTimeout: 30s + + ## scheme: HTTP scheme to use for scraping. Can be used with `tlsConfig` for example if using istio mTLS. + scheme: http + ## tlsConfig: TLS configuration to use when scraping the endpoint. For example if using istio mTLS. + ## Of type: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#tlsconfig + tlsConfig: {} + +## Custom PrometheusRules to be defined +## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions +prometheusRule: + enabled: false + additionalLabels: {} + namespace: "" + rules: [] + +livenessProbe: + httpGet: + path: /metrics + port: http + +readinessProbe: + httpGet: + path: /metrics + port: http + From 8670c19b71d28bb1046059eb79cc99b0f27fe0eb Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Thu, 4 Feb 2021 11:28:13 +0100 Subject: [PATCH 02/31] Update helm/azure-resourcemanager-exporter/templates/NOTES.txt Co-authored-by: tboussar --- helm/azure-resourcemanager-exporter/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/azure-resourcemanager-exporter/templates/NOTES.txt b/helm/azure-resourcemanager-exporter/templates/NOTES.txt index 8d50aac..27a7d4e 100644 --- a/helm/azure-resourcemanager-exporter/templates/NOTES.txt +++ b/helm/azure-resourcemanager-exporter/templates/NOTES.txt @@ -7,4 +7,4 @@ To learn more about the release, try: $ helm status {{ .Release.Name }} $ helm get all {{ .Release.Name }} -You can find more documentation there : https://github.com/webdevops/azure-resourcemanager-exporter +You can find more documentation here : https://github.com/webdevops/azure-resourcemanager-exporter From f837d9889370ef23d104db519817b87e710457a7 Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Thu, 4 Feb 2021 11:28:30 +0100 Subject: [PATCH 03/31] Update helm/azure-resourcemanager-exporter/templates/_helpers.tpl Co-authored-by: tboussar --- helm/azure-resourcemanager-exporter/templates/_helpers.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl index e4b3f19..8206286 100644 --- a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl +++ b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl @@ -31,7 +31,7 @@ Create chart name and version as used by the chart label. {{- end -}} {{/* -Create the name of the service account to use +Create the name of the service account to use. */}} {{- define "azure-resourcemanager-exporter.serviceAccountName" -}} {{- if .Values.serviceAccount.create -}} @@ -50,4 +50,4 @@ Return the appropriate apiVersion for rbac. {{- else -}} {{- print "rbac.authorization.k8s.io/v1beta1" -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} From 05760d2e5578e53a77f6f82e44263b197ebc0c8f Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Thu, 4 Feb 2021 11:28:45 +0100 Subject: [PATCH 04/31] Update helm/azure-resourcemanager-exporter/templates/_helpers.tpl Co-authored-by: tboussar --- helm/azure-resourcemanager-exporter/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl index 8206286..adf3f8b 100644 --- a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl +++ b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl @@ -8,7 +8,7 @@ Expand the name of the chart. {{/* Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +App name is truncated to 63 chars because some Kubernetes name fields are limited to this (by DNS naming spec). */}} {{- define "azure-resourcemanager-exporter.fullname" -}} {{- if .Values.fullnameOverride -}} From e621b0ecd76daa19f59cec0bc7079b75e2f966c3 Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Thu, 4 Feb 2021 15:40:17 +0100 Subject: [PATCH 05/31] Update helm/azure-resourcemanager-exporter/values.yaml Co-authored-by: Zadkiel --- helm/azure-resourcemanager-exporter/values.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helm/azure-resourcemanager-exporter/values.yaml b/helm/azure-resourcemanager-exporter/values.yaml index 1a2d28c..c052e4c 100644 --- a/helm/azure-resourcemanager-exporter/values.yaml +++ b/helm/azure-resourcemanager-exporter/values.yaml @@ -73,7 +73,7 @@ ingress: secret: enabled: false name: azure-resourcemanager-exporter-secret - ## secrets will need the following vars : + ## secrets will need the following vars: ## AZURE_CLIENT_ID: "" ## AZURE_CLIENT_SECRET: "" ## AZURE_SUBSCRIPTION_ID: "" @@ -120,4 +120,3 @@ readinessProbe: httpGet: path: /metrics port: http - From 417eb6d4a151845f34a165fbea500f2042656f60 Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Thu, 4 Feb 2021 15:40:24 +0100 Subject: [PATCH 06/31] Update helm/azure-resourcemanager-exporter/templates/NOTES.txt Co-authored-by: Zadkiel --- helm/azure-resourcemanager-exporter/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/azure-resourcemanager-exporter/templates/NOTES.txt b/helm/azure-resourcemanager-exporter/templates/NOTES.txt index 27a7d4e..4cb5d7e 100644 --- a/helm/azure-resourcemanager-exporter/templates/NOTES.txt +++ b/helm/azure-resourcemanager-exporter/templates/NOTES.txt @@ -7,4 +7,4 @@ To learn more about the release, try: $ helm status {{ .Release.Name }} $ helm get all {{ .Release.Name }} -You can find more documentation here : https://github.com/webdevops/azure-resourcemanager-exporter +You can find more documentation here: https://github.com/webdevops/azure-resourcemanager-exporter From 0d6555f8be27e71ae674523c841b8805833be894 Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Tue, 9 Feb 2021 08:49:02 +0100 Subject: [PATCH 07/31] Update helm/azure-resourcemanager-exporter/templates/_helpers.tpl Co-authored-by: Zadkiel --- helm/azure-resourcemanager-exporter/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl index adf3f8b..8206286 100644 --- a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl +++ b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl @@ -8,7 +8,7 @@ Expand the name of the chart. {{/* Create a default fully qualified app name. -App name is truncated to 63 chars because some Kubernetes name fields are limited to this (by DNS naming spec). +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "azure-resourcemanager-exporter.fullname" -}} {{- if .Values.fullnameOverride -}} From ea3ed6b5b2ff6552591ce7cc7cb8b78d2e9f89a1 Mon Sep 17 00:00:00 2001 From: Cyril Corbon Date: Tue, 9 Feb 2021 10:14:54 +0100 Subject: [PATCH 08/31] define ingress api version in templates --- .../templates/_helpers.tpl | 12 ++++++------ .../templates/ingress.yaml | 6 +----- helm/azure-resourcemanager-exporter/values.yaml | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl index 8206286..d5b43d6 100644 --- a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl +++ b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl @@ -42,12 +42,12 @@ Create the name of the service account to use. {{- end -}} {{/* -Return the appropriate apiVersion for rbac. +Return the appropriate apiVersion for ingress. */}} -{{- define "rbac.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }} -{{- print "rbac.authorization.k8s.io/v1" -}} +{{- define "ingress.apiVersion" -}} +{{- if semverCompare ">=1.14.0-0" .Capabilities.KubeVersion.GitVersion }} +{{- print "networking.k8s.io/v1beta1" -}} {{- else -}} -{{- print "rbac.authorization.k8s.io/v1beta1" -}} -{{- end -}} +{{- print "extensions/v1beta1" -}} {{- end -}} +{{- end -}} \ No newline at end of file diff --git a/helm/azure-resourcemanager-exporter/templates/ingress.yaml b/helm/azure-resourcemanager-exporter/templates/ingress.yaml index 146cc69..2676624 100644 --- a/helm/azure-resourcemanager-exporter/templates/ingress.yaml +++ b/helm/azure-resourcemanager-exporter/templates/ingress.yaml @@ -1,9 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- if semverCompare ">=1.14.0-0" .Capabilities.KubeVersion.GitVersion }} -apiVersion: networking.k8s.io/v1beta1 -{{- else }} -apiVersion: extensions/v1beta1 -{{- end }} +apiVersion: {{ template "ingress.apiVersion" . }} kind: Ingress metadata: name: {{ template "azure-resourcemanager-exporter.fullname" . }} diff --git a/helm/azure-resourcemanager-exporter/values.yaml b/helm/azure-resourcemanager-exporter/values.yaml index c052e4c..8b28aca 100644 --- a/helm/azure-resourcemanager-exporter/values.yaml +++ b/helm/azure-resourcemanager-exporter/values.yaml @@ -1,6 +1,6 @@ restartPolicy: Always -extraEnv: +extraEnv: {} #AZURE_LOCATION: "" strategy: From afc59cdd6bc838e40f05024566b1079c762910d1 Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Tue, 23 Feb 2021 09:13:57 +0100 Subject: [PATCH 09/31] Update helm/azure-resourcemanager-exporter/Chart.yaml Co-authored-by: Zadkiel --- helm/azure-resourcemanager-exporter/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/azure-resourcemanager-exporter/Chart.yaml b/helm/azure-resourcemanager-exporter/Chart.yaml index 33ebe76..1e68efe 100644 --- a/helm/azure-resourcemanager-exporter/Chart.yaml +++ b/helm/azure-resourcemanager-exporter/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 description: Prometheus Azure Resource Manager Exporter name: azure-resourcemanager-exporter version: 1.0.0 -appVersion: 1.0.0 +appVersion: 20.11.1 From 92089086f8cc795c9c047baefd5772b1afa1b62a Mon Sep 17 00:00:00 2001 From: cyril-corbon Date: Tue, 23 Feb 2021 09:14:14 +0100 Subject: [PATCH 10/31] Update helm/azure-resourcemanager-exporter/Chart.yaml Co-authored-by: Zadkiel --- helm/azure-resourcemanager-exporter/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/azure-resourcemanager-exporter/Chart.yaml b/helm/azure-resourcemanager-exporter/Chart.yaml index 1e68efe..b1cbb6a 100644 --- a/helm/azure-resourcemanager-exporter/Chart.yaml +++ b/helm/azure-resourcemanager-exporter/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 description: Prometheus Azure Resource Manager Exporter name: azure-resourcemanager-exporter -version: 1.0.0 +version: 20.11.1 appVersion: 20.11.1 From dcc240856a2d245ed63008d32532cb6a545f1ccd Mon Sep 17 00:00:00 2001 From: Cyril Corbon Date: Tue, 23 Feb 2021 09:25:12 +0100 Subject: [PATCH 11/31] apply review, add labels and annotations to deployment and some docs Signed-off-by: Cyril Corbon --- .../azure-resourcemanager-exporter/templates/_helpers.tpl | 2 +- .../templates/deployment.yaml | 7 +++++++ helm/azure-resourcemanager-exporter/values.yaml | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl index d5b43d6..7076dea 100644 --- a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl +++ b/helm/azure-resourcemanager-exporter/templates/_helpers.tpl @@ -50,4 +50,4 @@ Return the appropriate apiVersion for ingress. {{- else -}} {{- print "extensions/v1beta1" -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/helm/azure-resourcemanager-exporter/templates/deployment.yaml b/helm/azure-resourcemanager-exporter/templates/deployment.yaml index e9a3a94..6d8be18 100644 --- a/helm/azure-resourcemanager-exporter/templates/deployment.yaml +++ b/helm/azure-resourcemanager-exporter/templates/deployment.yaml @@ -2,11 +2,18 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "azure-resourcemanager-exporter.fullname" . }} + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} labels: app.kubernetes.io/name: {{ include "azure-resourcemanager-exporter.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} helm.sh/chart: {{ include "azure-resourcemanager-exporter.chart" . }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.replicas }} selector: diff --git a/helm/azure-resourcemanager-exporter/values.yaml b/helm/azure-resourcemanager-exporter/values.yaml index 8b28aca..2bc6585 100644 --- a/helm/azure-resourcemanager-exporter/values.yaml +++ b/helm/azure-resourcemanager-exporter/values.yaml @@ -1,7 +1,10 @@ restartPolicy: Always extraEnv: {} - #AZURE_LOCATION: "" + ## You can add environments vars to configure the exporter, like the AZURE_LOCATION or the SCRAPE_TIME + ## A list of all the environment vars is available in this doc: https://github.com/webdevops/azure-resourcemanager-exporter#configuration + ## + # AZURE_LOCATION: "" strategy: rollingUpdate: @@ -20,6 +23,9 @@ image: # pullSecrets: # - myRegistrKeySecretName +## Annotations and labels to add to the deployment +annotations: {} +labels: {} ## User to run container as runAsUser: 1000 From 59fb682d6eef5223f09a4a09c715fad59173c7ae Mon Sep 17 00:00:00 2001 From: Cyril Corbon Date: Wed, 24 Feb 2021 11:27:21 +0100 Subject: [PATCH 12/31] feat(ci): add helm lint Signed-off-by: Cyril Corbon --- .github/workflows/lint-helm.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/lint-helm.yml diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml new file mode 100644 index 0000000..d61e523 --- /dev/null +++ b/.github/workflows/lint-helm.yml @@ -0,0 +1,24 @@ +name: "Lint: helm chart" +on: + push: + branches: + - '**' + paths: + - 'helm/**' + - '.github/workflows/lint-helm.yml' + workflow_dispatch: + +jobs: + helm3-lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.4.0 + + - name: Helm lint + run: helm lint helm/azure-resourcemanager-exporter From bc7f44823e003856898f1ee8c9b7cec9a3a8817e Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 11:49:42 +0100 Subject: [PATCH 13/31] disable release-docker workflow --- .../workflows/{release-docker.yml => release-docker.yml.disabled} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{release-docker.yml => release-docker.yml.disabled} (100%) diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml.disabled similarity index 100% rename from .github/workflows/release-docker.yml rename to .github/workflows/release-docker.yml.disabled From c052d5c985e65067537bfe2dbcc8a26b7db3f610 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 12:31:55 +0100 Subject: [PATCH 14/31] add publish chart --- .github/workflows/publish-helm.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/publish-helm.yml diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml new file mode 100644 index 0000000..ad97688 --- /dev/null +++ b/.github/workflows/publish-helm.yml @@ -0,0 +1,25 @@ +name: "Publish: helm chart" +on: + push: + branches: + - '**' + paths: + - 'helm/**' + - '.github/workflows/publish-helm.yml' + +jobs: + publish-release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Helm + uses: azure/setup-helm@v1 + with: + version: v3.5.2 + + - name: Publish Helm charts + uses: stefanprodan/helm-gh-pages@master + with: + token: ${{ secrets.GITHUB_TOKEN }} From d0c1e7ff32133fe92cafb3a07d6fde1c95e00934 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 12:36:21 +0100 Subject: [PATCH 15/31] add publish chart --- .github/workflows/publish-helm.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index ad97688..b455b2a 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -6,7 +6,6 @@ on: paths: - 'helm/**' - '.github/workflows/publish-helm.yml' - jobs: publish-release: runs-on: ubuntu-latest From eb4023939eda16c5a2075b00b6b06fcfbad294f3 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 12:43:39 +0100 Subject: [PATCH 16/31] fix publisher --- .github/workflows/publish-helm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index b455b2a..85b22fa 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -22,3 +22,4 @@ jobs: uses: stefanprodan/helm-gh-pages@master with: token: ${{ secrets.GITHUB_TOKEN }} + charts_dir: helm From b515f8986d9941d0c7068671e69f042b60f7d365 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 14:24:39 +0100 Subject: [PATCH 17/31] rename branch --- .github/workflows/publish-helm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index 85b22fa..5be7e09 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -2,7 +2,7 @@ name: "Publish: helm chart" on: push: branches: - - '**' + - main paths: - 'helm/**' - '.github/workflows/publish-helm.yml' From 2fab054df5ef45d88a97397a4f271fc7a18b8e65 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 14:48:51 +0100 Subject: [PATCH 18/31] create charts directory --- .github/workflows/publish-helm.yml | 4 +--- {helm => charts}/azure-resourcemanager-exporter/Chart.yaml | 0 .../azure-resourcemanager-exporter/templates/NOTES.txt | 0 .../azure-resourcemanager-exporter/templates/_helpers.tpl | 0 .../azure-resourcemanager-exporter/templates/deployment.yaml | 0 .../azure-resourcemanager-exporter/templates/ingress.yaml | 0 .../templates/prometheusrule.yaml | 0 .../azure-resourcemanager-exporter/templates/service.yaml | 0 .../templates/serviceaccount.yaml | 0 .../templates/servicemonitor.yaml | 0 {helm => charts}/azure-resourcemanager-exporter/values.yaml | 0 11 files changed, 1 insertion(+), 3 deletions(-) rename {helm => charts}/azure-resourcemanager-exporter/Chart.yaml (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/NOTES.txt (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/_helpers.tpl (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/deployment.yaml (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/ingress.yaml (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/prometheusrule.yaml (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/service.yaml (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/serviceaccount.yaml (100%) rename {helm => charts}/azure-resourcemanager-exporter/templates/servicemonitor.yaml (100%) rename {helm => charts}/azure-resourcemanager-exporter/values.yaml (100%) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index 5be7e09..b7ddf22 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -2,9 +2,8 @@ name: "Publish: helm chart" on: push: branches: - - main + - '**' paths: - - 'helm/**' - '.github/workflows/publish-helm.yml' jobs: publish-release: @@ -22,4 +21,3 @@ jobs: uses: stefanprodan/helm-gh-pages@master with: token: ${{ secrets.GITHUB_TOKEN }} - charts_dir: helm diff --git a/helm/azure-resourcemanager-exporter/Chart.yaml b/charts/azure-resourcemanager-exporter/Chart.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/Chart.yaml rename to charts/azure-resourcemanager-exporter/Chart.yaml diff --git a/helm/azure-resourcemanager-exporter/templates/NOTES.txt b/charts/azure-resourcemanager-exporter/templates/NOTES.txt similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/NOTES.txt rename to charts/azure-resourcemanager-exporter/templates/NOTES.txt diff --git a/helm/azure-resourcemanager-exporter/templates/_helpers.tpl b/charts/azure-resourcemanager-exporter/templates/_helpers.tpl similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/_helpers.tpl rename to charts/azure-resourcemanager-exporter/templates/_helpers.tpl diff --git a/helm/azure-resourcemanager-exporter/templates/deployment.yaml b/charts/azure-resourcemanager-exporter/templates/deployment.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/deployment.yaml rename to charts/azure-resourcemanager-exporter/templates/deployment.yaml diff --git a/helm/azure-resourcemanager-exporter/templates/ingress.yaml b/charts/azure-resourcemanager-exporter/templates/ingress.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/ingress.yaml rename to charts/azure-resourcemanager-exporter/templates/ingress.yaml diff --git a/helm/azure-resourcemanager-exporter/templates/prometheusrule.yaml b/charts/azure-resourcemanager-exporter/templates/prometheusrule.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/prometheusrule.yaml rename to charts/azure-resourcemanager-exporter/templates/prometheusrule.yaml diff --git a/helm/azure-resourcemanager-exporter/templates/service.yaml b/charts/azure-resourcemanager-exporter/templates/service.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/service.yaml rename to charts/azure-resourcemanager-exporter/templates/service.yaml diff --git a/helm/azure-resourcemanager-exporter/templates/serviceaccount.yaml b/charts/azure-resourcemanager-exporter/templates/serviceaccount.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/serviceaccount.yaml rename to charts/azure-resourcemanager-exporter/templates/serviceaccount.yaml diff --git a/helm/azure-resourcemanager-exporter/templates/servicemonitor.yaml b/charts/azure-resourcemanager-exporter/templates/servicemonitor.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/templates/servicemonitor.yaml rename to charts/azure-resourcemanager-exporter/templates/servicemonitor.yaml diff --git a/helm/azure-resourcemanager-exporter/values.yaml b/charts/azure-resourcemanager-exporter/values.yaml similarity index 100% rename from helm/azure-resourcemanager-exporter/values.yaml rename to charts/azure-resourcemanager-exporter/values.yaml From 59c6b9badf8c4952ca6f1e8d0c5ee8ce10911710 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 14:57:34 +0100 Subject: [PATCH 19/31] update workflow --- .github/workflows/lint-helm.yml | 2 -- .github/workflows/publish-helm.yml | 13 ++++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml index d61e523..dab953b 100644 --- a/.github/workflows/lint-helm.yml +++ b/.github/workflows/lint-helm.yml @@ -17,8 +17,6 @@ jobs: - name: Set up Helm uses: azure/setup-helm@v1 - with: - version: v3.4.0 - name: Helm lint run: helm lint helm/azure-resourcemanager-exporter diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index b7ddf22..0baafdb 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -12,12 +12,15 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Set up Helm uses: azure/setup-helm@v1 - with: - version: v3.5.2 - name: Publish Helm charts - uses: stefanprodan/helm-gh-pages@master - with: - token: ${{ secrets.GITHUB_TOKEN }} + uses: helm/chart-releaser-action@v1.2.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From aec5a392e84e54acabfbd8b59a3f2e12db86793b Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 14:59:30 +0100 Subject: [PATCH 20/31] fix path --- .github/workflows/lint-helm.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml index dab953b..5ffb66f 100644 --- a/.github/workflows/lint-helm.yml +++ b/.github/workflows/lint-helm.yml @@ -4,7 +4,6 @@ on: branches: - '**' paths: - - 'helm/**' - '.github/workflows/lint-helm.yml' workflow_dispatch: From 004eeb9ce86b90048f3bf0c359d984ad54baa486 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 15:00:47 +0100 Subject: [PATCH 21/31] fix path --- .github/workflows/lint-helm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-helm.yml b/.github/workflows/lint-helm.yml index 5ffb66f..560b1d8 100644 --- a/.github/workflows/lint-helm.yml +++ b/.github/workflows/lint-helm.yml @@ -18,4 +18,4 @@ jobs: uses: azure/setup-helm@v1 - name: Helm lint - run: helm lint helm/azure-resourcemanager-exporter + run: helm lint charts/azure-resourcemanager-exporter From b62dbfa715e3df5797c7c059aecebd103f0c87f0 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 15:07:39 +0100 Subject: [PATCH 22/31] testing publish --- .github/workflows/publish-helm.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index 0baafdb..736bec7 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -12,11 +12,6 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: Set up Helm uses: azure/setup-helm@v1 From c35e234d3069a725a2b4df0ed856e8fb034cebe4 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 15:13:44 +0100 Subject: [PATCH 23/31] testing --- .github/workflows/publish-helm.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index 736bec7..6fbeb2b 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -11,6 +11,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Set up Helm uses: azure/setup-helm@v1 From e822ec54af7233f7a758782235eb03b3ae7b9010 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 15:20:36 +0100 Subject: [PATCH 24/31] update workflow --- .github/workflows/publish-helm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index 6fbeb2b..9c7421c 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -1,8 +1,8 @@ name: "Publish: helm chart" on: push: - branches: - - '**' + tags: + - '*' paths: - '.github/workflows/publish-helm.yml' jobs: From 1358ae5e412493772de0c828983b5bbe3c0b57de Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Tue, 9 Mar 2021 17:59:11 +0100 Subject: [PATCH 25/31] update workflow --- .github/workflows/publish-helm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml index 9c7421c..b8a7ab9 100644 --- a/.github/workflows/publish-helm.yml +++ b/.github/workflows/publish-helm.yml @@ -5,6 +5,8 @@ on: - '*' paths: - '.github/workflows/publish-helm.yml' + workflow_dispatch: + jobs: publish-release: runs-on: ubuntu-latest From 6c29e97c1f29d2d20ce4a0834e80c4c87d579b50 Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Wed, 10 Mar 2021 12:25:33 +0100 Subject: [PATCH 26/31] update readme and chart --- README.md | 27 +++++++- .../templates/deployment.yaml | 19 +++--- .../values.yaml | 65 +++++++++++-------- 3 files changed, 75 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 3c9ae72..cc8f1ce 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,34 @@ Azure ResourceManager Exporter Prometheus exporter for Azure Resources and information. -Configuration +Installation ------------- +[Helm 3](https://helm.sh/) must be installed to use the chart. Once Helm is set up properly, Add the repo as follows: + +```shell +$ helm repo add azure-resourcemanager-exporter https://carrefour-group.github.io/azure-resourcemanager-exporter +$ helm repo update +``` + +Install Chart +------------- +The chart can be installed as follows: +```shell +$ helm install [RELEASE_NAME] azure-resourcemanager-exporter/azure-resourcemanager-exporter +``` + +Uninstall Chart +------------- +To uninstall the chart + +```shell +$ helm uninstall [RELEASE_NAME] +``` + +Exporter Configuration +--------------------- + Normally no configuration is needed but can be customized using environment variables. | Environment variable | DefaultValue | Description | diff --git a/charts/azure-resourcemanager-exporter/templates/deployment.yaml b/charts/azure-resourcemanager-exporter/templates/deployment.yaml index 6d8be18..a194c64 100644 --- a/charts/azure-resourcemanager-exporter/templates/deployment.yaml +++ b/charts/azure-resourcemanager-exporter/templates/deployment.yaml @@ -56,36 +56,37 @@ spec: - name: {{ . }} {{- end }} {{- end }} - restartPolicy: {{ .Values.restartPolicy }} containers: - name: azure-resourcemanager-exporter image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.securityContext.enabled }} securityContext: - readOnlyRootFilesystem: {{ .Values.readOnlyRootFilesystem }} - runAsNonRoot: {{ .Values.runAsNonRoot }} - runAsUser: {{ .Values.runAsUser }} + readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFilesystem }} + runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }} + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} env: -{{- if .Values.secret.enabled }} +{{- if .Values.credentials.useSecret }} - name: AZURE_SUBSCRIPTION_ID valueFrom: secretKeyRef: - name: {{ .Values.secret.name }} + name: {{ .Values.credentials.name }} key: AZURE_SUBSCRIPTION_ID - name: AZURE_TENANT_ID valueFrom: secretKeyRef: - name: {{ .Values.secret.name }} + name: {{ .Values.credentials.name }} key: AZURE_TENANT_ID - name: AZURE_CLIENT_ID valueFrom: secretKeyRef: - name: {{ .Values.secret.name }} + name: {{ .Values.credentials.name }} key: AZURE_CLIENT_ID - name: AZURE_CLIENT_SECRET valueFrom: secretKeyRef: - name: {{ .Values.secret.name }} + name: {{ .Values.credentials.name }} key: AZURE_CLIENT_SECRET {{ end }} {{- range $key, $value := .Values.extraEnv }} diff --git a/charts/azure-resourcemanager-exporter/values.yaml b/charts/azure-resourcemanager-exporter/values.yaml index 2bc6585..8e08c8a 100644 --- a/charts/azure-resourcemanager-exporter/values.yaml +++ b/charts/azure-resourcemanager-exporter/values.yaml @@ -1,16 +1,6 @@ -restartPolicy: Always - -extraEnv: {} - ## You can add environments vars to configure the exporter, like the AZURE_LOCATION or the SCRAPE_TIME - ## A list of all the environment vars is available in this doc: https://github.com/webdevops/azure-resourcemanager-exporter#configuration - ## - # AZURE_LOCATION: "" - -strategy: - rollingUpdate: - maxSurge: 1 - maxUnavailable: 0 - type: RollingUpdate +#Default values for azure-resourcemanager-exporter. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. image: repository: quay.io/webdevops/azure-resourcemanager-exporter @@ -23,24 +13,42 @@ image: # pullSecrets: # - myRegistrKeySecretName +extraEnv: {} + ## You can add environments vars to configure the exporter, like the AZURE_LOCATION or the SCRAPE_TIME + ## A list of all the environment vars is available in this doc: https://github.com/webdevops/azure-resourcemanager-exporter#configuration + ## + # AZURE_LOCATION: "" + ## Annotations and labels to add to the deployment annotations: {} labels: {} -## User to run container as -runAsUser: 1000 -readOnlyRootFilesystem: true -runAsNonRoot: true +## Container securityContext +securityContext: + enabled: true + # Container must run as + runAsUser: 1000 + readOnlyRootFilesystem: true + runAsNonRoot: true nodeSelector: {} tolerations: [] affinity: {} +strategy: + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + type: RollingUpdate + +# Container resource requests and limits resources: {} # limits: - # memory: 300Mi + # cpu: 300m + # memory: 128Mi # requests: - # memory: 50Mi + # cpu: 200m + # memory: 128Mi service: annotations: {} @@ -76,14 +84,17 @@ ingress: # hosts: # - chart-example.local -secret: - enabled: false + +# The secret to be used by the azure-resourcemanager-exporter deployment, which +# should contain credentials for the cloud provider +## secrets will need the following vars: +## AZURE_CLIENT_ID: "" +## AZURE_CLIENT_SECRET: "" +## AZURE_SUBSCRIPTION_ID: "" +## AZURE_TENANT_ID: "" +credentials: + useSecret: true name: azure-resourcemanager-exporter-secret - ## secrets will need the following vars: - ## AZURE_CLIENT_ID: "" - ## AZURE_CLIENT_SECRET: "" - ## AZURE_SUBSCRIPTION_ID: "" - ## AZURE_TENANT_ID: "" podAnnotations: {} @@ -117,6 +128,8 @@ prometheusRule: namespace: "" rules: [] + +# Probes configuration livenessProbe: httpGet: path: /metrics From 8b9486802b69a6777113bf7886b41aa7625ec835 Mon Sep 17 00:00:00 2001 From: Hamza ZOUHAIR <34426028+HamzaZo@users.noreply.github.com> Date: Wed, 10 Mar 2021 14:00:29 +0100 Subject: [PATCH 27/31] Update README.md Co-authored-by: Zadkiel --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc8f1ce..57d7d52 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Prometheus exporter for Azure Resources and information. Installation ------------- -[Helm 3](https://helm.sh/) must be installed to use the chart. Once Helm is set up properly, Add the repo as follows: +[Helm 3](https://helm.sh/) must be installed to use the chart. Once Helm is set up properly, add the repo as follows: ```shell $ helm repo add azure-resourcemanager-exporter https://carrefour-group.github.io/azure-resourcemanager-exporter From 2e211a07e63f961e81967a35c23d1d72b72f967f Mon Sep 17 00:00:00 2001 From: HamzaZo Date: Wed, 10 Mar 2021 14:31:26 +0100 Subject: [PATCH 28/31] update readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 57d7d52..85e4a89 100644 --- a/README.md +++ b/README.md @@ -110,3 +110,15 @@ Metrics | `azurerm_iam_principal_info` | IAM | Azure IAM Principal information | | `azurerm_graph_app_info` | Graph | AzureAD graph application information | | `azurerm_graph_app_credential` | Graph | AzureAD graph application credentials (create,expiry) information | + + +Contributing +------------ +We welcome any contributions from the community with open arms, If you're planning a new feature, please file an issue to discuss first. + +How to Release +-------------- +To release a new version of the helm chart, you need to bump : + * `appVersion` & `version` fields in `Chart.yaml` file. + * `image.tag` in `values.yaml` file. + From 7b24f750b01cf7bba487064684f5097b9bfa90a7 Mon Sep 17 00:00:00 2001 From: Hamza ZOUHAIR <34426028+HamzaZo@users.noreply.github.com> Date: Wed, 10 Mar 2021 16:12:13 +0100 Subject: [PATCH 29/31] Update README.md Co-authored-by: Zadkiel --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 85e4a89..39d9a0b 100644 --- a/README.md +++ b/README.md @@ -114,11 +114,10 @@ Metrics Contributing ------------ -We welcome any contributions from the community with open arms, If you're planning a new feature, please file an issue to discuss first. +We welcome any contributions from the community with open arms. If you're planning a new feature, please file an issue to discuss first. How to Release -------------- To release a new version of the helm chart, you need to bump : * `appVersion` & `version` fields in `Chart.yaml` file. * `image.tag` in `values.yaml` file. - From e9692752a635a3f3c16c2ee67b8bd8ac0f7df365 Mon Sep 17 00:00:00 2001 From: Hamza ZOUHAIR <34426028+HamzaZo@users.noreply.github.com> Date: Wed, 10 Mar 2021 16:12:28 +0100 Subject: [PATCH 30/31] Update README.md Co-authored-by: Zadkiel --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39d9a0b..0413f53 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,6 @@ We welcome any contributions from the community with open arms. If you're planni How to Release -------------- -To release a new version of the helm chart, you need to bump : +To release a new version of the helm chart, you need to bump: * `appVersion` & `version` fields in `Chart.yaml` file. * `image.tag` in `values.yaml` file. From d0e9250a86c8fb38896561b8377fb3d88e11ac09 Mon Sep 17 00:00:00 2001 From: Hamza ZOUHAIR <34426028+HamzaZo@users.noreply.github.com> Date: Wed, 10 Mar 2021 16:12:40 +0100 Subject: [PATCH 31/31] Update README.md Co-authored-by: Zadkiel --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0413f53..78946e1 100644 --- a/README.md +++ b/README.md @@ -119,5 +119,5 @@ We welcome any contributions from the community with open arms. If you're planni How to Release -------------- To release a new version of the helm chart, you need to bump: - * `appVersion` & `version` fields in `Chart.yaml` file. + * `appVersion` and `version` fields in `Chart.yaml` file. * `image.tag` in `values.yaml` file.