gray-city-50684
11/15/2018, 4:35 PMcreamy-potato-29402
11/15/2018, 4:35 PMgray-city-50684
11/15/2018, 4:36 PMcreamy-potato-29402
11/15/2018, 4:36 PMgray-city-50684
11/15/2018, 4:36 PMcreamy-potato-29402
11/15/2018, 4:36 PMnew k8s.apps.v1.Deployment("app", JSON.parse(execSync("... command ...", {...}))
gray-city-50684
11/15/2018, 4:39 PMwhite-balloon-205
transformations
callback that is available on Chart
(https://github.com/pulumi/pulumi-kubernetes/blob/master/sdk/nodejs/helm.ts#L16) to be available on more resources. This gives you a callback that will get called with the inputs that are planned to create with, and the opportunity to step in and make changes/additions prior to creation.
If something like this was available on all Kubernetes resources, you could then shell out to the CLI tool from within that callback.
Would that address this scenario for you? Or do you ned to see all of the YAML for the entire program prior to passing it to the CLI tool?gray-city-50684
11/15/2018, 6:01 PMwhite-balloon-205
Deployment
based on the Pulumi new k8s.app.v1.Deployment
- is that sufficient? Or do you need all the resources you defined in Pulumi at once?gray-city-50684
11/15/2018, 6:05 PMmicroscopic-florist-22719
safeDump
to dump the inputs you'd normally pass to k8s.app.v1.Deployment
linkerd2
and use a ConfigFile
safeLoad
new k8s.app.v1.Deployment
gray-city-50684
11/15/2018, 6:27 PMserviceAccountName: serviceAccount.metadata.apply(meta => meta.name)
in the new k8s.app.v1.Deployment’s definition?microscopic-florist-22719
gray-city-50684
11/15/2018, 6:28 PMmicroscopic-florist-22719
white-balloon-205
microscopic-florist-22719
const deployment = new k8s.apps.v1.Deployment("app", {
// some args that may include `Output<T>` values
});
->
const deploymentArgs = pulumi.output({
// some args that may include `Output<T>` values
}).apply(args => {
// args is now fully-resolved.
// dump to a file with js-yaml
const tmpYaml = tmp.fileSync();
fs.writeFileSync(tmpYaml.fd, jsyaml.safeDump(args));
// invoke linkerd2 as appropriate and parse and return the yaml
const yamlText = childProcess.execSync(`linkerd2 ${tmpYaml.name}`).toString();
return jsyaml.safeLoad(yamlText);
});
const deployment = new k8s.apps.v1.Deployment("app", deploymentArgs);
Deployment
--won't work today b/c its second argument cannot be an Output<T>
.const deploymentArgs = pulumi.output({
// some args that may include `Output<T>` values
}).apply(args => {
// args is now fully-resolved.
// dump to a file with js-yaml
const tmpYaml = tmp.fileSync();
fs.writeFileSync(tmpYaml.fd, jsyaml.safeDump(args));
// invoke linkerd2 as appropriate and parse and return the yaml
const yamlText = childProcess.execSync(`linkerd2 ${tmpYaml.name}`).toString();
return jsyaml.safeLoad(yamlText);
});
const deployment = deploymentArgs.apply(args => new k8s.apps.v1.Deployment("app", args));
gray-city-50684
11/15/2018, 6:40 PMmicroscopic-florist-22719