k3s-io/helm-controller

modified helm install-job using the k8s dynamic admission controller by injecting some custom labels and annotations into it, causing the Helm Controller is error syncing constantly requeuing

lingbohome opened this issue · 2 comments

version: 0.12.3
the helm-install-job is constantly being deleted and rebuilt.
logs:
2023-04-24T03:47:33.121140867Z time="2023-04-24T03:47:33Z" level=error msg="error syncing 'demo0/hu002': handler helm-controller: DesiredSet - Replace Wait batch/v1, Kind=Job demo0/helm-install-hu002 for helm-controller demo0/hu002, requeuing

this is not the case with the helm-delete job, which can be modified by the k8s dynamic admission Controller and run normally until completion.

Is this a normal phenomenon? Or is there a way around it?

Yeah, the DesiredSet Apply code in the helm controller will see that the Job spec differs from the spec it is expecting, and will continue to apply the changes over and over again until the spec is in sync with what it wants. The delete job is a one-shot and is not reconciled.

What exactly is your admission controller changing on the Job? Do you have the option to exclude the helm controller jobs from being modified?

Hi, I see, thank you for your clarification.

Because I want to achieve some customized requirements without forking this repository, I adjusted the script in the klipper-helm image and made a custom klipper-helm image, so my admission controller add some custom labels and environment variables to helm controller jobs for scripts in klipper-helm.

I have adjusted the scheme, and my admission controller directly modifies the pod generated by the job, thus bypassing the sync and reconciled of the job by the helm controller.

After testing so far, no exceptions have been found, and helm charts can be installed, upgraded, and uninstalled normally