My-pleasure / oam-crd-migration

A tool to help you migrate OAM CRDs from v1alpha1 to v1alpha2
0 stars 0 forks source link

Custom Converter Design #1

Open hongchaodeng opened 4 years ago

hongchaodeng commented 4 years ago

Here's the design on top of my mind:

type v1alpha1Component Unstructured
type v1alpha2Component Unstructured
...

// Converter is the plugin that convert v1alpha1 OAM types to v1alpha2 types
type Converter interface {
    // ConvertComponent converts v1alpha1 Component in ApplicationConfiguration to
    // v1alpha2 Component and workload CR.
    ConvertComponent(v1alpha1Component) (v1alpha2Component)

    // ConvertTrait converts v1alpha1 Trait in ApplicationConfiguration to trait CR.
    ConvertTrait(v1alpha1Trait) (v1alpha2Trait)
}
My-pleasure commented 4 years ago

converter/converter.go:

converter/framework.go:

main.go: