From 9cdafa8ae5ccf0d1ef95a8cf763d5cdd6509db82 Mon Sep 17 00:00:00 2001 From: Massaki Archambault Date: Thu, 19 Sep 2024 00:14:40 -0400 Subject: [PATCH] upgrade prometheus-operator and replace additional_scrape_config with ScrapeConfig --- .../bases/grafana/grafana-deployment.yaml | 8 ++++-- .../bundle/kustomization.yaml | 12 -------- .../bundle/patches/alertmanagerconfigs.yaml | 5 ---- .../bundle/patches/alertmanagers.yaml | 5 ---- .../bundle/patches/podmonitors.yaml | 5 ---- .../bundle/patches/probes.yaml | 5 ---- .../bundle/patches/prometheuses.yaml | 5 ---- .../bundle/patches/prometheusrules.yaml | 5 ---- .../bundle/patches/servicemonitors.yaml | 5 ---- .../bundle/patches/thanosrulers.yaml | 5 ---- .../prometheus-operator/kustomization.yaml | 5 +--- kustomize/bases/prometheus/kustomization.yaml | 8 +++--- .../kustomizeconfig/namereference.yaml | 4 +-- kustomize/bases/prometheus/prometheus.yaml | 9 ++++-- .../prometheus/prometheus-additional.yaml | 4 --- kustomize/env/prod/kustomization.yaml | 16 ++++++----- .../resources/prometheus/scrapeconfig.yaml | 28 +++++++++++++++++++ 17 files changed, 56 insertions(+), 78 deletions(-) delete mode 100644 kustomize/bases/prometheus-operator/bundle/kustomization.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/probes.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml delete mode 100644 kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml delete mode 100644 kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml create mode 100644 kustomize/env/prod/resources/prometheus/scrapeconfig.yaml diff --git a/kustomize/bases/grafana/grafana-deployment.yaml b/kustomize/bases/grafana/grafana-deployment.yaml index 0171877..89d7a9e 100644 --- a/kustomize/bases/grafana/grafana-deployment.yaml +++ b/kustomize/bases/grafana/grafana-deployment.yaml @@ -37,8 +37,12 @@ spec: configMapKeyRef: name: kustomize-generated-config key: GRAFANA_EXTERNAL_URL - # - name: GF_AUTH_ANONYMOUS_ENABLED - # value: "true" + - name: GF_AUTH_ANONYMOUS_ENABLED + value: "true" + - name: GF_AUTH_ANONYMOUS_ORG_NAME + value: public + - name: GF_AUTH_ANONYMOUS_ORG_ROLE + value: Viewer - name: GF_INSTALL_PLUGINS value: marcusolsson-json-datasource,marcusolsson-treemap-panel - name: GF_FEATURE_TOGGLES_ENABLE diff --git a/kustomize/bases/prometheus-operator/bundle/kustomization.yaml b/kustomize/bases/prometheus-operator/bundle/kustomization.yaml deleted file mode 100644 index cb9e226..0000000 --- a/kustomize/bases/prometheus-operator/bundle/kustomization.yaml +++ /dev/null @@ -1,12 +0,0 @@ -resources: - - https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.63.0/bundle.yaml - -patches: - - path: patches/alertmanagerconfigs.yaml - - path: patches/alertmanagers.yaml - - path: patches/podmonitors.yaml - - path: patches/probes.yaml - - path: patches/prometheuses.yaml - - path: patches/prometheusrules.yaml - - path: patches/servicemonitors.yaml - - path: patches/thanosrulers.yaml \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml b/kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml deleted file mode 100644 index 4ecfc2c..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: alertmanagerconfigs.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml b/kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml deleted file mode 100644 index cb8dad9..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: alertmanagers.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml b/kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml deleted file mode 100644 index 7ab9b1a..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: podmonitors.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/probes.yaml b/kustomize/bases/prometheus-operator/bundle/patches/probes.yaml deleted file mode 100644 index 5aa9bde..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/probes.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: probes.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml b/kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml deleted file mode 100644 index 0e2c6a3..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: prometheuses.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml b/kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml deleted file mode 100644 index 7d6399a..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: prometheusrules.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml b/kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml deleted file mode 100644 index c9005bf..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: servicemonitors.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml b/kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml deleted file mode 100644 index 0cdb537..0000000 --- a/kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml +++ /dev/null @@ -1,5 +0,0 @@ -$patch: delete -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: thanosrulers.monitoring.coreos.com diff --git a/kustomize/bases/prometheus-operator/kustomization.yaml b/kustomize/bases/prometheus-operator/kustomization.yaml index 204dcb4..f0b8f57 100644 --- a/kustomize/bases/prometheus-operator/kustomization.yaml +++ b/kustomize/bases/prometheus-operator/kustomization.yaml @@ -1,8 +1,5 @@ resources: - - bundle/ - - https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.63.0/stripped-down-crds.yaml - -namespace: kube-system + - https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.76.2/bundle.yaml commonLabels: app.kubernetes.io/part-of: monitoring \ No newline at end of file diff --git a/kustomize/bases/prometheus/kustomization.yaml b/kustomize/bases/prometheus/kustomization.yaml index 5069beb..fa6e20a 100644 --- a/kustomize/bases/prometheus/kustomization.yaml +++ b/kustomize/bases/prometheus/kustomization.yaml @@ -16,10 +16,10 @@ secretGenerator: literals: - username=changeme - password=changeme - - name: additional-scrape-configs - behavior: create - literals: - - prometheus-additional.yaml= + # - name: additional-scrape-configs + # behavior: create + # literals: + # - prometheus-additional.yaml= configMapGenerator: - name: kustomize-generated-config diff --git a/kustomize/bases/prometheus/kustomizeconfig/namereference.yaml b/kustomize/bases/prometheus/kustomizeconfig/namereference.yaml index 4d7a8f5..6df1670 100644 --- a/kustomize/bases/prometheus/kustomizeconfig/namereference.yaml +++ b/kustomize/bases/prometheus/kustomizeconfig/namereference.yaml @@ -5,5 +5,5 @@ nameReference: path: spec/remoteWrite/basicAuth/username/name - kind: Prometheus path: spec/remoteWrite/basicAuth/password/name - - kind: Prometheus - path: spec/additionalScrapeConfigs/name + # - kind: Prometheus + # path: spec/additionalScrapeConfigs/name diff --git a/kustomize/bases/prometheus/prometheus.yaml b/kustomize/bases/prometheus/prometheus.yaml index b4a9549..08f15e9 100644 --- a/kustomize/bases/prometheus/prometheus.yaml +++ b/kustomize/bases/prometheus/prometheus.yaml @@ -18,9 +18,12 @@ spec: probeSelector: matchLabels: monitor: prometheus - additionalScrapeConfigs: - name: additional-scrape-configs - key: prometheus-additional.yaml + scrapeConfigSelector: + matchLabels: + monitor: prometheus + # additionalScrapeConfigs: + # name: additional-scrape-configs + # key: prometheus-additional.yaml # remoteWrite: # - url: changeme # basicAuth: diff --git a/kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml b/kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml deleted file mode 100644 index da94e1c..0000000 --- a/kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- job_name: additional/bastion-haproxy - static_configs: - - targets: ["192.168.20.10:8080"] - \ No newline at end of file diff --git a/kustomize/env/prod/kustomization.yaml b/kustomize/env/prod/kustomization.yaml index 774b9ba..b30ecdf 100644 --- a/kustomize/env/prod/kustomization.yaml +++ b/kustomize/env/prod/kustomization.yaml @@ -9,6 +9,8 @@ resources: - ../../overlays/actual - ../../overlays/llm + - resources/prometheus/scrapeconfig.yaml + buildMetadata: - originAnnotations @@ -45,13 +47,13 @@ images: - name: ghcr.io/sillytavern/sillytavern newTag: 1.12.4 -secretGenerator: - - name: prometheus-additional-scrape-configs - type: Opaque - namespace: monitoring - behavior: replace - files: - - prometheus-additional.yaml=configurations/prometheus/prometheus-additional.yaml +# secretGenerator: +# - name: prometheus-additional-scrape-configs +# type: Opaque +# namespace: monitoring +# behavior: replace +# files: +# - prometheus-additional.yaml=configurations/prometheus/prometheus-additional.yaml # allow "kubectl apply -l app.kubernetes.io/managed-by=kustomize --prune ..." commonLabels: diff --git a/kustomize/env/prod/resources/prometheus/scrapeconfig.yaml b/kustomize/env/prod/resources/prometheus/scrapeconfig.yaml new file mode 100644 index 0000000..6a9e577 --- /dev/null +++ b/kustomize/env/prod/resources/prometheus/scrapeconfig.yaml @@ -0,0 +1,28 @@ +apiVersion: monitoring.coreos.com/v1alpha1 +kind: ScrapeConfig +metadata: + name: static-config + namespace: monitoring + labels: + monitor: prometheus +spec: + staticConfigs: + - labels: + job: external/bastion-haproxy + targets: + - 192.168.20.10:8080 + - labels: + job: external/node_exporter + targets: + - 192.168.10.10:9100 + - 192.168.10.11:9100 + - 192.168.10.12:9100 + - 192.168.20.21:9100 + - 192.168.20.22:9100 + - 192.168.20.23:9100 + - 192.168.20.24:9100 + - labels: + job: external/satisfactory-server + targets: + - 192.168.20.31:9777 + - 192.168.20.31:9100 \ No newline at end of file