kubernetes-sigs / descheduler

Descheduler for Kubernetes
https://sigs.k8s.io/descheduler
Apache License 2.0
4.26k stars 650 forks source link

helmchart install: CronJob in version "v1" cannot be handled as a CronJob #1226

Closed cayla closed 10 months ago

cayla commented 11 months ago

What version of descheduler are you using?

descheduler version: 0.28

Does this issue reproduce with the latest release?

Yes

Which descheduler CLI options are you using?

None

Please provide a copy of your descheduler policy config file

Stock helm chart. No options or args

What k8s version are you using (kubectl version)?

kubectl version Output
$ kubectl version
Client Version: v1.28.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.2

What did you do?

helm install my-release --namespace kube-system descheduler/deschedule

What did you expect to see?

NAME: test
LAST DEPLOYED: Thu Aug 24 10:00:55 2023
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Descheduler installed as a CronJob.

What did you see instead?

Error: INSTALLATION FAILED: 1 error occurred:
        * CronJob in version "v1" cannot be handled as a CronJob: json: cannot unmarshal object into Go struct field Container.spec.jobTemplate.spec.template.spec.containers.args of type string

I believe the issue is the unquoted (or unneeded) : in 0.28's charts/descheduler/templates/cronjob.yaml

- --policy-config-file: "/policy-dir/policy.yaml"

https://github.com/kubernetes-sigs/descheduler/compare/v0.27.1...descheduler-helm-chart-0.28.0#diff-644d004bc3a84952a3c2a97f5f57a85282a0bade5e1c5f124c7407c7788c217c

Without looking into the proper syntax of the command, if I remove the : from templates/cronjob.yaml and install from that, it succeeds.

alextricity25 commented 11 months ago

+1 I'm seeing the same thing. I also created an issue at the same time you did 😆 https://github.com/kubernetes-sigs/descheduler/issues/1227

Omar007 commented 11 months ago

Likewise. Looks like the problem is at https://github.com/kubernetes-sigs/descheduler/blob/33e9a52385394a3f4b2cb55bdf717fe52f1a852f/charts/descheduler/templates/cronjob.yaml#L71

Should have been

                - --policy-config-file=/policy-dir/policy.yaml

Just like it is in the deployment variant.

cayla commented 10 months ago

@Omar007 thanks for pointing that out. I also verified it against the documentation and it was the same there so I created a PR to resolve this.