Skip to content

Commit fa95a60

Browse files
committed
add a link to cohabitating resources in comments
1 parent 1b7d9bc commit fa95a60

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pkg/apply/prune/prune.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ func (p *Pruner) Prune(
156156
// Remove the object from inventory if it was determined that the object should not be pruned,
157157
// because it had recently been applied. This probably means that the object is in the inventory
158158
// more than one time with a different group (e.g. kind Ingress and apiGroups networking.k8s.io & extensions)
159+
// due to being cohabitated: https://github.com/kubernetes/kubernetes/blob/v1.25.0/pkg/kubeapiserver/default_storage_factory_builder.go#L124-L131
159160
var deleteAfterApplyErr *filter.ApplyPreventedDeletionError
160161
if errors.As(filterErr, &deleteAfterApplyErr) {
161162
if !opts.DryRunStrategy.ClientOrServerDryRun() {

test/e2e/current_uid_filter_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ type: Warning
5151

5252
// Note this tests the scenario of "cohabitating" k8s objects (an object available via multiple apiGroups), but having the same UID.
5353
// As of k8s 1.25 an example of such "cohabitating" kinds is Event which is available via both "v1" and "events.k8s.io/v1".
54-
// When the user upgrades from one apiGroup to the other:
55-
// - should not result in object being pruned
54+
// See the full list of cohabitating resources on the storage level here:
55+
// - https://github.com/kubernetes/kubernetes/blob/v1.25.0/pkg/kubeapiserver/default_storage_factory_builder.go#L124-L131
56+
// We test that when the user upgrades their manifest from one cohabitated apiGroup to the other, then:
57+
// - it should not result in object being pruned
5658
// - object pruning should be skipped due to CurrentUIDFilter (even though a diff is found)
5759
// - inventory should not double-track the object i.e. we should hold reference only to the object with the groupKind that was most recently applied
5860
func currentUIDFilterTest(ctx context.Context, c client.Client, invConfig invconfig.InventoryConfig, inventoryName, namespaceName string) {

0 commit comments

Comments
 (0)