Skip to content

Commit

Permalink
CR-4721 - support Vault namespace (#650)
Browse files Browse the repository at this point in the history
* add namespace flag to vault creation

* updated package version to 0.75.13
  • Loading branch information
ATGardner authored Apr 26, 2021
1 parent 7077622 commit 0bec1be
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.15.3
v10.23.0
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,33 @@ const CFError = require('cf-errors');
const cmd = require('../base.cmd');
const { sdk } = require('../../../../../../../logic');

function buildAuthObject({ token, username, password, roleId, secretId, loginPath, gcpRole, kubernetesRole, kubernetesJwt }) {
const mountPoint = loginPath ? { mount_point: loginPath } : {};
function buildAuthObject({ loginPath, namespace, token, username, password, roleId, secretId, gcpRole, kubernetesRole, kubernetesJwt }) {
const baseAuth = {
...(loginPath && { mount_point: loginPath }),
...(namespace && { namespace }),
};
if (token) {
return { type: 'token', token, ...mountPoint };
return { type: 'token', token, ...baseAuth };
}

if (username && password) {
return { type: 'userpass', username, password, ...mountPoint };
return { type: 'userpass', username, password, ...baseAuth };
}

if (roleId && secretId) {
return { type: 'approle', role_id: roleId, secret_id: secretId, ...mountPoint };
return { type: 'approle', role_id: roleId, secret_id: secretId, ...baseAuth };
}

if (gcpRole) {
return { type: 'gcp', roleType: 'gce', role: gcpRole, ...mountPoint };
return { type: 'gcp', roleType: 'gce', role: gcpRole, ...baseAuth };
}

if (kubernetesRole) {
return {
type: 'kubernetes',
role: kubernetesRole,
...(kubernetesJwt && { jwt: kubernetesJwt }),
...mountPoint,
...baseAuth,
};
}

Expand Down Expand Up @@ -61,6 +64,11 @@ const command = new Command({
describe: 'Path for given auth method. Leave out to use the default path for the type.',
type: 'string',
})
.option('namespace', {
alias: 'n',
describe: 'Namespace is only valid for Vault Enterprise instances',
type: 'string',
})
.option('token', {
alias: 't',
describe: 'Token',
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.75.12",
"version": "0.75.13",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 0bec1be

Please sign in to comment.