Fix consul cleanup removes service files
What does this MR do?
The cleanup of excess consul
watcher configs/scripts (introduced in !6747 (merged)) mistakenly touched service configurations as well. The cleanup now filters the available files, to only touch the desired watchers and scripts.
Related issues
Fixes #7717 (closed)
Relates !6747 (merged)
Test Plan
- Deploy GitLab (EE) with the following config:
consul['enable'] = true
consul['watchers'] = %(postgresql)
consul['services'] = [ 'postgresql' ]
consul['configuration'] = {
server: true,
retry_join: %w(127.0.0.1)
}
- Verify the files in
/var/opt/gitlab/consul/config.d/
:
-
/var/opt/gitlab/consul/config.d/
-
postgresql_service.json
=> was created -
watcher_postgresql.json
=> was created
-
- Run
gitlab-ctl reload
(or restart the container) with the following config:
consul['enable'] = true
consul['watchers'] = %(newpsql)
consul['internal']['postgresql_service_name'] = 'newpsql'
consul['configuration'] = {
server: true,
retry_join: %w(127.0.0.1)
}
- Verify that:
-
/var/opt/gitlab/consul/config.d/
-
watcher_postgresql.json
=> has been removed -
postgresql_service.json
=> was not deleted -
watcher_newpsql.json
=> was created
-
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion
Required
-
Merge Request Title, and Description are up to date, accurate, and descriptive -
MR targeting the appropriate branch -
MR has a green pipeline on GitLab.com -
Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks -
trigger-package
has a green pipeline running against latest commit
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Tests added -
Integration tests added to GitLab QA -
Equivalent MR/issue for the GitLab Chart opened
Edited by Clemens Beck