Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ require (
k8s.io/api v0.35.3
k8s.io/apiextensions-apiserver v0.35.3
k8s.io/apimachinery v0.35.3
k8s.io/apiserver v0.35.2
k8s.io/apiserver v0.35.3
k8s.io/cli-runtime v0.35.1
k8s.io/client-go v1.5.2
k8s.io/component-base v0.35.2
k8s.io/component-base v0.35.3
k8s.io/klog/v2 v2.140.0
k8s.io/kubernetes v1.35.0
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5
pkg.package-operator.run/boxcutter v0.13.0
pkg.package-operator.run/boxcutter v0.13.1
sigs.k8s.io/controller-runtime v0.23.3
sigs.k8s.io/controller-tools v0.20.1
sigs.k8s.io/crdify v0.5.1-0.20260309184313-54162f2e3097
Expand Down Expand Up @@ -107,7 +107,7 @@ require (
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.1 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.8.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ=
github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
Expand Down Expand Up @@ -796,8 +796,8 @@ k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbe
k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
oras.land/oras-go/v2 v2.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc=
oras.land/oras-go/v2 v2.6.0/go.mod h1:magiQDfG6H1O9APp+rOsvCPcW1GD2MM7vgnKY0Y+u1o=
pkg.package-operator.run/boxcutter v0.13.0 h1:LNUS36NFkI+6J1CcVMrmTOtZt8UoalwXcIDlTPG66C4=
pkg.package-operator.run/boxcutter v0.13.0/go.mod h1:Bo1tgiXCYJtehp5p+2aTrKt7VnJhrGKSSBvUQofnDRg=
pkg.package-operator.run/boxcutter v0.13.1 h1:FvrSBnHWuf6Co+HPyxRSw2Y5mHSkUtteW8klXS6L8gk=
pkg.package-operator.run/boxcutter v0.13.1/go.mod h1:rR2jd32uNt2eml7UvlYNCpCAYIpTALDzHxaftMfgkZo=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.23.3 h1:VjB/vhoPoA9l1kEKZHBMnQF33tdCLQKJtydy4iqwZ80=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl
return ctrl.Result{}, fmt.Errorf("converting to boxcutter revision: %v", err)
}

siblings, err := c.siblingRevisionNames(ctx, cos)
if err != nil {
setRetryingConditions(cos, err.Error())
return ctrl.Result{}, fmt.Errorf("listing sibling revisions: %v", err)
}

revisionEngine, err := c.RevisionEngineFactory.CreateRevisionEngine(ctx, cos)
if err != nil {
setRetryingConditions(cos, err.Error())
Expand Down Expand Up @@ -218,11 +212,6 @@ func (c *ClusterObjectSetReconciler) reconcile(ctx context.Context, cos *ocv1.Cl
if ores.Action() == machinery.ActionCollision {
collidingObjs = append(collidingObjs, ores.String())
}
if ores.Action() == machinery.ActionProgressed && siblings != nil {
if ref := foreignRevisionController(ores.Object(), siblings); ref != nil {
collidingObjs = append(collidingObjs, ores.String()+fmt.Sprintf("\nConflicting Owner: %s", ref.String()))
}
}
}

if len(collidingObjs) > 0 {
Expand Down Expand Up @@ -586,42 +575,6 @@ func EffectiveCollisionProtection(cp ...ocv1.CollisionProtection) ocv1.Collision
return ecp
}

// siblingRevisionNames returns the names of all ClusterObjectSets that belong to
// the same ClusterExtension as cos. Returns nil when cos has no owner label.
func (c *ClusterObjectSetReconciler) siblingRevisionNames(ctx context.Context, cos *ocv1.ClusterObjectSet) (sets.Set[string], error) {
ownerLabel, ok := cos.Labels[labels.OwnerNameKey]
if !ok {
return nil, nil
}
revList := &ocv1.ClusterObjectSetList{}
if err := c.TrackingCache.List(ctx, revList, client.MatchingLabels{
labels.OwnerNameKey: ownerLabel,
}); err != nil {
return nil, fmt.Errorf("listing sibling revisions: %w", err)
}
names := sets.New[string]()
for i := range revList.Items {
names.Insert(revList.Items[i].Name)
}
return names, nil
}

// foreignRevisionController returns the controller OwnerReference when obj is owned by a
// ClusterObjectSet that is not in siblings (i.e. belongs to a different ClusterExtension).
// Returns nil when the controller is a sibling or is not a ClusterObjectSet.
func foreignRevisionController(obj metav1.Object, siblings sets.Set[string]) *metav1.OwnerReference {
refs := obj.GetOwnerReferences()
for i := range refs {
if refs[i].Controller != nil && *refs[i].Controller &&
refs[i].Kind == ocv1.ClusterObjectSetKind &&
refs[i].APIVersion == ocv1.GroupVersion.String() &&
!siblings.Has(refs[i].Name) {
return &refs[i]
}
}
return nil
}

// buildProgressionProbes creates a set of boxcutter probes from the fields provided in the COS's spec.progressionProbes.
// Returns nil and an error if encountered while attempting to build the probes.
func buildProgressionProbes(progressionProbes []ocv1.ProgressionProbe) (probing.And, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
expectCollision bool
}{
{
name: "progressed object owned by a foreign COS is treated as a collision",
name: "collision object owned by a foreign COS is detected",
reconcilingRevisionName: "ext-B-1",
existingObjs: func() []client.Object {
extA := &ocv1.ClusterExtension{
Expand Down Expand Up @@ -1390,7 +1390,7 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
name: "everything",
objects: []machinery.ObjectResult{
mockObjectResult{
action: machinery.ActionProgressed,
action: machinery.ActionCollision,
object: &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "apiextensions.k8s.io/v1",
Expand Down Expand Up @@ -1570,7 +1570,6 @@ func Test_ClusterObjectSetReconciler_Reconcile_ForeignRevisionCollision(t *testi
require.Equal(t, metav1.ConditionTrue, cond.Status)
require.Equal(t, ocv1.ClusterObjectSetReasonRetrying, cond.Reason)
require.Contains(t, cond.Message, "revision object collisions")
require.Contains(t, cond.Message, "Conflicting Owner")
} else {
require.Equal(t, ctrl.Result{}, result)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (f *defaultRevisionEngineFactory) CreateRevisionEngine(_ context.Context, r
machinery.NewObjectEngine(
f.Scheme, f.TrackingCache, scopedClient,
machinery.NewComparator(f.DiscoveryClient, f.Scheme, f.FieldOwnerPrefix),
f.FieldOwnerPrefix, f.FieldOwnerPrefix,
f.FieldOwnerPrefix, f.FieldOwnerPrefix, scopedClient,
),
validation.NewClusterPhaseValidator(f.RESTMapper, scopedClient),
),
Expand Down
Loading