Treasuremap Monitoring composite

This change adds a function for deploying banzaicloud/thanos-operator,
a composite which deploys grafana and a thanos querier,
and a phase documents for running this composite in the target cluster

This change includes a couple of thanos operator CRs, located in
function/lma-configs, which can be applied by running the phase
lma-configs

Change-Id: I406b45373b6029b2503e11883bb6aa91ebbac481
This commit is contained in:
Steven Fitzpatrick 2021-01-14 04:14:19 +00:00
parent 8674bb5a92
commit 7aef5fe7a7
20 changed files with 179 additions and 1 deletions

View File

@ -14,6 +14,12 @@ spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
podMetadata:
labels:
storeAPI: enabled
thanos:
image: quay.io/thanos/thanos:v0.17.2
version: v0.17.2
prometheusOperator:
admissionWebhooks:

View File

@ -0,0 +1,3 @@
# Monitoring Stack
This composite deploys the thanos-operator and grafana charts to allow for monitoring multiple prometheus instances

View File

@ -0,0 +1,9 @@
resources:
- ../../function/grafana
- ../../function/thanos-operator
namespace: lma-infra
patches:
- path: patches/grafana.yaml
- path: patches/thanos-operator.yaml

View File

@ -0,0 +1,36 @@
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: grafana
spec:
values:
adminUser: admin
adminPassword: changeme
defaultDashboardsEnabled: true
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: lma-infra-thanos
type: prometheus
url: lma-infra-thanos-query.lma-infra.svc.cluster.local:10902
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: default
orgId: 1
type: file
disableDeletion: false
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
logging:
gnetId: 7752
revision: 4
datasource: lma-infra-thanos
minio:
gnetId: 13502
revision: 4
datasource: lma-infra-thanos

View File

@ -0,0 +1,7 @@
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: thanos-operator
data:
values:
nameOverride: lma-infra-thanos

View File

@ -0,0 +1 @@
resources: []

View File

@ -0,0 +1,6 @@
resources:
- logging
- monitoring
- alerting
namespace: lma-infra

View File

@ -0,0 +1 @@
resources: []

View File

@ -0,0 +1,2 @@
resources:
- thanos

View File

@ -0,0 +1,3 @@
resources:
- lma-infra-thanos.yaml
- store-endpoints/lma-infra-prometheus.yaml

View File

@ -0,0 +1,9 @@
apiVersion: monitoring.banzaicloud.io/v1alpha1
kind: Thanos
metadata:
name: lma-infra-thanos
spec:
queryDiscovery: true
query: {}
rule: {}
storeGateway: {}

View File

@ -0,0 +1,10 @@
apiVersion: monitoring.banzaicloud.io/v1alpha1
kind: StoreEndpoint
metadata:
name: lma-infra-prometheus
spec:
thanos: lma-infra-thanos
selector:
labels:
app: prometheus
storeAPI: enabled

View File

@ -0,0 +1,21 @@
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: thanos-operator
spec:
releaseName: thanos-operator
interval: 5m
chart:
spec:
chart: thanos-operator
sourceRef:
kind: HelmRepository
name: banzaicloud
version: 0.1.0
interval: 1m
wait: false
timeout: 5m
# Reference values at
# https://github.com/banzaicloud/thanos-operator/blob/master/charts/thanos-operator/values.yaml
values:
manageCrds: false

View File

@ -0,0 +1,7 @@
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: banzaicloud
spec:
url: https://kubernetes-charts.banzaicloud.com
interval: 10m

View File

@ -0,0 +1,3 @@
resources:
- helmrelease.yaml
- helmrepository.yaml

View File

@ -0,0 +1,4 @@
resources:
- ../../../../function/lma-configs
namespace: lma-infra

View File

@ -0,0 +1,4 @@
resources:
- ../../../../composite/monitoring-stack
namespace: lma-infra

View File

@ -1,7 +1,7 @@
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: lma-infra-target
name: lma-infra
clusterName: target-cluster
config:
executorRef:
@ -9,3 +9,27 @@ config:
kind: KubernetesApply
name: kubernetes-apply
documentEntryPoint: target/lma-infra
---
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: lma-stack
clusterName: target-cluster
config:
executorRef:
apiVersion: airshipit.org/v1alpha1
kind: KubernetesApply
name: kubernetes-apply
documentEntryPoint: target/lma-stack
---
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: lma-configs
clusterName: target-cluster
config:
executorRef:
apiVersion: airshipit.org/v1alpha1
kind: KubernetesApply
name: kubernetes-apply
documentEntryPoint: target/lma-configs

View File

@ -1,5 +1,6 @@
resources:
- ../../../../../../airshipctl/manifests/function/airshipctl-base-catalogues
- ../../../../../../airshipctl/manifests/type/gating/target/workload
transformers:
- ../../../../../../airshipctl/manifests/type/gating/target/workload/ingress/replacements

View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -xe
echo "Deploying LMA stack"
airshipctl phase run --debug lma-infra
airshipctl phase run --debug lma-stack
airshipctl phase run --debug lma-configs