Skip to content

Conversation

@thetechnick
Copy link
Owner

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@thetechnick thetechnick force-pushed the helm-boxcutter-migration branch 3 times, most recently from 63ad1ed to 4ad5221 Compare September 3, 2025 18:39
@thetechnick thetechnick changed the title Add migration from helm to boxcutter revision ✨ Add migration from helm to boxcutter revision Sep 3, 2025
x-kubernetes-embedded-resource: true
x-kubernetes-preserve-unknown-fields: true
required:
- collisionProtection
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If collisionProtection has a default ("Prevent"), it doesn't seem like it also makes sense to be required?

@thetechnick thetechnick force-pushed the helm-boxcutter-migration branch 2 times, most recently from 86bc6d7 to 34eafee Compare September 4, 2025 09:33
// +kubebuilder:validation:Enum=Active;Paused;Archived
// +kubebuilder:validation:XValidation:rule="oldSelf == 'Active' || oldSelf == 'Paused' || oldSelf == 'Archived' && oldSelf == self", message="can not un-archive"
LifecycleState ClusterExtensionRevisionLifecycleState `json:"lifecycleState,omitempty"`
// Revision number orders changes over time, must always be previous revision +1.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what we're trying to say with "Revision number orders changes over time". Maybe just "Revision number changes over time"? Maybe "Revision provides historical ordering of revisions, must always be previous +1"?

return fmt.Errorf("unable to create helm action client getter: %w", err)
}

// TODO: add support for preflight checks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this TODO still valid?


type ClusterExtensionRevisionGenerator interface {
GenerateRevision(bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1.ClusterExtensionRevision, error)
GenerateRevisionFromHelmRelease(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we be mixing concerns here? Maybe we could use generics in the interface to define the input type? (e.g. helmRelease vs bundleFS)?

})
}

rev := r.buildClusterExtensionRevision(objs, ext, map[string]string{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make this a revision generator and then just use composition for the bundle and helm release generators....wdyt?

}

func Test_SimpleRevisionGenerator_Success(t *testing.T) {
func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separating the Objects -> Revision, Bundle -> Revision and Chart -> Revision + composition (e.g. Objects -> Revision being used in Chart -> Revision) might also facilitate testing here since we'd only need to test the integration between the chart -> revision and objects -> revision (i.e. that we extract the correct objects from the chart and pass it down). This could help save us time later on as we iterate over the objects to revision process.

client.AssertExpectations(t)
})

t.Run("does not create revision when revisions exist", func(t *testing.T) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could the title be wrong here? We aren't returning any revisions

ObjectMeta: metav1.ObjectMeta{Name: "test123"},
}

client.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to check that client.Client was not called?

},
}

// TODO: we should make constants for the ClusterExtensionRevision condition types.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth doing already? XD

@thetechnick thetechnick force-pushed the poc-boxcutter branch 2 times, most recently from 6d7efbf to 7e4f03b Compare September 5, 2025 13:47
@thetechnick thetechnick force-pushed the helm-boxcutter-migration branch from 34eafee to 8d7de9a Compare September 5, 2025 13:59
@thetechnick thetechnick merged commit 3dca86f into poc-boxcutter Sep 5, 2025
14 of 16 checks passed
@thetechnick thetechnick deleted the helm-boxcutter-migration branch September 5, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants