fix: Uninstall Chart from local node
In https://gitlab.com/gitlab-org/quality/gitlab-environment-toolkit/-/merge_requests/412, we introduced the following task:
- name: Uninstall GitLab Charts
community.kubernetes.helm:
name: gitlab
purge: true
when:
- cloud_native_hybrid_environment
tags: gitlab_charts
But I'm not sure the above actually is doing anything. Please point me where is my mistake when it comes to understanding this, assuming there is one.
When I look at the docs for community.kubernetes.helm, I see that purge
is the default anyways. So setting it to true
as we did doesn't seem to do anything. Since we are not adding anything else to the above task, we default to release_state: present
and I don't see how that can remove the deployed chart. My understanding is that the purge
is merely a flag, but something still needs to call delete
, which is I guess release_state: absent
.
Moreover, you see that I have moved the execution completely to a separate task. The reason is to run uninstall chart
only once, from localhost, the same way we are doing it for install chart
. Right now, we are running uninstall chart
from almost every node we have, which I guess is not ideal. If we can keep it in the same file but still run it only from localhost, that's even better.
Sample failed job with the old code: https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/instrumentor/-/jobs/1844340502#L109
Sample successfully run job with what this MR suggests: https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/instrumentor/-/jobs/1845772372#L95
Also, the full pipeline succeeded afterwards (removals) without manual intervention as the LB was indeed removed by the result of Helm release being uninstalled: https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/instrumentor/-/pipelines/421703985