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

helm create produces hpa that fails linting #10816

Closed
b0n541 opened this issue Mar 31, 2022 · 5 comments
Closed

helm create produces hpa that fails linting #10816

b0n541 opened this issue Mar 31, 2022 · 5 comments

Comments

@b0n541
Copy link

b0n541 commented Mar 31, 2022

When I create a new Helm chart with helm create test-helm-chart the horizontal autoscaling manifest template gets created with apiVersion: autoscaling/v2beta1 in the hpa.yaml file. Strict linting works because autoscaling is not enabled by default in the values.yaml.

When I enable autoscaling by setting

autoscaling:
  enabled: true

in the values.yaml strict linting fails:

$ helm lint --strict test-helm-chart
==> Linting test-helm-chart
[INFO] Chart.yaml: icon is recommended
[WARNING] templates/hpa.yaml: autoscaling/v2beta1 HorizontalPodAutoscaler is deprecated in v1.22+, unavailable in v1.25+; use autoscaling/v2 HorizontalPodAutoscaler

Error: 1 chart(s) linted, 1 chart(s) failed

The linting should not fail here because my Kubernetes version still supports autoscaling/v2beta1 perfectly fine. It seems that Helm is not recognizing the Kubernetes versions returned by kubectl at all. I tried different setups with kubectl client version 1.20, 1.22 and 1.23 and Kubernetes server version 1.20 and 1.22. In all cases the strict linting fails. I think it should only fail if either the client or the server version returns v1.22+.

Output of helm version:

version.BuildInfo{Version:"v3.8.1", GitCommit:"5cb9af4b1b271d11d7a97a71df3ac337dd94ad37", GitTreeState:"clean", GoVersion:"go1.17.5"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:59:43Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.9", GitCommit:"7a576bc3935a6b555e33346fd73ad77c925e9e4a", GitTreeState:"clean", BuildDate:"2021-07-15T20:56:38Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.):

Minikube, AKS

@b0n541
Copy link
Author

b0n541 commented Mar 31, 2022

Maybe you can think of introducing a new command line option to define the version for the target Kubernetes?

@yxxhero
Copy link
Member

yxxhero commented Mar 31, 2022

@b0n541 when helm lint. helm don't get k8s version form the k8s cluster. it from client-go's version in go.mod.
I thinks you idea is good. Welcome to create a PR for this.

@b0n541
Copy link
Author

b0n541 commented Mar 31, 2022

Just found this: #10677

This would exactly be the new feature I would like to see.

@Carpenter0100
Copy link

running into the same situation.

@github-actions
Copy link

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

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

No branches or pull requests

3 participants