-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modularize convert into loader & transformer #72
Conversation
Hi @ngtuna I just give quick look to this PR. kobject pkg looks goot. Decisions which loader or transformer to use would be in app.go. You are on good track with loaders switch I think that there should be something similar for transformers also. If we put all that decisions outsde of tranfromers packages, it will be easy to add more transformers in the future. |
@kadel Agreed. I suggest that I should add one more commit to the PR for creating separate packages for every loader and transformer, then we can merge it upstream and let people contribute more based on this construction. |
I'm creating shared functions (lot of) for both k8s and openshift packages then we should be good. For the switch decision of which output provider that transformer should refer to, I think at this moment if |
@kadel There are things happened on my mind:
So, I would suggest to create loader and transformer interfaces. Then let bundlefile, dockercompose, k8s, openshift implement the interface they belong to. Upcoming providers and input formats will be implemented following this structure. |
👍 @ngtuna for loader I can image just something like this: loadFiles(files []string) (KomposeObject, err) for transformer: loadKomopse(kobject KomposeObject, format string) (map[string]string, err) returned
That this returned map could be either saved to files, or displayed to stdout. |
@kadel I'm gonna merge this PR to |
This is an initial step of modularizing convert function into loader and transformer. I found a bit difficult to create the komposeObject interface due to
Go import cycle
problem. The easiest thing I can do is creating the shared structkomposeObject
in a separate package which loader and transformer can use. Although I think komposeObject interface is still a good idea.@kadel I'm looking for comment from your side.