From fdcac8d9fba8e9f2fecdc4a44edc91bea82eb429 Mon Sep 17 00:00:00 2001 From: Steven Fitzpatrick Date: Mon, 24 May 2021 17:25:38 +0000 Subject: [PATCH] Add elasticsearch-exporter to our elastic-stack This change introduces a function for deploying the community prometheus-easticsearch-exporter chart, and adds it to our elastic-stack composite. Upon review it was found that the chart version was being replaced at the incorrect yaml path accross all LMA components, so these replacements are corrected in this PS as well. Change-Id: Iad973f4a16d9985a639c3c6927d9f74cd57f4910 --- .../replacements/versions.yaml | 2 +- .../replacements/versions.yaml | 2 +- .../elastic-stack/kustomization.yaml | 2 + .../prometheus-elasticsearch-exporter.yaml | 14 ++++++ .../replacements/kustomization.yaml | 1 + .../elasticsearch/replacements/versions.yaml | 2 +- .../grafana/replacements/versions.yaml | 2 +- .../replacements/versions.yaml | 2 +- .../replacements/versions.yaml | 4 +- .../helmrelease.yaml | 17 +++++++ .../helmrepository.yaml | 6 +++ .../kustomization.yaml | 3 ++ .../replacements/kustomization.yaml | 2 + .../replacements/versions.yaml | 49 +++++++++++++++++++ .../replacements/versions.yaml | 2 +- .../versions-treasuremap.yaml | 7 +++ 16 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 manifests/composite/elastic-stack/patches/prometheus-elasticsearch-exporter.yaml create mode 100644 manifests/function/prometheus-elasticsearch-exporter/helmrelease.yaml create mode 100644 manifests/function/prometheus-elasticsearch-exporter/helmrepository.yaml create mode 100644 manifests/function/prometheus-elasticsearch-exporter/kustomization.yaml create mode 100644 manifests/function/prometheus-elasticsearch-exporter/replacements/kustomization.yaml create mode 100644 manifests/function/prometheus-elasticsearch-exporter/replacements/versions.yaml diff --git a/manifests/composite/elastic-stack/elasticsearch-data/replacements/versions.yaml b/manifests/composite/elastic-stack/elasticsearch-data/replacements/versions.yaml index 873c166fb..10df87237 100644 --- a/manifests/composite/elastic-stack/elasticsearch-data/replacements/versions.yaml +++ b/manifests/composite/elastic-stack/elasticsearch-data/replacements/versions.yaml @@ -36,7 +36,7 @@ replacements: objref: kind: HelmRelease name: elasticsearch-data - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] - source: objref: kind: VersionsCatalogue diff --git a/manifests/composite/elastic-stack/elasticsearch-ingest/replacements/versions.yaml b/manifests/composite/elastic-stack/elasticsearch-ingest/replacements/versions.yaml index 76448f6c8..f33dd7089 100644 --- a/manifests/composite/elastic-stack/elasticsearch-ingest/replacements/versions.yaml +++ b/manifests/composite/elastic-stack/elasticsearch-ingest/replacements/versions.yaml @@ -36,7 +36,7 @@ replacements: objref: kind: HelmRelease name: elasticsearch-ingest - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] - source: objref: kind: VersionsCatalogue diff --git a/manifests/composite/elastic-stack/kustomization.yaml b/manifests/composite/elastic-stack/kustomization.yaml index 10cffa3fc..a97051a94 100644 --- a/manifests/composite/elastic-stack/kustomization.yaml +++ b/manifests/composite/elastic-stack/kustomization.yaml @@ -2,8 +2,10 @@ resources: - elasticsearch-ingest - elasticsearch-data - ../../function/kibana + - ../../function/prometheus-elasticsearch-exporter namespace: lma patches: - path: patches/kibana.yaml + - path: patches/prometheus-elasticsearch-exporter.yaml diff --git a/manifests/composite/elastic-stack/patches/prometheus-elasticsearch-exporter.yaml b/manifests/composite/elastic-stack/patches/prometheus-elasticsearch-exporter.yaml new file mode 100644 index 000000000..465457f04 --- /dev/null +++ b/manifests/composite/elastic-stack/patches/prometheus-elasticsearch-exporter.yaml @@ -0,0 +1,14 @@ +apiVersion: "helm.toolkit.fluxcd.io/v2beta1" +kind: HelmRelease +metadata: + name: prometheus-elasticsearch-exporter +spec: + values: + es: + uri: http://elasticsearch-ingest.lma.svc.cluster.local:9200 + serviceMonitor: + enabled: true + prometheusRule: + enabled: false + serviceAccount: + create: true diff --git a/manifests/composite/elastic-stack/replacements/kustomization.yaml b/manifests/composite/elastic-stack/replacements/kustomization.yaml index 7797506eb..2c395f402 100644 --- a/manifests/composite/elastic-stack/replacements/kustomization.yaml +++ b/manifests/composite/elastic-stack/replacements/kustomization.yaml @@ -2,3 +2,4 @@ resources: - ../elasticsearch-ingest/replacements - ../elasticsearch-data/replacements - ../../../function/kibana/replacements + - ../../../function/prometheus-elasticsearch-exporter/replacements diff --git a/manifests/function/elasticsearch/replacements/versions.yaml b/manifests/function/elasticsearch/replacements/versions.yaml index 543124ba4..4fad7bd92 100644 --- a/manifests/function/elasticsearch/replacements/versions.yaml +++ b/manifests/function/elasticsearch/replacements/versions.yaml @@ -36,7 +36,7 @@ replacements: objref: kind: HelmRelease name: elasticseach - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] - source: objref: kind: VersionsCatalogue diff --git a/manifests/function/grafana/replacements/versions.yaml b/manifests/function/grafana/replacements/versions.yaml index 8ee7c7acb..ba41c723f 100644 --- a/manifests/function/grafana/replacements/versions.yaml +++ b/manifests/function/grafana/replacements/versions.yaml @@ -36,7 +36,7 @@ replacements: objref: kind: HelmRelease name: grafana - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] - source: objref: kind: VersionsCatalogue diff --git a/manifests/function/kube-prometheus-stack/replacements/versions.yaml b/manifests/function/kube-prometheus-stack/replacements/versions.yaml index 31fa7293e..9aaa5d751 100644 --- a/manifests/function/kube-prometheus-stack/replacements/versions.yaml +++ b/manifests/function/kube-prometheus-stack/replacements/versions.yaml @@ -39,7 +39,7 @@ replacements: objref: kind: HelmRelease name: kube-prometheus-stack - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] # Images - source: diff --git a/manifests/function/logging-operator/replacements/versions.yaml b/manifests/function/logging-operator/replacements/versions.yaml index 3ec18a563..7bdd60fcd 100644 --- a/manifests/function/logging-operator/replacements/versions.yaml +++ b/manifests/function/logging-operator/replacements/versions.yaml @@ -39,7 +39,7 @@ replacements: objref: kind: HelmRelease name: logging-operator - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] # Logging-operator-logging Chart - source: @@ -61,7 +61,7 @@ replacements: objref: kind: HelmRelease name: logging-operator-logging - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] # Logging-operator Chart Image - source: diff --git a/manifests/function/prometheus-elasticsearch-exporter/helmrelease.yaml b/manifests/function/prometheus-elasticsearch-exporter/helmrelease.yaml new file mode 100644 index 000000000..ec50b677b --- /dev/null +++ b/manifests/function/prometheus-elasticsearch-exporter/helmrelease.yaml @@ -0,0 +1,17 @@ +apiVersion: "helm.toolkit.fluxcd.io/v2beta1" +kind: HelmRelease +metadata: + name: prometheus-elasticsearch-exporter +spec: + releaseName: prometheus-elasticsearch-exporter + interval: 5m + chart: + spec: + sourceRef: + kind: HelmRepository + name: prometheus-elasticsearch-exporter + interval: 1m + timeout: 5m + # Reference values at + # https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus-elasticsearch-exporter/values.yaml + values: {} diff --git a/manifests/function/prometheus-elasticsearch-exporter/helmrepository.yaml b/manifests/function/prometheus-elasticsearch-exporter/helmrepository.yaml new file mode 100644 index 000000000..df7d6945a --- /dev/null +++ b/manifests/function/prometheus-elasticsearch-exporter/helmrepository.yaml @@ -0,0 +1,6 @@ +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: HelmRepository +metadata: + name: prometheus-elasticsearch-exporter +spec: + interval: 10m diff --git a/manifests/function/prometheus-elasticsearch-exporter/kustomization.yaml b/manifests/function/prometheus-elasticsearch-exporter/kustomization.yaml new file mode 100644 index 000000000..25a9bbac8 --- /dev/null +++ b/manifests/function/prometheus-elasticsearch-exporter/kustomization.yaml @@ -0,0 +1,3 @@ +resources: + - helmrepository.yaml + - helmrelease.yaml diff --git a/manifests/function/prometheus-elasticsearch-exporter/replacements/kustomization.yaml b/manifests/function/prometheus-elasticsearch-exporter/replacements/kustomization.yaml new file mode 100644 index 000000000..ee1becf0d --- /dev/null +++ b/manifests/function/prometheus-elasticsearch-exporter/replacements/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - versions.yaml diff --git a/manifests/function/prometheus-elasticsearch-exporter/replacements/versions.yaml b/manifests/function/prometheus-elasticsearch-exporter/replacements/versions.yaml new file mode 100644 index 000000000..231550a56 --- /dev/null +++ b/manifests/function/prometheus-elasticsearch-exporter/replacements/versions.yaml @@ -0,0 +1,49 @@ +apiVersion: airshipit.org/v1alpha1 +kind: ReplacementTransformer +metadata: + name: prometheus-elasticsearch-exporter-versions-replacements + annotations: + config.kubernetes.io/function: |- + container: + image: quay.io/airshipit/replacement-transformer:v2 +replacements: +- source: + objref: + kind: VersionsCatalogue + name: versions-treasuremap + fieldref: "{.spec.helm_repositories.prometheus_community.url}" + target: + objref: + kind: HelmRepository + name: prometheus-elasticsearch-exporter + fieldrefs: ["{.spec.url}"] +- source: + objref: + kind: VersionsCatalogue + name: versions-treasuremap + fieldref: "{.spec.charts.prometheus_elasticsearch_exporter.chart}" + target: + objref: + kind: HelmRelease + name: prometheus-elasticsearch-exporter + fieldrefs: ["{.spec.chart.spec.chart}"] +- source: + objref: + kind: VersionsCatalogue + name: versions-treasuremap + fieldref: "{.spec.charts.prometheus_elasticsearch_exporter.version}" + target: + objref: + kind: HelmRelease + name: prometheus-elasticsearch-exporter + fieldrefs: ["{.spec.chart.spec.version}"] +- source: + objref: + kind: VersionsCatalogue + name: versions-treasuremap + fieldref: "{.spec.image_components.prometheus_elasticsearch_exporter.prometheus_elasticsearch_exporter}" + target: + objref: + kind: HelmRelease + name: prometheus-elasticsearch-exporter + fieldrefs: ["{.spec.values.image}"] diff --git a/manifests/function/thanos-operator/replacements/versions.yaml b/manifests/function/thanos-operator/replacements/versions.yaml index 982d0a4dc..3964b882d 100644 --- a/manifests/function/thanos-operator/replacements/versions.yaml +++ b/manifests/function/thanos-operator/replacements/versions.yaml @@ -37,7 +37,7 @@ replacements: objref: kind: HelmRelease name: thanos-operator - fieldrefs: ["{.spec.chart.version}"] + fieldrefs: ["{.spec.chart.spec.version}"] - source: objref: diff --git a/manifests/function/treasuremap-base-catalogues/versions-treasuremap.yaml b/manifests/function/treasuremap-base-catalogues/versions-treasuremap.yaml index 77bb4a950..a194fa933 100644 --- a/manifests/function/treasuremap-base-catalogues/versions-treasuremap.yaml +++ b/manifests/function/treasuremap-base-catalogues/versions-treasuremap.yaml @@ -52,6 +52,9 @@ spec: minio: chart: minio version: 8.0.10 + prometheus_elasticsearch_exporter: + chart: prometheus-elasticsearch-exporter + version: 4.4.0 thanos_operator: chart: thanos-operator version: 0.2.1 @@ -193,6 +196,10 @@ spec: mc: repository: minio/mc tag: RELEASE.2020-10-03T02-54-56Z + prometheus_elasticsearch_exporter: + prometheus_elasticsearch_exporter: + repository: justwatch/elasticsearch_exporter + tag: 1.1.0 thanos: thanos-operator: repository: banzaicloud/thanos-operator