github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/infrastructure/scripts/metadata-migration/Migration.md (about) 1 # Background 2 Kuberpult uses git-data (like time & author of a commit) and displays this in the UI. 3 This git-data requires parsing a long list of git commits, and is therefor slow and memory intensive. 4 We can improve this, by storing data explicitly, instead of relying on the git-history. 5 We do this anyway for some things like author. 6 * The releases script goes over all releases for all applications, and writes the commit date 7 (the date when this release was created) to a new file `created_at` 8 * The locks script goes over all env and app locks, removes the lock **file** and creates a **directory** 9 with the same name instead. Then it writes the commit date (the date when this lock was created) 10 as well as the author name and email and the message into files in the new lock directory. 11 * The scripts only create the files and do not add or push to GitHub. 12 13 The new kuberpult will only read the data in the new format and will ignore old data which is normally deleted by the script. 14 15 ## Deployment with Downtime 16 1) Shut down kuberpult: Delete StatefulSet 17 2) Write data to manifest repo, this could happen locally during downtime 18 * clone the manifests repository depends on where Kuberpult is deployed. 19 * cd and run the scripts in the top dir. 20 * Add the created files. and commit the changes to the manifests 21 repo (use a different branch to get approval first). 22 ```bash 23 git clone $MANIFEST_REPO 24 git checkout -b kuberpult_migrate 25 ./create-metadata-locks.sh 26 ./create-metadata-releases.sh 27 git add . 28 git commit -m "migration to new kuberpult" 29 git push 30 ``` 31 3) Merge and then Deploy new kuberpult version that reads new data