diff --git a/manifests/composite/lma-infra/patches/kube-prometheus-stack.yaml b/manifests/composite/lma-infra/patches/kube-prometheus-stack.yaml index 340ef2424..3acbe8ff4 100644 --- a/manifests/composite/lma-infra/patches/kube-prometheus-stack.yaml +++ b/manifests/composite/lma-infra/patches/kube-prometheus-stack.yaml @@ -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: diff --git a/manifests/composite/monitoring-stack/README.md b/manifests/composite/monitoring-stack/README.md new file mode 100644 index 000000000..a711a350e --- /dev/null +++ b/manifests/composite/monitoring-stack/README.md @@ -0,0 +1,3 @@ +# Monitoring Stack + +This composite deploys the thanos-operator and grafana charts to allow for monitoring multiple prometheus instances diff --git a/manifests/composite/monitoring-stack/kustomization.yaml b/manifests/composite/monitoring-stack/kustomization.yaml new file mode 100644 index 000000000..ee73ed465 --- /dev/null +++ b/manifests/composite/monitoring-stack/kustomization.yaml @@ -0,0 +1,9 @@ +resources: + - ../../function/grafana + - ../../function/thanos-operator + +namespace: lma-infra + +patches: + - path: patches/grafana.yaml + - path: patches/thanos-operator.yaml diff --git a/manifests/composite/monitoring-stack/patches/grafana.yaml b/manifests/composite/monitoring-stack/patches/grafana.yaml new file mode 100644 index 000000000..269fe4c6d --- /dev/null +++ b/manifests/composite/monitoring-stack/patches/grafana.yaml @@ -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 diff --git a/manifests/composite/monitoring-stack/patches/thanos-operator.yaml b/manifests/composite/monitoring-stack/patches/thanos-operator.yaml new file mode 100644 index 000000000..656bb731f --- /dev/null +++ b/manifests/composite/monitoring-stack/patches/thanos-operator.yaml @@ -0,0 +1,7 @@ +apiVersion: "helm.toolkit.fluxcd.io/v2beta1" +kind: HelmRelease +metadata: + name: thanos-operator +data: + values: + nameOverride: lma-infra-thanos diff --git a/manifests/function/lma-configs/alerting/kustomization.yaml b/manifests/function/lma-configs/alerting/kustomization.yaml new file mode 100644 index 000000000..e584213cf --- /dev/null +++ b/manifests/function/lma-configs/alerting/kustomization.yaml @@ -0,0 +1 @@ +resources: [] diff --git a/manifests/function/lma-configs/kustomization.yaml b/manifests/function/lma-configs/kustomization.yaml new file mode 100644 index 000000000..2e59d8dc1 --- /dev/null +++ b/manifests/function/lma-configs/kustomization.yaml @@ -0,0 +1,6 @@ +resources: + - logging + - monitoring + - alerting + +namespace: lma-infra diff --git a/manifests/function/lma-configs/logging/kustomization.yaml b/manifests/function/lma-configs/logging/kustomization.yaml new file mode 100644 index 000000000..e584213cf --- /dev/null +++ b/manifests/function/lma-configs/logging/kustomization.yaml @@ -0,0 +1 @@ +resources: [] diff --git a/manifests/function/lma-configs/monitoring/kustomization.yaml b/manifests/function/lma-configs/monitoring/kustomization.yaml new file mode 100644 index 000000000..21ad71d9f --- /dev/null +++ b/manifests/function/lma-configs/monitoring/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - thanos diff --git a/manifests/function/lma-configs/monitoring/thanos/kustomization.yaml b/manifests/function/lma-configs/monitoring/thanos/kustomization.yaml new file mode 100644 index 000000000..fb2cf96f3 --- /dev/null +++ b/manifests/function/lma-configs/monitoring/thanos/kustomization.yaml @@ -0,0 +1,3 @@ +resources: + - lma-infra-thanos.yaml + - store-endpoints/lma-infra-prometheus.yaml diff --git a/manifests/function/lma-configs/monitoring/thanos/lma-infra-thanos.yaml b/manifests/function/lma-configs/monitoring/thanos/lma-infra-thanos.yaml new file mode 100644 index 000000000..34aa8eac6 --- /dev/null +++ b/manifests/function/lma-configs/monitoring/thanos/lma-infra-thanos.yaml @@ -0,0 +1,9 @@ +apiVersion: monitoring.banzaicloud.io/v1alpha1 +kind: Thanos +metadata: + name: lma-infra-thanos +spec: + queryDiscovery: true + query: {} + rule: {} + storeGateway: {} diff --git a/manifests/function/lma-configs/monitoring/thanos/store-endpoints/lma-infra-prometheus.yaml b/manifests/function/lma-configs/monitoring/thanos/store-endpoints/lma-infra-prometheus.yaml new file mode 100644 index 000000000..ef8b60e3c --- /dev/null +++ b/manifests/function/lma-configs/monitoring/thanos/store-endpoints/lma-infra-prometheus.yaml @@ -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 diff --git a/manifests/function/thanos-operator/helmrelease.yaml b/manifests/function/thanos-operator/helmrelease.yaml new file mode 100644 index 000000000..ce812c815 --- /dev/null +++ b/manifests/function/thanos-operator/helmrelease.yaml @@ -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 diff --git a/manifests/function/thanos-operator/helmrepository.yaml b/manifests/function/thanos-operator/helmrepository.yaml new file mode 100644 index 000000000..7a1eced55 --- /dev/null +++ b/manifests/function/thanos-operator/helmrepository.yaml @@ -0,0 +1,7 @@ +apiVersion: source.toolkit.fluxcd.io/v1beta1 +kind: HelmRepository +metadata: + name: banzaicloud +spec: + url: https://kubernetes-charts.banzaicloud.com + interval: 10m diff --git a/manifests/function/thanos-operator/kustomization.yaml b/manifests/function/thanos-operator/kustomization.yaml new file mode 100644 index 000000000..8829d5faa --- /dev/null +++ b/manifests/function/thanos-operator/kustomization.yaml @@ -0,0 +1,3 @@ +resources: + - helmrelease.yaml + - helmrepository.yaml diff --git a/manifests/site/test-site/target/lma-configs/kustomization.yaml b/manifests/site/test-site/target/lma-configs/kustomization.yaml new file mode 100644 index 000000000..0e3d56cc3 --- /dev/null +++ b/manifests/site/test-site/target/lma-configs/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - ../../../../function/lma-configs + +namespace: lma-infra \ No newline at end of file diff --git a/manifests/site/test-site/target/lma-stack/kustomization.yaml b/manifests/site/test-site/target/lma-stack/kustomization.yaml new file mode 100644 index 000000000..350b5aabe --- /dev/null +++ b/manifests/site/test-site/target/lma-stack/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - ../../../../composite/monitoring-stack + +namespace: lma-infra \ No newline at end of file diff --git a/manifests/type/airship-core/phases/lma-infra-target.yaml b/manifests/type/airship-core/phases/lma-infra-target.yaml index 047f43cce..ce8e79c53 100644 --- a/manifests/type/airship-core/phases/lma-infra-target.yaml +++ b/manifests/type/airship-core/phases/lma-infra-target.yaml @@ -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 diff --git a/manifests/type/airship-core/target/workload/kustomization.yaml b/manifests/type/airship-core/target/workload/kustomization.yaml index 6c51456ae..5e84d10fd 100644 --- a/manifests/type/airship-core/target/workload/kustomization.yaml +++ b/manifests/type/airship-core/target/workload/kustomization.yaml @@ -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 diff --git a/tools/deployment/40_deploy_lma.sh b/tools/deployment/40_deploy_lma.sh new file mode 100755 index 000000000..3054c57f9 --- /dev/null +++ b/tools/deployment/40_deploy_lma.sh @@ -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 +