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

Is there anyway to write the helm install/upgrade result back to the status field of the HelmChart CR? #255

Open
codeReaper2001 opened this issue Nov 26, 2024 · 6 comments

Comments

@codeReaper2001
Copy link

codeReaper2001 commented Nov 26, 2024

I understand that helm-controller listens for changes to the HelmChart CR, converting it to the corresponding klipper-helm job to run the helm commands, but when I add the --wait parameter to the script in the klipper-helm image, the job changes to Completed status only if the helm installation/upgrade is complete.

I'm wondering if there's a way to write the successful installation or update message to the status field of HelmChart CR only when the job is Completed? Similar to how the Deployment Controller constantly listens to the status of the ReplicaSet resource and writes it to the corresponding deployment's status.

@codeReaper2001 codeReaper2001 changed the title Is there a way to write the helm install/upgrade result back to the status field of the HelmChart CR? Is there anyway to write the helm install/upgrade result back to the status field of the HelmChart CR? Nov 26, 2024
@brandond
Copy link
Member

Not at the moment, no. It would probably be necessary to copy the helm CLI output to the termination log file within the script, and then have the controller copy that from the job pod into the HelmChart status. Right now the helm controller doesn't look at the pod at all, only the job status.

@codeReaper2001
Copy link
Author

Not at the moment, no. It would probably be necessary to copy the helm CLI output to the termination log file within the script, and then have the controller copy that from the job pod into the HelmChart status. Right now the helm controller doesn't look at the pod at all, only the job status.

I think operations similar to the Controller.OnRemove function are in line with my expectations. After creating the corresponding job, check the status of the job (job.Status.Succeeded). If the status is not successful, an error will be returned, and the message will return to Queue, call the OnRemove function again. I was wondering if I could accomplish this by modifying the OnChange function?

image

@brandond
Copy link
Member

Yes but the job doesn't have what you want, the pod does.

@codeReaper2001
Copy link
Author

Yes but the job doesn't have what you want, the pod does.

Actually, I would like to detect the status of install/upgrade job to determine whether helm install/upgrade is successful or not. If this is the solution to use, can you suggest how I can modify it to achieve my purpose, can I modify the OnChange function to be able to achieve it?

@brandond
Copy link
Member

brandond commented Nov 27, 2024

You said you wanted "the successful installation or update message". This is command output, and currently only available in the pod log. You could modify the script that runs in the pod to also tee it to the termination message file, but even if you did that you'd still need to get it from the pod instead of the job.

Or are you changing your mind on what you're looking for?

If you just want to know if it succeeded or not, you can look at the job status conditions.

@codeReaper2001
Copy link
Author

You said you wanted "the successful installation or update message". This is command output, and currently only available in the pod log. You could modify the script that runs in the pod to also tee it to the termination message file, but even if you did that you'd still need to get it from the pod instead of the job.

Or are you changing your mind on what you're looking for?

If you just want to know if it succeeded or not, you can look at the job status conditions.

In fact, I plan to modify the klipper-helm image, which executes e.g. helm install xxx --wait, and the job becomes Succeeded only when the --wait execution completes.Based on this above, I would like to implement tracking of the job's status change by modifying the OnChange function to write the deployment completion status information into the HelmChart CR only when the job's status changes to Succeeded before writing the succeeded status information to the HelmChart CR.

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

No branches or pull requests

2 participants