Skip to content

Commit

Permalink
support dockerDaemonScheduler as param (#591)
Browse files Browse the repository at this point in the history
* support dockerDaemonScheduler as param
  • Loading branch information
oren-codefresh authored Nov 17, 2020
1 parent 4a08b39 commit a4f20d6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/interface/cli/commands/hybrid/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,12 @@ function mergeValuesFromValuesFile(argv, valuesFile, handleError) {
if (_.has(valuesObj, 'Runtime.resources')) {
_.set(_argv, 'reResources', valuesObj.Runtime.resources);
}
if (_.has(valuesObj, 'Runtime.userVolumeMounts')) {
_.set(_argv, 'userVolumeMounts', valuesObj.Runtime.userVolumeMounts);
}
if (_.has(valuesObj, 'Runtime.userVolumes')) {
_.set(_argv, 'userVolumes', valuesObj.Runtime.userVolumes);
}

return _argv;
}
Expand Down
16 changes: 15 additions & 1 deletion lib/interface/cli/commands/hybrid/init.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ const initCmd = new Command({
runtimeName,
reEnvVars,
reResources,
userVolumeMounts,
userVolumes,
} = _argv;
let {
'kube-context-name': kubeContextName,
Expand Down Expand Up @@ -589,10 +591,22 @@ const initCmd = new Command({
_.set(re, 'dockerDaemonScheduler.defaultDindResources', reResources);
}

if (userVolumeMounts) {
const currentdockerDaemonScheduler = _.get(re, 'dockerDaemonScheduler', {});
const newDockerDaemonScheduler = _.merge(currentdockerDaemonScheduler, { userVolumeMounts });
_.set(re, 'dockerDaemonScheduler', newDockerDaemonScheduler);
}

if (userVolumes) {
const currentdockerDaemonScheduler = _.get(re, 'dockerDaemonScheduler', {});
const newDockerDaemonScheduler = _.merge(currentdockerDaemonScheduler, { userVolumes });
_.set(re, 'dockerDaemonScheduler', newDockerDaemonScheduler);
}

await sdk.runtimeEnvs.update({ name: reName }, re);
console.log(`Runtime environment "${colors.cyan(reName)}" has been updated with env vars`);
},
condition: envVars.length || reResources,
condition: envVars.length || reResources || userVolumeMounts || userVolumes,
});

// set runtime as default
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.73.20",
"version": "0.73.21",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit a4f20d6

Please sign in to comment.