From 147787d4f6cd2cf351a08603f614d6e2e56fe0e8 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Tue, 11 Apr 2023 17:43:55 -0400 Subject: [PATCH] prometheus --- k8s/charts/templates/app-prometheus.yaml | 165 ++++++++++++----------- 1 file changed, 85 insertions(+), 80 deletions(-) diff --git a/k8s/charts/templates/app-prometheus.yaml b/k8s/charts/templates/app-prometheus.yaml index 98fafe3..cb5fcd4 100644 --- a/k8s/charts/templates/app-prometheus.yaml +++ b/k8s/charts/templates/app-prometheus.yaml @@ -1,81 +1,86 @@ -# {{- $prometheusHost := "monitor.core" -}} -# {{ if .Values.global.tls.enabled }} -# --- -# apiVersion: cert-manager.io/v1 -# kind: Certificate -# metadata: -# name: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" -# namespace: {{ .namespace }} -# spec: -# secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" -# issuerRef: -# kind: ClusterIssuer -# name: "{{ .Values.global.tls.issuer }}" -# commonName: "{{$prometheusHost}}.{{.Values.global.domain}}" -# dnsNames: -# - "{{$prometheusHost}}.{{.Values.global.domain}}" -# {{ end }} +{{- $prometheusHost := "monitor.core" -}} +{{- $prometheusNamespace := "monitor" -}} +--- +apiVersion: v1 +kind: Namespace +metadata: + name: {{ $prometheusNamespace }} -# --- -# apiVersion: argoproj.io/v1alpha1 -# kind: Application -# metadata: -# name: "monitoring-prometheus" -# namespace: "{{ .Release.Namespace }}" -# spec: -# project: meta-infrastructure -# source: -# chart: prometheus -# repoURL: "https://prometheus-community.github.io/helm-charts" -# targetRevision: "{{ .Values.chartVersions.prometheus }}" -# helm: -# releaseName: prometheus -# values: |- -# alertmanager: -# persistence: -# enabled: true -# size: 8Gi -# storageClass: "{{ .Values.global.nfsStorageClass }}" -# ingress: -# enabled: true -# ingressClassName: traefik -# annotations: {} -# hosts: -# - host: "{{$prometheusHost}}.{{ .Values.global.domain }}" -# paths: -# - path: /alertmanager -# pathType: Prefix -# {{ if .Values.global.tls.enabled }} -# tls: -# - secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" -# hosts: -# - "{{$prometheusHost}}.{{ .Values.global.domain }}" -# {{ end }} -# server: -# baseURL: "{{$prometheusHost}}.{{ .Values.global.domain }}" -# persistentVolume: -# enabled: true -# size: 8Gi -# storageClass: "{{ .Values.global.nfsStorageClass }}" -# ingress: -# enabled: true -# ingressClassName: traefik -# annotations: {} -# hosts: -# - "{{$prometheusHost}}.{{ .Values.global.domain }}" -# path: /prometheus -# pathType: Prefix -# {{ if .Values.global.tls.enabled }} -# tls: -# - secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" -# hosts: -# - "{{$prometheusHost}}.{{ .Values.global.domain }}" -# {{ end }} -# destination: -# server: https://kubernetes.default.svc -# namespace: "monitoring" -# syncPolicy: -# automated: -# selfHeal: true -# syncOptions: -# - CreateNamespace=true +{{ if .Values.global.tls.enabled }} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" + namespace: "{{ $prometheusNamespace }}" +spec: + secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" + issuerRef: + kind: ClusterIssuer + name: "{{ .Values.global.tls.issuer }}" + commonName: "{{$prometheusHost}}.{{.Values.global.domain}}" + dnsNames: + - "{{$prometheusHost}}.{{.Values.global.domain}}" +{{ end }} + +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: "monitoring-prometheus" + namespace: "{{ .Release.Namespace }}" +spec: + project: meta-infrastructure + source: + chart: prometheus + repoURL: "https://prometheus-community.github.io/helm-charts" + targetRevision: "{{ .Values.chartVersions.prometheus }}" + helm: + releaseName: prometheus + values: |- + alertmanager: + persistence: + enabled: true + size: 8Gi + storageClass: "{{ .Values.global.nfsStorageClass }}" + ingress: + enabled: true + ingressClassName: traefik + annotations: {} + hosts: + - host: "{{$prometheusHost}}.{{ .Values.global.domain }}" + paths: + - path: /alertmanager + pathType: Prefix +{{ if .Values.global.tls.enabled }} + tls: + - secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" + hosts: + - "{{$prometheusHost}}.{{ .Values.global.domain }}" +{{ end }} + server: + baseURL: "{{$prometheusHost}}.{{ .Values.global.domain }}" + persistentVolume: + enabled: true + size: 8Gi + storageClass: "{{ .Values.global.nfsStorageClass }}" + ingress: + enabled: true + ingressClassName: traefik + annotations: {} + hosts: + - "{{$prometheusHost}}.{{ .Values.global.domain }}" + path: /prometheus + pathType: Prefix +{{ if .Values.global.tls.enabled }} + tls: + - secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}" + hosts: + - "{{$prometheusHost}}.{{ .Values.global.domain }}" +{{ end }} + destination: + server: https://kubernetes.default.svc + namespace: {{ $prometheusNamespace }} + syncPolicy: + automated: + selfHeal: true