Skip to content

Truncate secret annotation key

Mitchell Nielsen requested to merge 1026-truncate-checksum-annotation-key into master

Summary

Truncates the key used in the secret hash annotation, ensuring a maximum length of 63 characters per the Kubernetes spec.

Reference for helper function: https://stackoverflow.com/a/69549487

Closes #1026 (closed)

Changelog: fixed

Testing

Tests have been added to the codebase.

Additionally, with manual testing you can confirm in CI that the annotations still work as expected (none of them happen to have keys that exceed 63 characters):

$ kubectl get deploy -n de3b70a8-1026-truncate-checksum-annotation-key gitlab-toolbox -o yaml | yq .spec.template.metadata.annotations
checksum/config: 8b3957b632dd80eaa49bec0f21a9f9c58fb39af165c3bbdb8c4c743295e4f857
checksum/secret-gitlab-gitaly-secret: 1cec608d48fb4f022040f64042bcb557ec8a2e85b4d7ec14621ef839a21dad95
checksum/secret-gitlab-gitlab-kas-secret: 25ad1c1e4c1ee7dab949264c56d1876ee2d5e35a6aa416e6180e08ccba09f607
checksum/secret-gitlab-gitlab-shell-secret: 8e070a2f5d199d63e4d652285f3a4a9837595c16567bb80879a2e7dae3b02403
checksum/secret-gitlab-gitlab-suggested-reviewers: 370e003b8a399ea0ef5dfb3594a0cc3dd80f66a7718b500ae129a8605072b370
checksum/secret-gitlab-minio-secret: 27da0a2b7ae0bdc7e45d2294ee7160c29289ca3d295b747e53a54fa6e02499fa
checksum/secret-gitlab-postgresql-password: 0e15c6832738c7a0dd44662b86c1e32695ce9c6f93881f98788df552d6aca815
checksum/secret-gitlab-rails-secret: 63d9c5c08edd09bf08671e5d6d09c45560cb5dcc972d7c9526a757035e030a9e
checksum/secret-gitlab-redis-secret: f0f0235dc74a7041d9165a7894485f91092a83ebb180b344c703cc45c5af581d
checksum/secret-gitlab-registry-notification: ca8d26b45a042dfc760472731f4f13c58e147e7811412003daf1fc7bb6ca61d2
checksum/secret-gitlab-registry-secret: 8e73c967703b95affccc84ea401dcb9cd3cb47cee1c9632833438e0e5492f07e
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
Edited by Mitchell Nielsen

Merge request reports