Delete unused resources
What does this MR do?
This MR deletes unused resources.
It catalogs the existing and desired managed resources and at the end of the reconciliation loop deletes the unused managed resources, i.e. those that exist but are not desired/required anymore.
This is done via an interface and helper functions to minimize the impact on the existing controller code. This is not ideal but they will be removed once we could replace it with the framework.
Testing
-
Deploy a GitLab instance using the Operator with the default list of components:
apiVersion: apps.gitlab.com/v1beta1 kind: GitLab metadata: name: issue-889 namespace: <the namespace that Operator watches> spec: chart: version: 7.1.2 values: global: hosts: domain: issue-889.<a real domain> ingress: class: nginx configureCertmanager: true certmanager-issuer: email: <a real email address>
-
Once GitLab resource is Available go ahead and edit the
.spec
and disable one of the components, e.g. KAS:... spec: chart: version: 7.1.2 values: global: kas: enabled: false ...
-
Wait for the changes to take effect and GitLab resource to become Available again.
-
Check KAS resources, e.g. its Deployment or ConfigMap. They still exist.
-
Change the controller manager image to the image that is built for this branch in
build_branch_image
job. Use image SHA for accuracy. You can do this by editing thegitlab-controller-manager
Deployment. -
Wait for the changes to take effect and GitLab resource become Available.
-
Check the logs of
manager
container forgitlab-controller-manager
Pod. You should seeObject deleted
messages at the end of the reconciliation loop. -
Check KAS resources, e.g. its Deployment or ConfigMap. They are gone.
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 -
When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Tests added (depends on &28) -
Integration tests added to GitLab QA -
Equivalent MR/issue for omnibus-gitlab opened -
Validate potential values for new configuration settings. Formats such as integer10
, duration10s
, URIscheme://user:passwd@host:port
may require quotation or other special handling when rendered in a template and written to a configuration file.
Related issues
Closes #889 (closed)
Closes #315 (closed)