Loki crds
PR Description
Which issue(s) this PR fixes
Fixes #3395
Notes to the Reviewer
Copied #2604 basically.
Would remove the 404 skip check when #9489 closes on the loki repo.
Had to use - to seperate rule groups/namespaces, / was not properly passing through the routes, it appears loki needs to align with mimir to handle those, loki is just using Path while mimir is using PathPrefix.
PR Checklist
- [x] CHANGELOG updated
- [x] Documentation added
- [x] Tests updated
Hey @EStork09 how's it going? 👋 Would you have the time to look through the docs suggestions and rebase so we can move ahead with this?
@tpaschalis sorry, I have just recently relocated to Europe, I will try to get to this when I can
To avoid duplicating so much code it should be possible to put some in the common kubernetes pkg. The client part could also use a common pkg. But we can do this via a follow-up PR and focus on getting this one merged
I tested it and it works: I created a local k8s cluster with the agent using the helm chart and the prometheus operator. Then I created the following rule:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
creationTimestamp: null
labels:
prometheus: example
role: alert-rules
name: prometheus-example-rules
spec:
groups:
- name: ./example.rules
rules:
- alert: ExampleAlert
expr: rate({job="test", container="my-app"} |= "error" [5m]) > 5
and with this component:
loki.rules.kubernetes "hello" {
address = "loki-url"
basic_auth {
username = "username"
password = "token"
}
}
It successfully pushed the alert to my grafana cloud stack:
Thansk again @EStork09 and sorry it took so long!