Closed ccll closed 7 years ago
This will require a better handling if we want to maintain backwards compatibility:
if (env) {
container.env = [];
if (_.isPlainObject(env)) {
... Previous approach
} else if (_.isArray(env) {
container.env = _.cloneDeep(env)
} else {
throw error for unknown format
}
It will also need a unit test to ensure that the behavior is what we expect. Check the existing test "should deploy a function with environment variables" (in ./test/kubelessDeploy.test.js
) and create a similar one in which the environment variable is an array like in your example.
Let me know if you find any issue with that.
Oops!
Backward compatibility and test case is added, and npm lint
, npm test
, travis build all passes now.
This fix allows the user to mount secrets/configmaps as env var. Before the fix one specifies key/value pairs as a dictionary:
After the fix the value of 'environment' key is directly passed to k8s, which allows for: