Add job to clean up GCP network resources
requested to merge 211579-gcp-firewall-rule-and-forwarding-rule-quota-gitlab-review-apps into master
What does this MR do?
Adds a script to clean up dangling GCP network resources related to review apps:
- firewall rules
- forwarding rules
- target pools
- health checks
Adds a job to run the clean up script that:
- runs on scheduled pipelines
- runs manually on MR pipelines
Screenshots
Example job: https://gitlab.com/gitlab-org/gitlab/-/jobs/490425163
Output of script:
$ gcp_cleanup
** Inspecting forwarding rule a00ab062f5fca11ea8ae742010af001c **
Queuing forwarding rule, firewall rule, target pool and health check for a00ab062f5fca11ea8ae742010af001c to be cleaned up
** Deleting firewall rules: **
k8s-a00ab062f5fca11ea8ae742010af001c-http-hc k8s-fw-a00ab062f5fca11ea8ae742010af001c
Deleted [https://www.googleapis.com/compute/v1/projects/gitlab-review-apps/global/firewalls/k8s-a00ab062f5fca11ea8ae742010af001c-http-hc].
Deleted [https://www.googleapis.com/compute/v1/projects/gitlab-review-apps/global/firewalls/k8s-fw-a00ab062f5fca11ea8ae742010af001c].
** Deleting forwarding rules: **
a00ab062f5fca11ea8ae742010af001c
Deleted [https://www.googleapis.com/compute/v1/projects/gitlab-review-apps/regions/us-central1/forwardingRules/a00ab062f5fca11ea8ae742010af001c].
** Deleting target pools: **
a00ab062f5fca11ea8ae742010af001c
Deleted [https://www.googleapis.com/compute/v1/projects/gitlab-review-apps/regions/us-central1/targetPools/a00ab062f5fca11ea8ae742010af001c].
** Deleting http health checks: **
a00ab062f5fca11ea8ae742010af001c
Deleted [https://www.googleapis.com/compute/v1/projects/gitlab-review-apps/global/httpHealthChecks/a00ab062f5fca11ea8ae742010af001c].
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
TODO before merging:
-
Add GCP_REGION
to CI environment -us-central1
Edited by Albert Salim