kubernetes-sigs/cluster-api

Prevent removal of apiVersions while they are still used

開放

#8,566 建立於 2023年4月25日

 (29 則留言) (0 個反應) (1 位負責人)Go (1,532 個分叉)auto 404
area/apihelp wantedkind/featurepriority/important-longtermtriage/accepted

倉庫指標

星標
 (4,267 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

What would you like to be added (User Story)?

As a user it would be nice if Cluster API would block removal of apiVersions of CRDs as long as they are still used.

Detailed Description

Today it is possible that during a Cluster API upgrade (e.g. when bumping an infra provider) an apiVersion is removed. If this apiVersion was still referenced in other resources, they won't reconcile anymore.

Affected resources:

  • ClusterClass
  • Cluster, MD, MS, Machine, ...
    • Refs are probably not affected as they don't actually use the apiVersion from the object spec (they calculate the version they use based on the contract label on the CRD).
      • Would be good to double check this again.
    • OwnerRefs
      • They might not be super relevant as our controllers always keep the ownerRefs up-to-date

A possible solution is to implement a webhook which validates CRD updates. In this webhook we could check if the update on the CRD removes an apiVersion which is still referenced in relevant resources (at least ClusterClass).

Note: This webhook should probably have failurePolicy: Ignore to avoid deadlocks if Cluster API is not working for some reason.

Anything else you would like to add?

Somewhat related: https://github.com/kubernetes-sigs/cluster-api/issues/6539 (as it might lead to us dropping apiVersion from all our refs except the ones in ClusterClass)

Label(s) to be applied

/kind feature One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels.

貢獻者指南