prom-loki
Composition
Monitoring
The following resources are composed to implement the referenced Composite Resource Definition (XRD).
ProviderConfig
Release
Release
Release
kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
name: prom-loki
creationTimestamp: null
labels:
alert: alert-manager
dashboard: grafana
log: loki
monitor: prometheus
spec:
compositeTypeRef:
apiVersion: devopstoolkitseries.com/v1alpha1
kind: Monitoring
patchSets:
- name: metadata
patches:
- fromFieldPath: metadata.labels
resources:
- name: helm
base:
apiVersion: helm.crossplane.io/v1beta1
kind: ProviderConfig
spec:
credentials:
source: InjectedIdentity
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
readinessChecks:
- type: None
- name: prometheus
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: prometheus
repository: https://prometheus-community.github.io/helm-charts
version: 15.5.3
set:
- name: server.ingress.enabled
value: "true"
- name: server.ingress.hosts[0]
- name: alertmanager.ingress.enabled
value: "true"
- name: alertmanager.ingress.hosts[0]
rollbackLimit: 3
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-prometheus"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.parameters.namespace
toFieldPath: spec.forProvider.namespace
- fromFieldPath: spec.parameters.monitor.host
toFieldPath: spec.forProvider.set[1].value
- fromFieldPath: spec.parameters.alert.host
toFieldPath: spec.forProvider.set[3].value
- type: ToCompositeFieldPath
fromFieldPath: spec.forProvider.set[1].value
toFieldPath: status.monitorHost
- type: ToCompositeFieldPath
fromFieldPath: spec.forProvider.set[3].value
toFieldPath: status.alertHost
- name: loki
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: loki-stack
repository: https://grafana.github.io/helm-charts
version: 2.6.1
rollbackLimit: 3
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-loki"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.parameters.namespace
toFieldPath: spec.forProvider.namespace
- name: grafana
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: grafana
repository: https://grafana.github.io/helm-charts
version: 6.23.0
set:
- name: ingress.enabled
value: "true"
- name: ingress.hosts[0]
values:
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- disableDeletion: false
editable: true
folder: ""
name: default
options:
path: /var/lib/grafana/dashboards/default
orgId: 1
type: file
dashboards:
default:
prometheus-cluster:
datasource: Prometheus
gnetId: 6417
revision: 1
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- isDefault: true
name: Prometheus
type: prometheus
url: http://monitoring-prometheus-server
- isDefault: false
name: Loki
type: loki
url: http://monitoring-loki:3100
rollbackLimit: 3
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-grafana"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.parameters.namespace
toFieldPath: spec.forProvider.namespace
- fromFieldPath: spec.parameters.dashboard.host
toFieldPath: spec.forProvider.set[1].value
- type: ToCompositeFieldPath
fromFieldPath: spec.forProvider.set[1].value
toFieldPath: status.dashboardHost