scality / metalk8s

An opinionated Kubernetes distribution with a focus on long-term on-prem deployments
Apache License 2.0
363 stars 45 forks source link

Migrate stored version of K8s objects after upgrade or downgrade #2060

Open gdemonet opened 5 years ago

gdemonet commented 5 years ago

Component: kubernetes

Why this is needed:

Today it is possible to create API objects (e.g., HPAs) in one version of Kubernetes, go through multiple upgrade cycles without touching those objects, and eventually arrive at a version of Kubernetes that can’t interpret the stored resource and crashes. See k8s.io/pr/52185.

See:

What should be done: Ensure all objects are stored in the "latest" version before and after any upgrade or downgrade.

Implementation proposal (strongly recommended):

Since we control the upgrade/downgrade of the cluster ourselves, it may not make sense to have an automatic migration in place. For the logic, get inspiration from the linked KEPs and controller. If StorageVersionHash is not available (before K8s 1.14), use the "old" approach to "get" + "replace" all objects.

Test plan:

NicolasT commented 4 years ago

https://github.com/kubernetes-sigs/kube-storage-version-migrator could be of use to get this done.