Removing cluster leaves orphaned cluster application services
Summary
After K8s cluster with managed applications integration is removed. This applications services are left orphaned in database, and are displayed as active in Project's integrations section.
Steps to reproduce
- Pick K8s cluster with managed application installed on it
- Go to K8s cluster details section
- Remove k8s cluster integration
- Go to Projects associated to removed cluster Settings > integrations section
- Check state of integrations associated with managed applications which were installed to removed cluster
What is the current bug behavior?
/-/settings/integrations displays integration as active despise the cluster which host integrated application was removed.
What is the expected correct behavior?
Integration is inactive
Relevant logs and/or screenshots
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
Most likely starting cleanup before removing integration should solve this https://gitlab.com/gitlab-org/gitlab-foss/blob/master/app/services/clusters/destroy_service.rb#L13

