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

[kube-prometheus-stack] Excluded from Enforcement wrong after rules split #4107

Closed
plnordquist opened this issue Dec 21, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@plnordquist
Copy link

Describe the bug a clear and concise description of what the bug is.

After PR #3883, the new resource rules are not excluded from enforcment as the PrometheusRule object uses dashes in the rule name and the excludedFromEnforcement item uses underscores. For example:

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: kube-prometheus-stack-k8s.rules.container-cpu-usage-seconds-tot
  namespace: <kube-prom-stack-ns>
  excludedFromEnforcement:
    - group: monitoring.coreos.com
      name: kube-prometheus-stack-k8s.rules.container_cpu_usage_seconds_tot
      namespace: <kube-prom-stack-ns>
      resource: prometheusrules

I think this also applies to the prometheusRulesExcludedFromEnforce list in the Prometheus object as well. For example:

  prometheusRulesExcludedFromEnforce:
    - ruleName: kube-prometheus-stack-k8s.rules.container_cpu_usage_seconds_tot
      ruleNamespace: <kube-prom-stack-ns>

I'm not sure the appropriate fix in this case since I think the rules.names tpl item is used outside of just the enforcement definitions. Maybe the PrometheusRule objects need to use underscores, but I think Kubernetes does not allow them in object names.

What's your helm version?

version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.20.7"}

What's your kubectl version?

Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.17", GitCommit:"22a9682c8fe855c321be75c5faacde343f909b04", GitTreeState:"clean", BuildDate:"2023-08-23T23:44:35Z", GoVersion:"go1.20.7", Compiler:"gc", Platform:"linux/amd64"} Kustomize Version: v4.5.4 Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.17", GitCommit:"22a9682c8fe855c321be75c5faacde343f909b04", GitTreeState:"clean", BuildDate:"2023-08-23T23:37:25Z", GoVersion:"go1.20.7", Compiler:"gc", Platform:"linux/amd64"}

Which chart?

kube-prometheus-stack

What's the chart version?

55.4.0

What happened?

When using enforcedNamespaceLabel: namespace the new split resource rules, these rules are not generated for all resources in the cluster due to the forced label.

What you expected to happen?

Resource rules work appropriately when trying to monitor a Kubernetes cluster.

How to reproduce it?

No response

Enter the changed values of values.yaml?

No response

Enter the command that you execute and failing/misfunctioning.

There is no command.

Anything else we need to know?

No response

@plnordquist plnordquist added the bug Something isn't working label Dec 21, 2023
@plnordquist
Copy link
Author

This ticket is solved by the duplicate issue #4350 and the associated PR #4351.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant