From 86d081a0f398f97a17429eed132e08514c1b7526 Mon Sep 17 00:00:00 2001 From: Fernando Freire Date: Sat, 17 Sep 2022 09:46:20 -0700 Subject: [PATCH] feat(canary): refactor to split out dashboards and metrics Unfortunately Components don't compose as well as I'd like so we're unable to have features/canary and features/operations inheirt from the same Prometheus component. Hoping that some of this can be "linted" with conftest and at least point to potential issues w/ configuration --- features/canary/prometheus/kustomization.yml | 17 ------------- .../prometheus/kustomization.yml | 12 ++++++++++ .../prometheus/spinnaker-config.yml | 24 +++++++++---------- .../prometheus/spinnaker-dashboards.json | 0 third-party/README.md | 4 ++++ third-party/prometheus/kustomization.yml | 13 ++++++++++ .../prometheus/prometheus-grafana.yml | 0 7 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 features/operations/observability/prometheus/kustomization.yml rename accounts/metric-stores/patch-prometheus.yml => features/operations/observability/prometheus/spinnaker-config.yml (60%) rename features/{canary => operations/observability}/prometheus/spinnaker-dashboards.json (100%) create mode 100644 third-party/README.md create mode 100644 third-party/prometheus/kustomization.yml rename {features/canary => third-party}/prometheus/prometheus-grafana.yml (100%) diff --git a/features/canary/prometheus/kustomization.yml b/features/canary/prometheus/kustomization.yml index e38fc80..f6005b8 100644 --- a/features/canary/prometheus/kustomization.yml +++ b/features/canary/prometheus/kustomization.yml @@ -1,25 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1alpha1 kind: Component -resources: - - prometheus-grafana.yml - patchesStrategicMerge: - spinnaker-config.yml -configMapGenerator: - - name: grafana-dashboard-spinnaker - files: - - spinnaker-dashboards.json - -secretGenerator: - - name: prometheus-secrets - literals: - - grafanaDefaultUser=DefaultUser1! - - grafanaDefaultPassword=DefaultPass1! - -generatorOptions: - disableNameSuffixHash: true - transformers: - tfr-namespace-roles.yml diff --git a/features/operations/observability/prometheus/kustomization.yml b/features/operations/observability/prometheus/kustomization.yml new file mode 100644 index 0000000..e9ca298 --- /dev/null +++ b/features/operations/observability/prometheus/kustomization.yml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patchesStrategicMerge: + - spinnaker-config.yml + +configMapGenerator: + - name: grafana-dashboard-spinnaker + files: + - spinnaker-dashboards.json + options: + disableNameSuffixHash: true diff --git a/accounts/metric-stores/patch-prometheus.yml b/features/operations/observability/prometheus/spinnaker-config.yml similarity index 60% rename from accounts/metric-stores/patch-prometheus.yml rename to features/operations/observability/prometheus/spinnaker-config.yml index 0cffb1f..96232e8 100644 --- a/accounts/metric-stores/patch-prometheus.yml +++ b/features/operations/observability/prometheus/spinnaker-config.yml @@ -7,17 +7,17 @@ metadata: name: spinnaker spec: spinnakerConfig: - config: - metricStores: - prometheus: - enabled: true - add_source_metalabels: true + #config: + #metricStores: + #prometheus: + #enabled: true + #add_source_metalabels: true # # Config used if prometheus server discover pods through annotations -# service-settings: -# spinnaker: -# kubernetes: -# podAnnotations: -# prometheus.io/scrape: true -# prometheus.io/path: /prometheus_metrics -# prometheus.io/port: 8008 + service-settings: + spinnaker: + kubernetes: + podAnnotations: + prometheus.io/scrape: true + prometheus.io/path: /prometheus_metrics + prometheus.io/port: 8008 diff --git a/features/canary/prometheus/spinnaker-dashboards.json b/features/operations/observability/prometheus/spinnaker-dashboards.json similarity index 100% rename from features/canary/prometheus/spinnaker-dashboards.json rename to features/operations/observability/prometheus/spinnaker-dashboards.json diff --git a/third-party/README.md b/third-party/README.md new file mode 100644 index 0000000..598d7a2 --- /dev/null +++ b/third-party/README.md @@ -0,0 +1,4 @@ +# third-party + +This directory contains components that build or configure third-party tools +that interact with Spinnaker. diff --git a/third-party/prometheus/kustomization.yml b/third-party/prometheus/kustomization.yml new file mode 100644 index 0000000..415c3f5 --- /dev/null +++ b/third-party/prometheus/kustomization.yml @@ -0,0 +1,13 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +resources: + - prometheus-grafana.yml + +secretGenerator: + - name: prometheus-secrets + literals: + - grafanaDefaultUser=DefaultUser1! + - grafanaDefaultPassword=DefaultPass1! + options: + disableNameSuffixHash: true diff --git a/features/canary/prometheus/prometheus-grafana.yml b/third-party/prometheus/prometheus-grafana.yml similarity index 100% rename from features/canary/prometheus/prometheus-grafana.yml rename to third-party/prometheus/prometheus-grafana.yml