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-state-metrics] Wrong apiVersion for PodDisruptionBudget #5131

Open
cyrilgdn opened this issue Jan 10, 2025 · 1 comment
Open

[kube-state-metrics] Wrong apiVersion for PodDisruptionBudget #5131

cyrilgdn opened this issue Jan 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@cyrilgdn
Copy link

cyrilgdn commented Jan 10, 2025

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

We enabled podDisruptionBudget in kube-state-metrics chart, when rendering the chart locally with helm template --kube-version 1.31.0, the apiVersion of the PodDisruptionBudget is wrongly set to policy/v1beta1 instead of policy/v1

$ helm template . --kube-version 1.31.0 | grep "apiVersion: policy"                                     
apiVersion: policy/v1beta1

What's your helm version?

version.BuildInfo{Version:"v3.16.3", GitCommit:"cfd07493f46efc9debd9cc1b02a0961186df7fdf", GitTreeState:"clean", GoVersion:"go1.22.7"}

What's your kubectl version?

Client Version: v1.31.4 Kustomize Version: v5.4.2 Server Version: v1.31.2-gke.1354000

Which chart?

kube-state-metrics

What's the chart version?

5.28.0 (tested on main too)

What happened?

When enabling the podDisprutionBudget, the generated apiVersion by helm template --kube-version 1.31.0 command is wrong (policy/v1beta1 instead of policy/v1 which was released many Kubernetes versions ago)

What you expected to happen?

By enabling podDisruptionBudget I expect the apiVersion of PodDisruptionBudget to be policy/v1 in the output of helm template --kube-version 1.31.0

Enter the changed values of values.yaml?

podDisruptionBudget:
  minAvailable: 1

Enter the command that you execute and failing/misfunctioning.

helm template . --kube-version 1.31.0 | grep "apiVersion: policy"                                     

Anything else we need to know?

It seems to be linked to this helm/helm#11809 but the conclusion is not clear to me 🤔

I don't know if it's proper fix but if we change this line:

{{ if $.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" -}}

by:

{{ if $.Capabilities.APIVersions.Has "policy/v1" -}}

the apiVersion is properly set to policy/v1

@cyrilgdn cyrilgdn added the bug Something isn't working label Jan 10, 2025
@DrFaust92
Copy link
Contributor

Helm template does not check capabilities as it needs to connect to a k8s cluster to check:

helm/helm#10760 (comment)

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

2 participants