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

[Bug Report]: Service Monitor Missing Prometheus Release Lable #528

Open
3 of 4 tasks
luisvieirajs opened this issue Oct 7, 2024 · 4 comments
Open
3 of 4 tasks
Assignees

Comments

@luisvieirajs
Copy link

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the behavior

Affected Components

  • K8sGPT (CLI)
  • K8sGPT Operator

K8sGPT Version

0.2.0

Kubernetes Version

0.0.26

Host OS and its Version

No response

Steps to reproduce

helm upgrade --install k8sgpt
k8sgpt/k8sgpt-operator -n k8sgpt-operator-system
--create-namespace
--set serviceMonitor.enabled=true
--set grafanaDashboard.enabled=true
--wait

Expected behaviour

Deploy k8sgtp service monitor without prometheus label "release: prometheus" required by the prometheus service discovery

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
annotations:
meta.helm.sh/release-name: k8sgpt
meta.helm.sh/release-namespace: k8sgpt-operator-system
creationTimestamp: "2024-10-01T21:46:19Z"
generation: 1
labels:
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: k8sgpt-operator
app.kubernetes.io/instance: k8sgpt
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: k8sgpt-operator
app.kubernetes.io/part-of: k8sgpt-operator
app.kubernetes.io/version: 0.0.26
control-plane: controller-manager
helm.sh/chart: k8sgpt-operator-0.2.0

name: k8sgpt-k8sgpt-operator-controller-manager-metrics-monitor

Actual behaviour

No response

Additional Information

No response

@angelaaaaaaaw
Copy link

I manage to use below as workaround

kubectl -n k8sgpt-operator-system patch serviceMonitor release-k8sgpt-operator-controller-manager-metrics-monitor -p '{"metadata":{"labels":{"release":"prometheus"}}}' --type=merge

@luisvieirajs
Copy link
Author

This is an known workaround. Please don't respond This Bug Report with such solution. I am not looking for workarounds. I won't propose to a Enterprise client to automate their processes running command line stuff.

@nlamirault
Copy link
Contributor

@luisvieirajs you could use additionalLabels for that: https://github.com/k8sgpt-ai/k8sgpt-operator/blob/main/chart/operator/values.yaml#L8

serviceMonitor:
  enabled: true
  additionalLabels:
    release: prometheus

@AlexsJones AlexsJones added the bug Something isn't working label Dec 17, 2024
@AlexsJones AlexsJones self-assigned this Dec 17, 2024
@AlexsJones
Copy link
Member

@luisvieirajs you could use additionalLabels for that: https://github.com/k8sgpt-ai/k8sgpt-operator/blob/main/chart/operator/values.yaml#L8

serviceMonitor:
  enabled: true
  additionalLabels:
    release: prometheus

This is the recommended approach

@AlexsJones AlexsJones removed the bug Something isn't working label Dec 17, 2024
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

When branches are created from issues, their pull requests are automatically linked.

4 participants