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

Don't get Cluster API resource metrics in workload cluster #2372

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

anders-elastisys
Copy link
Contributor

Warning

This is a public repository, ensure not to disclose:

  • personal data beyond what is necessary for interacting with this pull request, nor
  • business confidential information, such as customer names.

What kind of PR is this?

Required: Mark one of the following that is applicable:

  • kind/feature
  • kind/improvement
  • kind/deprecation
  • kind/documentation
  • kind/clean-up
  • kind/bug
  • kind/other

Optional: Mark one or more of the following that are applicable:

Important

Breaking changes should be marked kind/admin-change or kind/dev-change depending on type
Critical security fixes should be marked with kind/security

  • kind/admin-change
  • kind/dev-change
  • kind/security
  • kind/adr

What does this PR do / why do we need this PR?

Noticed a bunch of error logs in my Cluster API workload cluster from kube-state-metrics pod:

E1217 14:47:13.509297       1 reflector.go:158] "Unhandled Error" err="pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:243: Failed to watch cluster.x-k8s.io/v1beta1, Kind=Machine: failed to list cluster.x-k8s.io/v1beta1, Kind=Machine: the server could not find the requested resource" logger="UnhandledError"

I do not believe we ever have Cluster API resources in the workload clusters so this PR removes the configuration for getting metrics for Cluster API resources in the workload cluster.

  • Fixes #

Information to reviewers

Checklist

  • Proper commit message prefix on all commits
  • Change checks:
    • The change is transparent
    • The change is disruptive
    • The change requires no migration steps
    • The change requires migration steps
    • The change upgrades CRDs
    • The change updates the config and the schema
  • Documentation checks:
  • Metrics checks:
    • The metrics are still exposed and present in Grafana after the change
    • The metrics names didn't change (Grafana dashboards and Prometheus alerts are not affected)
    • The metrics names did change (Grafana dashboards and Prometheus alerts were fixed)
  • Logs checks:
    • The logs do not show any errors after the change
  • Pod Security Policy checks:
    • Any changed pod is covered by Pod Security Admission
    • Any changed pod is covered by Gatekeeper Pod Security Policies
    • The change does not cause any pods to be blocked by Pod Security Admission or Policies
  • Network Policy checks:
    • Any changed pod is covered by Network Policies
    • The change does not cause any dropped packets in the NetworkPolicy Dashboard
  • Audit checks:
    • The change does not cause any unnecessary Kubernetes audit events
    • The change requires changes to Kubernetes audit policy
  • Falco checks:
    • The change does not cause any alerts to be generated by Falco
  • Bug checks:
    • The bug fix is covered by regression tests

@anders-elastisys anders-elastisys requested a review from a team December 17, 2024 14:54
@anders-elastisys anders-elastisys self-assigned this Dec 17, 2024
@anders-elastisys anders-elastisys requested a review from a team as a code owner December 17, 2024 14:54
@@ -91,6 +93,7 @@ templates:
kube-state-metrics-extra-resources:
inherit: [ template: prometheus ]
installed: {{ .Values | get "clusterApi.enabled" "false" }}
condition: ck8sManagementCluster.enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if both conditions are needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I would say so, the condition is so that this should only be released for the management cluster, while the installed part is dependent on whether or not it is a Cluster API environment which depends on configuration. I see we do this for some other releases as well, e.g. see this.

helmfile.d/stacks/monitoring-prometheus.yaml Outdated Show resolved Hide resolved
@anders-elastisys anders-elastisys force-pushed the anders-elastisys/wc-dont-get-capi-metrics branch from 0d1d0eb to f925d30 Compare December 23, 2024 13:10
@anders-elastisys anders-elastisys force-pushed the anders-elastisys/wc-dont-get-capi-metrics branch from f925d30 to 17466d0 Compare December 23, 2024 15:11
@anders-elastisys anders-elastisys force-pushed the anders-elastisys/wc-dont-get-capi-metrics branch from 17466d0 to ee1d821 Compare January 3, 2025 12:51
@anders-elastisys anders-elastisys merged commit 4e52119 into main Jan 3, 2025
12 checks passed
@anders-elastisys anders-elastisys deleted the anders-elastisys/wc-dont-get-capi-metrics branch January 3, 2025 13:09
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

Successfully merging this pull request may close these issues.

6 participants