From c7f22d8136e713611eec79644620ceb427db1882 Mon Sep 17 00:00:00 2001 From: Arkadiusz Galwas Date: Fri, 22 Nov 2024 17:18:55 +0100 Subject: [PATCH] Readme updated --- hack/runtime-migrator/README.md | 60 +++++++++++++------------- hack/runtime-migrator/cmd/migration.go | 5 +-- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/hack/runtime-migrator/README.md b/hack/runtime-migrator/README.md index f0874ba4..84fafe7f 100644 --- a/hack/runtime-migrator/README.md +++ b/hack/runtime-migrator/README.md @@ -54,29 +54,29 @@ cat ./runtime-migrator \ ### Output example ``` -2024/11/21 14:53:24 INFO Starting runtime-migrator -2024/11/21 14:53:24 gardener-kubeconfig-path: /Users/myuser/gardener-kubeconfig.yml -2024/11/21 14:53:24 kcp-kubeconfig-path: /Users/myuser/kcp-kubeconfig.yml -2024/11/21 14:53:24 gardener-project-name: kyma-stage -2024/11/21 14:53:24 output-path: /tmp/ -2024/11/21 14:53:24 dry-run: true -2024/11/21 14:53:24 input-type: txt -2024/11/21 14:53:24 input-file-path: /Users/myuser/migrator-input/runtimeIds.txt -2024/11/21 14:53:24 -2024/11/21 14:53:24 INFO Migrating runtimes -2024/11/21 14:53:24 INFO Reading runtimeIds from input file -2024/11/21 14:53:29 INFO Runtime processed successfully runtimeID=1df09b5b-0347-459d-aa0a-715db8fcaad7 -2024/11/21 14:53:32 INFO Runtime processed successfully runtimeID=ea439a5e-aa59-4e3e-8bfb-9bab1b31371e -2024/11/21 14:53:33 INFO Runtime processed successfully runtimeID=d6eeafee-ffd5-4f23-97dc-a1df197b3b30 -2024/11/21 14:53:37 WARN Runtime CR can cause unwanted update in Gardener runtimeID=99a38a99-e8d7-4b98-a6f2-5a54ed389c4d -2024/11/21 14:53:37 ERROR Failed to find shoot: no shoot with given runtimeID found runtimeID=0a61a3c4-0ea8-4e39-860a-7853f0b6d180 -2024/11/21 14:53:40 ERROR Failed to verify runtime runtimeID=6daf5f59-b0ab-44af-bb8e-7735fd609449 -2024/11/21 14:53:40 INFO Migration completed. Successfully migrated runtimes: 3, Failed migrations: 2, Differences detected: 1 -2024/11/21 14:53:40 INFO Migration results saved in: /tmp/migration-2024-11-21T14:53:24+01:00/migration-results.json +2024/11/22 17:05:28 INFO Starting runtime-migrator +2024/11/22 17:05:28 gardener-kubeconfig-path: /Users/i326211/Downloads/kubeconfig-garden-kyma-stage.yaml +2024/11/22 17:05:28 kcp-kubeconfig-path: /Users/i326211/dev/config/sap +2024/11/22 17:05:28 gardener-project-name: kyma-stage +2024/11/22 17:05:28 output-path: /tmp/ +2024/11/22 17:05:28 dry-run: true +2024/11/22 17:05:28 input-type: txt +2024/11/22 17:05:28 input-file-path: /Users/i326211/dev/source/infrastructure-manager/hack/runtime-migrator/input/runtimes-stage-docs.txt +2024/11/22 17:05:28 +2024/11/22 17:05:33 INFO Migrating runtimes +2024/11/22 17:05:33 INFO Reading runtimeIds from input file +2024/11/22 17:05:43 INFO Runtime processed successfully runtimeID=1df09b5b-0347-459d-aa0a-715db8fcaad7 +2024/11/22 17:05:45 INFO Runtime processed successfully runtimeID=ea439a5e-aa59-4e3e-8bfb-9bab1b31371e +2024/11/22 17:05:49 INFO Runtime processed successfully runtimeID=d6eeafee-ffd5-4f23-97dc-a1df197b3b30 +2024/11/22 17:05:52 WARN Runtime CR can cause unwanted update in Gardener runtimeID=99a38a99-e8d7-4b98-a6f2-5a54ed389c4d +2024/11/22 17:05:52 ERROR Failed to fetch shoot: shoot was deleted or the runtime ID is incorrect runtimeID=0a61a3c4-0ea8-4e39-860a-7853f0b6d180 +2024/11/22 17:05:55 ERROR Failed to verify runtime runtimeID=6daf5f59-b0ab-44af-bb8e-7735fd609449 +2024/11/22 17:05:55 INFO Migration completed. Successfully migrated runtimes: 3, Failed migrations: 2, Differences detected: 1 +2024/11/22 17:05:55 INFO Migration results saved in: /tmp/migration-2024-11-22T17:05:33+01:00/migration-results.json ``` -The migration results are saved in the `/tmp/migration-2024-11-21T14:53:24+01:00/migration-results.json` file. -The runtime custom resources are saved in the `/tmp/migration-2024-11-21T14:53:24+01:00/runtimes` directory. +The migration results are saved in the `/tmp/migration-2024-11-22T17:05:33+01:00/migration-results.json` file. +The runtime custom resources are saved in the `/tmp/migration-2024-11-22T17:05:33+01:00/runtimes` directory. The `migration-results.json` file contains the following content: ```json @@ -85,40 +85,40 @@ The `migration-results.json` file contains the following content: "runtimeId": "1df09b5b-0347-459d-aa0a-715db8fcaad7", "shootName": "c-1228ddd", "status": "Success", - "runtimeCRFilePath": "/tmp/migration-2024-11-21T14:53:24+01:00/runtimes/1df09b5b-0347-459d-aa0a-715db8fcaad7.yaml" + "runtimeCRFilePath": "/tmp/migration-2024-11-22T17:05:33+01:00/runtimes/1df09b5b-0347-459d-aa0a-715db8fcaad7.yaml" }, { "runtimeId": "ea439a5e-aa59-4e3e-8bfb-9bab1b31371e", "shootName": "c3a59d5", "status": "Success", - "runtimeCRFilePath": "/tmp/migration-2024-11-21T14:53:24+01:00/runtimes/ea439a5e-aa59-4e3e-8bfb-9bab1b31371e.yaml" + "runtimeCRFilePath": "/tmp/migration-2024-11-22T17:05:33+01:00/runtimes/ea439a5e-aa59-4e3e-8bfb-9bab1b31371e.yaml" }, { "runtimeId": "d6eeafee-ffd5-4f23-97dc-a1df197b3b30", "shootName": "c141da7", "status": "Success", - "runtimeCRFilePath": "/tmp/migration-2024-11-21T14:53:24+01:00/runtimes/d6eeafee-ffd5-4f23-97dc-a1df197b3b30.yaml" + "runtimeCRFilePath": "/tmp/migration-2024-11-22T17:05:33+01:00/runtimes/d6eeafee-ffd5-4f23-97dc-a1df197b3b30.yaml" }, { "runtimeId": "99a38a99-e8d7-4b98-a6f2-5a54ed389c4d", "shootName": "c-71da0f2", "status": "ValidationDetectedUnwantedUpdate", - "errorMessage": "Runtime may cause unwanted update in Gardener", - "runtimeCRFilePath": "/tmp/migration-2024-11-21T14:53:24+01:00/runtimes/99a38a99-e8d7-4b98-a6f2-5a54ed389c4d.yaml", - "comparisonResultDirPath": "/tmp/migration-2024-11-21T14:53:24+01:00/comparison-results/99a38a99-e8d7-4b98-a6f2-5a54ed389c4d" + "errorMessage": "Runtime may cause unwanted update in Gardener. Please verify the runtime CR.", + "runtimeCRFilePath": "/tmp/migration-2024-11-22T17:05:33+01:00/runtimes/99a38a99-e8d7-4b98-a6f2-5a54ed389c4d.yaml", + "comparisonResultDirPath": "/tmp/migration-2024-11-22T17:05:33+01:00/comparison-results/99a38a99-e8d7-4b98-a6f2-5a54ed389c4d" }, { "runtimeId": "0a61a3c4-0ea8-4e39-860a-7853f0b6d180", "shootName": "", "status": "Error", - "errorMessage": "Failed to find shoot: no shoot with given runtimeID found" + "errorMessage": "Failed to fetch shoot: shoot was deleted or the runtime ID is incorrect" }, { "runtimeId": "6daf5f59-b0ab-44af-bb8e-7735fd609449", "shootName": "c-1f810d0", "status": "ValidationError", "errorMessage": "Failed to verify runtime: audit logs configuration not found: missing region: 'australiaeast' for providerType: 'azure'", - "runtimeCRFilePath": "/tmp/migration-2024-11-21T14:53:24+01:00/runtimes/6daf5f59-b0ab-44af-bb8e-7735fd609449.yaml" + "runtimeCRFilePath": "/tmp/migration-2024-11-22T17:05:33+01:00/runtimes/6daf5f59-b0ab-44af-bb8e-7735fd609449.yaml" } ] @@ -126,7 +126,7 @@ The `migration-results.json` file contains the following content: The following problems were detected in the above example: - The runtime with the `0a61a3c4-0ea8-4e39-860a-7853f0b6d180` identifier was not found ; the identifier may be incorrect, or the corresponding shoot was deleted for some reason. - The validation process for the runtime with the `6daf5f59-b0ab-44af-bb8e-7735fd609449` identifier failed. -- The runtime with the `99a38a99-e8d7-4b98-a6f2-5a54ed389c4d` identifier may cause an unwanted update in the Gardener. The comparison results are saved in the `/tmp/migration-2024-11-21T14:53:24+01:00/comparison-results/99a38a99-e8d7-4b98-a6f2-5a54ed389c4d` directory. +- The runtime with the `99a38a99-e8d7-4b98-a6f2-5a54ed389c4d` identifier may cause an unwanted update in the Gardener. The comparison results are saved in the `/tmp/migration-2024-11-22T17:05:33+01:00/comparison-results/99a38a99-e8d7-4b98-a6f2-5a54ed389c4d` directory. The `/tmp/migration-2024-11-21T14:53:24+01:00/comparison-results/99a38a99-e8d7-4b98-a6f2-5a54ed389c4d"` directory contains the following files: diff --git a/hack/runtime-migrator/cmd/migration.go b/hack/runtime-migrator/cmd/migration.go index 94f82905..152c26e3 100644 --- a/hack/runtime-migrator/cmd/migration.go +++ b/hack/runtime-migrator/cmd/migration.go @@ -164,18 +164,17 @@ main: return nil } -func getShoot(runtimeID string, shootList *v1beta1.ShootList) *v1beta1.Shoot { +func findShoot(runtimeID string, shootList *v1beta1.ShootList) *v1beta1.Shoot { for _, shoot := range shootList.Items { if shoot.Annotations[runtimeIDAnnotation] == runtimeID { return &shoot } } - return nil } func (m Migration) fetchShoot(ctx context.Context, shootList *v1beta1.ShootList, shootClient gardener_types.ShootInterface, runtimeID string) (*v1beta1.Shoot, error) { - shoot := getShoot(runtimeID, shootList) + shoot := findShoot(runtimeID, shootList) if shoot == nil { return nil, errors.New("shoot was deleted or the runtime ID is incorrect") }