Skip to content

✨ Add migration from helm to boxcutter revision - #9

Merged
thetechnick merged 1 commit into
poc-boxcutterfrom
helm-boxcutter-migration
Sep 5, 2025
Merged

✨ Add migration from helm to boxcutter revision#9
thetechnick merged 1 commit into
poc-boxcutterfrom
helm-boxcutter-migration

Conversation

@thetechnick

Copy link
Copy Markdown
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
thetechnickforce-pushed the helm-boxcutter-migration branch 3 times, most recently from 63ad1ed to 4ad5221CompareSeptember 3, 2025 18:39
@thetechnickthetechnick changed the title Add migration from helm to boxcutter revision✨ Add migration from helm to boxcutter revisionSep 3, 2025
x-kubernetes-embedded-resource: true
x-kubernetes-preserve-unknown-fields: true
required:
- collisionProtection

Copy link
Copy Markdown
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
thetechnickforce-pushed the helm-boxcutter-migration branch 2 times, most recently from 86bc6d7 to 34eafeeCompareSeptember 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.

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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(

Copy link
Copy Markdown

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{

Copy link
Copy Markdown

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) {

Copy link
Copy Markdown

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) {

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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
thetechnickforce-pushed the poc-boxcutter branch 2 times, most recently from 6d7efbf to 7e4f03bCompareSeptember 5, 2025 13:47
@thetechnick
thetechnickforce-pushed the helm-boxcutter-migration branch from 34eafee to 8d7de9aCompareSeptember 5, 2025 13:59
@thetechnick
thetechnick merged commit 3dca86f into poc-boxcutterSep 5, 2025
14 of 16 checks passed
@thetechnick
thetechnick deleted the helm-boxcutter-migration branch September 5, 2025 14:10
Sign up for freeto 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.

3 participants

@thetechnick@joelanford@perdasilva