From b2fa640327815fa8b9f7d35d5639b2172549fdb5 Mon Sep 17 00:00:00 2001 From: Mike Bell Date: Mon, 10 Jun 2024 14:16:42 +0100 Subject: [PATCH 1/3] docs: update migrate module runbook --- runbooks/source/move-components-module.html.md.erb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/runbooks/source/move-components-module.html.md.erb b/runbooks/source/move-components-module.html.md.erb index bfea48d5..77be7265 100644 --- a/runbooks/source/move-components-module.html.md.erb +++ b/runbooks/source/move-components-module.html.md.erb @@ -11,17 +11,19 @@ In order to migrate a terraform module from `components` into `core` there are a The aim is to make sure that when a terraform plan is run against both `core` and `compoents` after the MTM tool is ran there should be no terraform changes. -There is a pipeline in Concourse that accepts `$CLUSTER_NAME` and `$MODULE_NAME` setting these and running the pipeline will migrate that module on the cluster specified. +There is a pipeline in Concourse that accepts `$CLUSTER_NAME`, `$MODULE_NAME` and `$RESOURCE` setting these and running the pipeline will migrate that module/resource on the cluster specified. Resources can be passed as a comma seperated string. + +If you need to upgrade the `mtm` cli you can update the `$MTM_VERSION` parameter in the pipeline. The exact steps should follow: -1. Raise PR with migrated module -2. Update #cloud-platform informing the team about the module migration and to not make new PRs against `cloud-platform-infrastructure`. -3. Pause pipelines +1. Notify `#cloud-platform` that you are pausing concourse pipelines +2. Pause `bootstrap`, `live-2`, `manager` and `live` pipelines. +3. Raise PR with migrated module 4. Log in to Concourse using `fly -t moj-cp login -c https://concourse.cloud-platform.service.justice.gov.uk/` 5. Ensure your in the `cloud-platform-terraform-concourse` directory. -6. Update pipelines with module name and cluster name: - `fly -t moj-cp set-pipeline --pipeline migrate-module --config migrate-module.yaml -v cluster_name=$CLUSTER_NAME -v module=$MODULE_NAME` +6. Update pipelines with module and/or resources name and cluster name: + `fly -t moj-cp set-pipeline --pipeline migrate-module --config migrate-module.yaml -v cluster_name=cp-0306-0730 -v module=tigera_calico -v resources=kubectl_manifest.calico_crds,http.calico_crds` 7. Run `migrate-module` pipeline from the Concourse UI. 8. Unpause pipeline environment specific pipeline (e.g. live-2) 9. Re-run PR plan - the plan should show "No changes. Your infrastructure matches the configuration." From 50b32d49a90109b2c4ed0bf18513d115720958cd Mon Sep 17 00:00:00 2001 From: Mike Bell Date: Mon, 10 Jun 2024 14:53:06 +0100 Subject: [PATCH 2/3] docs: update how to get resources --- runbooks/source/move-components-module.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runbooks/source/move-components-module.html.md.erb b/runbooks/source/move-components-module.html.md.erb index 77be7265..a0a2d8e0 100644 --- a/runbooks/source/move-components-module.html.md.erb +++ b/runbooks/source/move-components-module.html.md.erb @@ -11,7 +11,7 @@ In order to migrate a terraform module from `components` into `core` there are a The aim is to make sure that when a terraform plan is run against both `core` and `compoents` after the MTM tool is ran there should be no terraform changes. -There is a pipeline in Concourse that accepts `$CLUSTER_NAME`, `$MODULE_NAME` and `$RESOURCE` setting these and running the pipeline will migrate that module/resource on the cluster specified. Resources can be passed as a comma seperated string. +There is a pipeline in Concourse that accepts `$CLUSTER_NAME`, `$MODULE_NAME` and `$RESOURCE` setting these and running the pipeline will migrate that module/resource on the cluster specified. Resources can be passed as a comma seperated string. Getting a list of resources to migrate is a manual process that requires you to read through the terraform files in `components`, some can be found by tracing back dependencies others should be obvious via there name. If you need to upgrade the `mtm` cli you can update the `$MTM_VERSION` parameter in the pipeline. From 0c720000fae97552a05f67e8a46c5b3014c04789 Mon Sep 17 00:00:00 2001 From: Mike Bell Date: Mon, 10 Jun 2024 14:57:20 +0100 Subject: [PATCH 3/3] docs: add resource name formatting --- runbooks/source/move-components-module.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runbooks/source/move-components-module.html.md.erb b/runbooks/source/move-components-module.html.md.erb index a0a2d8e0..c7d04e1d 100644 --- a/runbooks/source/move-components-module.html.md.erb +++ b/runbooks/source/move-components-module.html.md.erb @@ -11,7 +11,7 @@ In order to migrate a terraform module from `components` into `core` there are a The aim is to make sure that when a terraform plan is run against both `core` and `compoents` after the MTM tool is ran there should be no terraform changes. -There is a pipeline in Concourse that accepts `$CLUSTER_NAME`, `$MODULE_NAME` and `$RESOURCE` setting these and running the pipeline will migrate that module/resource on the cluster specified. Resources can be passed as a comma seperated string. Getting a list of resources to migrate is a manual process that requires you to read through the terraform files in `components`, some can be found by tracing back dependencies others should be obvious via there name. +There is a pipeline in Concourse that accepts `$CLUSTER_NAME`, `$MODULE_NAME` and `$RESOURCE` setting these and running the pipeline will migrate that module/resource on the cluster specified. Resources can be passed as a comma seperated string. Getting a list of resources to migrate is a manual process that requires you to read through the terraform files in `components`, some can be found by tracing back dependencies others should be obvious via there name. The name format for resources follow `$resource_type.$resource name` so `resource "kubernetes_storage_class" "storageclass"` becomes `kubernetes_storage_class.storageclass`, you can double check this by running `terraform state list`. If you need to upgrade the `mtm` cli you can update the `$MTM_VERSION` parameter in the pipeline.