Open bryanlarsen opened 5 years ago
Thanks for that!
Note that we realise there's probably a better way to declare the files you want to generate instead of having to use std.write
everytime (https://github.com/jkcfg/jk/issues/125). For instance this could look like:
const myservice = 'foo';
const ns = 'namespace';
const deployment = new k8s.apps.v1.Deployment(myservice, ...);
const service = ...
export default {
`${ns}/{myservice}-deploy.yaml`: deployment,
`${ns}/{myservice}-svc.yaml`: service,
};
To execute this we would introduce a new generate
command that know what to do which this exported object:
jk generate --stdout myservice.js
Using export doesn't allow us to pass parameters to units. We have our code structured so that every unit exports a function that returns an array of manifests. Then the top level calls all the units and std.write's everything to stdout using a YAMLStream.
A more important issue vis-a-vis skaffold integration is that we're going to need a way to generate the list of input filenames so that skaffold can inotify wait on them. Can we get that out of jk somehow?
I opened a super hacky PR on skaffold to start discussion about including support for jk: https://github.com/GoogleContainerTools/skaffold/pull/1983