Skip to content

Commit b6dfd40

Browse files
Upgrade boxcutter to v0.13.1 and remove collision detection workaround (#2637)
Boxcutter v0.13.1 includes the fix from package-operator/boxcutter#501 which ensures collision detection runs before revision linearity checks. This allows us to remove the foreignRevisionController workaround that was manually detecting ActionProgressed objects owned by foreign ClusterExtensions. Assisted-by: Claude
1 parent a34d269 commit b6dfd40

File tree

5 files changed

+11
-59
lines changed

5 files changed

+11
-59
lines changed

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ require (
3838
k8s.io/api v0.35.3
3939
k8s.io/apiextensions-apiserver v0.35.3
4040
k8s.io/apimachinery v0.35.3
41-
k8s.io/apiserver v0.35.2
41+
k8s.io/apiserver v0.35.3
4242
k8s.io/cli-runtime v0.35.1
4343
k8s.io/client-go v1.5.2
44-
k8s.io/component-base v0.35.2
44+
k8s.io/component-base v0.35.3
4545
k8s.io/klog/v2 v2.140.0
4646
k8s.io/kubernetes v1.35.0
4747
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5
48-
pkg.package-operator.run/boxcutter v0.13.0
48+
pkg.package-operator.run/boxcutter v0.13.1
4949
sigs.k8s.io/controller-runtime v0.23.3
5050
sigs.k8s.io/controller-tools v0.20.1
5151
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097
@@ -107,7 +107,7 @@ require (
107107
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
108108
github.com/fatih/color v1.18.0 // indirect
109109
github.com/felixge/httpsnoop v1.0.4 // indirect
110-
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
110+
github.com/fxamacker/cbor/v2 v2.9.1 // indirect
111111
github.com/go-errors/errors v1.5.1 // indirect
112112
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
113113
github.com/go-git/go-billy/v5 v5.8.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z
151151
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
152152
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
153153
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
154-
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
155-
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
154+
github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ=
155+
github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
156156
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
157157
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
158158
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
@@ -796,8 +796,8 @@ k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbe
796796
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
797797
oras.land/oras-go/v2 v2.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc=
798798
oras.land/oras-go/v2 v2.6.0/go.mod h1:magiQDfG6H1O9APp+rOsvCPcW1GD2MM7vgnKY0Y+u1o=
799-
pkg.package-operator.run/boxcutter v0.13.0 h1:LNUS36NFkI+6J1CcVMrmTOtZt8UoalwXcIDlTPG66C4=
800-
pkg.package-operator.run/boxcutter v0.13.0/go.mod h1:Bo1tgiXCYJtehp5p+2aTrKt7VnJhrGKSSBvUQofnDRg=
799+
pkg.package-operator.run/boxcutter v0.13.1 h1:FvrSBnHWuf6Co+HPyxRSw2Y5mHSkUtteW8klXS6L8gk=
800+
pkg.package-operator.run/boxcutter v0.13.1/go.mod h1:rR2jd32uNt2eml7UvlYNCpCAYIpTALDzHxaftMfgkZo=
801801
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec=
802802
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
803803
sigs.k8s.io/controller-runtime v0.23.3 h1:VjB/vhoPoA9l1kEKZHBMnQF33tdCLQKJtydy4iqwZ80=

internal/operator-controller/controllers/clusterobjectset_controller.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,6 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl
150150
return ctrl.Result{}, fmt.Errorf("converting to boxcutter revision: %v", err)
151151
}
152152

153-
siblings, err := c.siblingRevisionNames(ctx, cos)
154-
if err != nil {
155-
setRetryingConditions(cos, err.Error())
156-
return ctrl.Result{}, fmt.Errorf("listing sibling revisions: %v", err)
157-
}
158-
159153
revisionEngine, err := c.RevisionEngineFactory.CreateRevisionEngine(ctx, cos)
160154
if err != nil {
161155
setRetryingConditions(cos, err.Error())
@@ -218,11 +212,6 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl
218212
if ores.Action() == machinery.ActionCollision {
219213
collidingObjs = append(collidingObjs, ores.String())
220214
}
221-
if ores.Action() == machinery.ActionProgressed && siblings != nil {
222-
if ref := foreignRevisionController(ores.Object(), siblings); ref != nil {
223-
collidingObjs = append(collidingObjs, ores.String()+fmt.Sprintf("\nConflicting Owner: %s", ref.String()))
224-
}
225-
}
226215
}
227216

228217
if len(collidingObjs) > 0 {
@@ -587,42 +576,6 @@ func EffectiveCollisionProtection(cp ...ocv1.CollisionProtection) ocv1.Collision
587576
return ecp
588577
}
589578

590-
// siblingRevisionNames returns the names of all ClusterObjectSets that belong to
591-
// the same ClusterExtension as cos. Returns nil when cos has no owner label.
592-
func (c *ClusterObjectSetReconciler) siblingRevisionNames(ctx context.Context, cos *ocv1.ClusterObjectSet) (sets.Set[string], error) {
593-
ownerLabel, ok := cos.Labels[labels.OwnerNameKey]
594-
if !ok {
595-
return nil, nil
596-
}
597-
revList := &ocv1.ClusterObjectSetList{}
598-
if err := c.TrackingCache.List(ctx, revList, client.MatchingLabels{
599-
labels.OwnerNameKey: ownerLabel,
600-
}); err != nil {
601-
return nil, fmt.Errorf("listing sibling revisions: %w", err)
602-
}
603-
names := sets.New[string]()
604-
for i := range revList.Items {
605-
names.Insert(revList.Items[i].Name)
606-
}
607-
return names, nil
608-
}
609-
610-
// foreignRevisionController returns the controller OwnerReference when obj is owned by a
611-
// ClusterObjectSet that is not in siblings (i.e. belongs to a different ClusterExtension).
612-
// Returns nil when the controller is a sibling or is not a ClusterObjectSet.
613-
func foreignRevisionController(obj metav1.Object, siblings sets.Set[string]) *metav1.OwnerReference {
614-
refs := obj.GetOwnerReferences()
615-
for i := range refs {
616-
if refs[i].Controller != nil && *refs[i].Controller &&
617-
refs[i].Kind == ocv1.ClusterObjectSetKind &&
618-
refs[i].APIVersion == ocv1.GroupVersion.String() &&
619-
!siblings.Has(refs[i].Name) {
620-
return &refs[i]
621-
}
622-
}
623-
return nil
624-
}
625-
626579
// buildProgressionProbes creates a set of boxcutter probes from the fields provided in the COS's spec.progressionProbes.
627580
// Returns nil and an error if encountered while attempting to build the probes.
628581
func buildProgressionProbes(progressionProbes []ocv1.ProgressionProbe) (probing.And, error) {

internal/operator-controller/controllers/clusterobjectset_controller_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
13551355
expectCollision bool
13561356
}{
13571357
{
1358-
name: "progressed object owned by a foreign COS is treated as a collision",
1358+
name: "collision object owned by a foreign COS is detected",
13591359
reconcilingRevisionName: "ext-B-1",
13601360
existingObjs: func() []client.Object {
13611361
extA := &ocv1.ClusterExtension{
@@ -1390,7 +1390,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
13901390
name: "everything",
13911391
objects: []machinery.ObjectResult{
13921392
mockObjectResult{
1393-
action: machinery.ActionProgressed,
1393+
action: machinery.ActionCollision,
13941394
object: &unstructured.Unstructured{
13951395
Object: map[string]interface{}{
13961396
"apiVersion": "apiextensions.k8s.io/v1",
@@ -1570,7 +1570,6 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
15701570
require.Equal(t, metav1.ConditionTrue, cond.Status)
15711571
require.Equal(t, ocv1.ClusterObjectSetReasonRetrying, cond.Reason)
15721572
require.Contains(t, cond.Message, "revision object collisions")
1573-
require.Contains(t, cond.Message, "Conflicting Owner")
15741573
} else {
15751574
require.Equal(t, ctrl.Result{}, result)
15761575
require.NoError(t, err)

internal/operator-controller/controllers/revision_engine_factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (f *defaultRevisionEngineFactory) CreateRevisionEngine(_ context.Context, r
6969
machinery.NewObjectEngine(
7070
f.Scheme, f.TrackingCache, scopedClient,
7171
machinery.NewComparator(f.DiscoveryClient, f.Scheme, f.FieldOwnerPrefix),
72-
f.FieldOwnerPrefix, f.FieldOwnerPrefix,
72+
f.FieldOwnerPrefix, f.FieldOwnerPrefix, scopedClient,
7373
),
7474
validation.NewClusterPhaseValidator(f.RESTMapper, scopedClient),
7575
),

0 commit comments

Comments
 (0)