Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to generate google managed prometheus kubernetes resources #23

Open
alxndr13 opened this issue Nov 27, 2024 · 2 comments
Open

Comments

@alxndr13
Copy link

alxndr13 commented Nov 27, 2024

We had the problem that we were using Google's Managed Prometheus and there is no API like prometheusrules.monitoring.coreos.com.

Instead they're using this CRD:

apiVersion: monitoring.googleapis.com/v1
kind: Rules
metadata:
  creationTimestamp: null
  labels:
    app.kubernetes.io/component: SLO
    app.kubernetes.io/managed-by: sloth

Currently we are now transforming the generated YAML, but it would be cool if we could generate it in place. They're also expecting an interval to be set for each group:

groups:
  - name: sloth-slo-sli-recordings-api-success-rate
    interval: 30s

So the thing is they don't differ that much, but it would be nice if we could generate it like with an additional option.

@cxdy
Copy link
Member

cxdy commented Dec 31, 2024

We don't use Google Managed Prometheus so I'm not entirely sure how we'd test this out but we can try to look into it.

Are you proposing a CLI flag to toggle this or something? Like ./sloth -i file.yaml --google?

@alxndr13
Copy link
Author

alxndr13 commented Jan 2, 2025

@cxdy yes something like this :)

i basically have it already done using yq.

    yq eval '
        del(.kind, .apiVersion) |
        .kind = "GlobalRules" |
        .apiVersion = "monitoring.googleapis.com/v1" |
        (.spec.groups[] |= . + {"interval": "30s"})

kind needs to be changed, apiVersion as well and the groups is missing an interval setting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants