@axway/axway-central-cli 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +6 -28
- package/dist/commands/apply/index.js +9 -24
- package/dist/commands/completion/index.js +3 -9
- package/dist/commands/config/common/index.js +2 -11
- package/dist/commands/config/index.js +2 -7
- package/dist/commands/config/list.js +2 -6
- package/dist/commands/config/set.js +4 -31
- package/dist/commands/config/unset.js +2 -12
- package/dist/commands/create/agentResource.js +12 -32
- package/dist/commands/create/environment.js +6 -16
- package/dist/commands/create/index.js +9 -26
- package/dist/commands/create/serviceAccount.js +2 -6
- package/dist/commands/delete/index.js +15 -33
- package/dist/commands/edit/environment.js +6 -21
- package/dist/commands/edit/index.js +4 -8
- package/dist/commands/get/index.js +27 -44
- package/dist/commands/install/agents.js +41 -70
- package/dist/commands/install/apigeexSaasAgents.js +33 -96
- package/dist/commands/install/awsAgents.js +87 -137
- package/dist/commands/install/awsSaasAgents.js +48 -140
- package/dist/commands/install/azureAgents.js +37 -77
- package/dist/commands/install/edgeAgents.js +15 -108
- package/dist/commands/install/gitHubSaasAgents.js +286 -0
- package/dist/commands/install/helpers/creators.js +17 -70
- package/dist/commands/install/helpers/deleters.js +2 -11
- package/dist/commands/install/helpers/getters.js +4 -30
- package/dist/commands/install/helpers/index.js +13 -48
- package/dist/commands/install/helpers/inputs.js +26 -98
- package/dist/commands/install/helpers/regex.js +29 -34
- package/dist/commands/install/helpers/templates/awsTemplates.js +6 -23
- package/dist/commands/install/helpers/templates/azureTemplates.js +5 -24
- package/dist/commands/install/helpers/templates/edgeTemplates.js +7 -38
- package/dist/commands/install/helpers/templates/istioTemplates.js +5 -16
- package/dist/commands/install/index.js +4 -10
- package/dist/commands/install/istioAgents.js +38 -115
- package/dist/commands/install/platform.js +18 -50
- package/dist/commands/proxies/create.js +2 -18
- package/dist/commands/proxies/index.js +4 -8
- package/dist/commands/proxies/promote.js +2 -21
- package/dist/common/ApiServerClient.js +64 -173
- package/dist/common/CacheController.js +11 -32
- package/dist/common/CliConfigManager.js +14 -27
- package/dist/common/CompositeError.js +6 -30
- package/dist/common/CoreConfigController.js +18 -40
- package/dist/common/DefinitionsManager.js +29 -76
- package/dist/common/Kubectl.js +2 -25
- package/dist/common/PlatformClient.js +19 -63
- package/dist/common/Renderer.js +25 -87
- package/dist/common/TmpFile.js +11 -28
- package/dist/common/bashCommands.js +3 -22
- package/dist/common/basicPrompts.js +8 -43
- package/dist/common/dataService.js +22 -50
- package/dist/common/errorHandler.js +0 -9
- package/dist/common/resultsRenderers.js +10 -42
- package/dist/common/types.js +117 -342
- package/dist/common/utils.js +37 -99
- package/dist/main.js +0 -2
- package/package.json +2 -2
|
@@ -4,51 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.testables = exports.prompts = exports.installPreprocess = exports.gatewayConnectivity = exports.dockerPublicKey = exports.dockerPrivateKey = exports.completeInstall = exports.askOrganizationReplication = exports.askIsGatewayOnlyMode = exports.askConfigType = exports.askBundleTypeGWOnly = exports.askBundleType = exports.EdgeInstallMethods = exports.EdgeGWOnlyInstallMethods = exports.ConfigFiles = void 0;
|
|
7
|
-
|
|
8
7
|
var _cliKit = require("cli-kit");
|
|
9
|
-
|
|
10
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
|
|
12
9
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
13
|
-
|
|
14
10
|
var _basicPrompts = require("../../common/basicPrompts");
|
|
15
|
-
|
|
16
11
|
var _dataService = require("../../common/dataService");
|
|
17
|
-
|
|
18
12
|
var _Kubectl = require("../../common/Kubectl");
|
|
19
|
-
|
|
20
13
|
var _types = require("../../common/types");
|
|
21
|
-
|
|
22
14
|
var _utils = require("../../common/utils");
|
|
23
|
-
|
|
24
15
|
var _agents = require("./agents");
|
|
25
|
-
|
|
26
16
|
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
27
|
-
|
|
28
17
|
var _edgeTemplates = require("./helpers/templates/edgeTemplates");
|
|
29
|
-
|
|
30
18
|
var _istioAgents = require("./istioAgents");
|
|
31
|
-
|
|
32
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
-
|
|
34
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
-
|
|
38
22
|
const defaultLogFiles = '/group-*_instance-*.log';
|
|
39
23
|
const defaultOTLogFiles = '/group-*_instance-*_traffic*.log';
|
|
40
|
-
const dockerPrivateKey = '/keys/private_key.pem';
|
|
41
|
-
exports.
|
|
42
|
-
const dockerPublicKey = '/keys/public_key.pem'; // @ts-ignore
|
|
24
|
+
const dockerPrivateKey = exports.dockerPrivateKey = '/keys/private_key.pem';
|
|
25
|
+
const dockerPublicKey = exports.dockerPublicKey = '/keys/public_key.pem';
|
|
43
26
|
|
|
44
|
-
|
|
27
|
+
// @ts-ignore
|
|
45
28
|
const {
|
|
46
29
|
log
|
|
47
30
|
} = (0, _snooplogg.default)('central: install: agents: edge');
|
|
48
31
|
const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.EDGE_DA}`;
|
|
49
|
-
const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.EDGE_TA}`;
|
|
32
|
+
const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.EDGE_TA}`;
|
|
50
33
|
|
|
51
|
-
|
|
34
|
+
// ConfigFiles - all the config file that are used in the setup
|
|
35
|
+
const ConfigFiles = exports.ConfigFiles = {
|
|
52
36
|
DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
|
|
53
37
|
DAHelmOverride: 'da-overrides.yaml',
|
|
54
38
|
EdgeDABinaryFile: 'discovery_agent',
|
|
@@ -58,8 +42,7 @@ const ConfigFiles = {
|
|
|
58
42
|
TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`,
|
|
59
43
|
TAHelmOverride: 'ta-overrides.yaml'
|
|
60
44
|
};
|
|
61
|
-
exports.
|
|
62
|
-
const prompts = {
|
|
45
|
+
const prompts = exports.prompts = {
|
|
63
46
|
configTypeMsg: 'Select the mode of installation',
|
|
64
47
|
askApiGatewayHost: 'Enter the API Gateway hostname',
|
|
65
48
|
askApiGatewayPort: 'Enter the API Gateway port',
|
|
@@ -72,8 +55,6 @@ const prompts = {
|
|
|
72
55
|
enterGatewayManagerMode: 'Do you want to use API Manager with the API Gateway',
|
|
73
56
|
askIfOrgReplication: 'Do you want to replicate your original organization structure for your newly discovered APIs? If yes, make sure the organization names match the team names that are created in Amplify platform'
|
|
74
57
|
};
|
|
75
|
-
exports.prompts = prompts;
|
|
76
|
-
|
|
77
58
|
const downloadV7AgentBundle = async (type, version) => {
|
|
78
59
|
const fileName = type === _types.BundleType.DISCOVERY ? `discovery_agent-${version}.zip` : `traceability_agent-${version}.zip`;
|
|
79
60
|
const url = type === _types.BundleType.DISCOVERY ? `/v7_discovery_agent/${version}/discovery_agent-${version}.zip` : `/v7_traceability_agent/${version}/traceability_agent-${version}.zip`;
|
|
@@ -81,7 +62,6 @@ const downloadV7AgentBundle = async (type, version) => {
|
|
|
81
62
|
baseUrl: _types.PublicRepoUrl,
|
|
82
63
|
basePath: _types.BasePaths.V7Agents
|
|
83
64
|
});
|
|
84
|
-
|
|
85
65
|
try {
|
|
86
66
|
const {
|
|
87
67
|
stream
|
|
@@ -92,28 +72,21 @@ const downloadV7AgentBundle = async (type, version) => {
|
|
|
92
72
|
throw new Error(`Failed to download the agent: ${err.message}`);
|
|
93
73
|
}
|
|
94
74
|
};
|
|
95
|
-
|
|
96
75
|
const downloadBinary = async (bundleType, version) => {
|
|
97
76
|
const fileName = await downloadV7AgentBundle(bundleType, version);
|
|
98
77
|
await helpers.unzip(fileName);
|
|
99
|
-
|
|
100
78
|
_fs.default.unlinkSync(fileName);
|
|
101
79
|
};
|
|
102
|
-
|
|
103
80
|
const downloadBinaries = async installConfig => {
|
|
104
81
|
console.log('Downloading and unpacking binary files...');
|
|
105
|
-
|
|
106
82
|
if (installConfig.switches.isDaEnabled) {
|
|
107
83
|
await downloadBinary(_types.BundleType.DISCOVERY, installConfig.daVersion);
|
|
108
84
|
}
|
|
109
|
-
|
|
110
85
|
if (installConfig.switches.isTaEnabled) {
|
|
111
86
|
await downloadBinary(_types.BundleType.TRACEABILITY, installConfig.taVersion);
|
|
112
87
|
}
|
|
113
|
-
|
|
114
88
|
console.log('Downloading and unpacking is complete.');
|
|
115
89
|
};
|
|
116
|
-
|
|
117
90
|
const askIsGatewayOnlyMode = async () => {
|
|
118
91
|
const mode = await (0, _basicPrompts.askList)({
|
|
119
92
|
msg: prompts.enterGatewayManagerMode,
|
|
@@ -122,9 +95,7 @@ const askIsGatewayOnlyMode = async () => {
|
|
|
122
95
|
});
|
|
123
96
|
return mode == _types.YesNo.Yes ? _types.GatewayTypes.EDGE_GATEWAY : _types.GatewayTypes.EDGE_GATEWAY_ONLY;
|
|
124
97
|
};
|
|
125
|
-
|
|
126
98
|
exports.askIsGatewayOnlyMode = askIsGatewayOnlyMode;
|
|
127
|
-
|
|
128
99
|
const askOrganizationReplication = async () => {
|
|
129
100
|
const mode = await (0, _basicPrompts.askList)({
|
|
130
101
|
msg: prompts.askIfOrgReplication,
|
|
@@ -133,36 +104,28 @@ const askOrganizationReplication = async () => {
|
|
|
133
104
|
});
|
|
134
105
|
return mode == _types.YesNo.Yes;
|
|
135
106
|
};
|
|
136
|
-
|
|
137
107
|
exports.askOrganizationReplication = askOrganizationReplication;
|
|
138
|
-
|
|
139
108
|
const askBundleType = async () => {
|
|
140
109
|
return await (0, _basicPrompts.askList)({
|
|
141
110
|
msg: helpers.agentMessages.selectAgentType,
|
|
142
111
|
choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
|
|
143
112
|
});
|
|
144
113
|
};
|
|
145
|
-
|
|
146
114
|
exports.askBundleType = askBundleType;
|
|
147
|
-
|
|
148
115
|
const askBundleTypeGWOnly = async () => {
|
|
149
116
|
return await (0, _basicPrompts.askList)({
|
|
150
117
|
msg: helpers.agentMessages.selectAgentType,
|
|
151
118
|
choices: [_types.BundleType.TRACEABILITY, _types.BundleType.TRACEABILITY_OFFLINE]
|
|
152
119
|
});
|
|
153
120
|
};
|
|
154
|
-
|
|
155
121
|
exports.askBundleTypeGWOnly = askBundleTypeGWOnly;
|
|
156
|
-
|
|
157
122
|
const askConfigType = async () => {
|
|
158
123
|
return await (0, _basicPrompts.askList)({
|
|
159
124
|
msg: prompts.configTypeMsg,
|
|
160
125
|
choices: [_types.AgentConfigTypes.BINARIES, _types.AgentConfigTypes.DOCKERIZED, _types.AgentConfigTypes.HELM]
|
|
161
126
|
});
|
|
162
127
|
};
|
|
163
|
-
|
|
164
128
|
exports.askConfigType = askConfigType;
|
|
165
|
-
|
|
166
129
|
const askLoggingSource = async () => {
|
|
167
130
|
console.log(_cliKit.chalk.white(`\nThe API Gateway can provide the API traffic either within event logs or open traffic logs.`));
|
|
168
131
|
return (await (0, _basicPrompts.askList)({
|
|
@@ -171,7 +134,6 @@ const askLoggingSource = async () => {
|
|
|
171
134
|
choices: [_types.LoggingSource.Event, _types.LoggingSource.OpenTraffic]
|
|
172
135
|
})) === _types.LoggingSource.OpenTraffic;
|
|
173
136
|
};
|
|
174
|
-
|
|
175
137
|
const askEventsPath = async isOpenTraffic => {
|
|
176
138
|
return await (0, _basicPrompts.askInput)({
|
|
177
139
|
msg: isOpenTraffic ? prompts.askOpenTrafficPath : prompts.askEventsPath,
|
|
@@ -179,14 +141,12 @@ const askEventsPath = async isOpenTraffic => {
|
|
|
179
141
|
type: 'string'
|
|
180
142
|
});
|
|
181
143
|
};
|
|
182
|
-
|
|
183
144
|
const askApiManagerHost = async () => {
|
|
184
145
|
return await (0, _basicPrompts.askInput)({
|
|
185
146
|
msg: prompts.askApiManagerHost,
|
|
186
147
|
defaultValue: _agents.localhost
|
|
187
148
|
});
|
|
188
149
|
};
|
|
189
|
-
|
|
190
150
|
const askApiManagerPort = async () => {
|
|
191
151
|
return await (0, _basicPrompts.askInput)({
|
|
192
152
|
msg: prompts.askApiManagerPort,
|
|
@@ -194,14 +154,12 @@ const askApiManagerPort = async () => {
|
|
|
194
154
|
type: 'number'
|
|
195
155
|
});
|
|
196
156
|
};
|
|
197
|
-
|
|
198
157
|
const askApiGatewayHost = async () => {
|
|
199
158
|
return await (0, _basicPrompts.askInput)({
|
|
200
159
|
msg: prompts.askApiGatewayHost,
|
|
201
160
|
defaultValue: _agents.localhost
|
|
202
161
|
});
|
|
203
162
|
};
|
|
204
|
-
|
|
205
163
|
const askApiGatewayPort = async () => {
|
|
206
164
|
return await (0, _basicPrompts.askInput)({
|
|
207
165
|
msg: prompts.askApiGatewayPort,
|
|
@@ -209,53 +167,42 @@ const askApiGatewayPort = async () => {
|
|
|
209
167
|
type: 'number'
|
|
210
168
|
});
|
|
211
169
|
};
|
|
212
|
-
|
|
213
170
|
const gatewayConnectivity = async installConfig => {
|
|
214
171
|
let v7AgentValues = new _edgeTemplates.V7AgentValues();
|
|
215
|
-
|
|
216
172
|
if (installConfig.switches.isHelmInstall) {
|
|
217
173
|
const {
|
|
218
174
|
error
|
|
219
175
|
} = await _Kubectl.kubectl.isInstalled();
|
|
220
|
-
|
|
221
176
|
if (error) {
|
|
222
177
|
throw new Error(`Kubectl is required to fill out the following prompts. It appears to be missing or misconfigured.\n${error}`);
|
|
223
178
|
}
|
|
224
179
|
}
|
|
225
|
-
|
|
226
180
|
if (!installConfig.switches.isGatewayOnly || installConfig.switches.isDaEnabled) {
|
|
227
181
|
console.log('\nCONNECTION TO API MANAGER:');
|
|
228
182
|
console.log(_cliKit.chalk.gray(`The agents need to connect to the Axway API Manager to discover APIs for publishing to Amplify Central and/or the Unified Catalog.\n` + `Use the credentials of an API Manager Administrator user or an Organization Administrator user.`));
|
|
229
|
-
|
|
230
183
|
if (installConfig.switches.isHelmInstall) {
|
|
231
184
|
console.log(_cliKit.chalk.white(`Please use the name of the API Manager Service as hostname.`));
|
|
232
185
|
}
|
|
233
|
-
|
|
234
186
|
v7AgentValues.apiManagerHost = await askApiManagerHost();
|
|
235
187
|
v7AgentValues.apiManagerPort = await askApiManagerPort();
|
|
236
188
|
const apimCreds = await (0, _basicPrompts.askUsernameAndPassword)('the API Manager', 'apiadmin');
|
|
237
189
|
v7AgentValues.apiManagerAuthUser = apimCreds.username;
|
|
238
190
|
v7AgentValues.apiManagerAuthPass = apimCreds.password;
|
|
239
191
|
}
|
|
240
|
-
|
|
241
192
|
if (installConfig.switches.isTaEnabled) {
|
|
242
193
|
v7AgentValues.isOpenTraffic = await askLoggingSource();
|
|
243
|
-
|
|
244
194
|
if (!v7AgentValues.isOpenTraffic) {
|
|
245
195
|
console.log('\nCONNECTION TO API GATEWAY:');
|
|
246
196
|
console.log(_cliKit.chalk.gray(`The traceability agent needs to connect to Axway API Gateway.\n` + `Use the credentials of an Operator user.`));
|
|
247
|
-
|
|
248
197
|
if (installConfig.switches.isHelmInstall) {
|
|
249
198
|
console.log(_cliKit.chalk.white(`Please use the name of the API Gateway Service as hostname.`));
|
|
250
199
|
}
|
|
251
|
-
|
|
252
200
|
v7AgentValues.apiGatewayHost = await askApiGatewayHost();
|
|
253
201
|
v7AgentValues.apiGatewayPort = await askApiGatewayPort();
|
|
254
202
|
const apigwCreds = await (0, _basicPrompts.askUsernameAndPassword)('the API Gateway', 'admin');
|
|
255
203
|
v7AgentValues.apiGatewayAuthUser = apigwCreds.username;
|
|
256
204
|
v7AgentValues.apiGatewayAuthPass = apigwCreds.password;
|
|
257
205
|
}
|
|
258
|
-
|
|
259
206
|
if (installConfig.switches.isBinaryInstall || installConfig.switches.isDockerInstall) {
|
|
260
207
|
const eventLogPaths = await askEventsPath(v7AgentValues.isOpenTraffic);
|
|
261
208
|
const trimmedDir = eventLogPaths.trim();
|
|
@@ -263,28 +210,21 @@ const gatewayConnectivity = async installConfig => {
|
|
|
263
210
|
v7AgentValues.eventLogPathTemplate = installConfig.switches.isBinaryInstall ? `${v7AgentValues.eventLogPath}${v7AgentValues.isOpenTraffic ? defaultOTLogFiles : defaultLogFiles}` : '';
|
|
264
211
|
}
|
|
265
212
|
}
|
|
266
|
-
|
|
267
213
|
if (installConfig.switches.isHelmInstall) {
|
|
268
214
|
v7AgentValues.namespace = await helpers.askNamespace(prompts.enterGatewayAgentNs, _istioAgents.amplifyAgentsNs);
|
|
269
215
|
}
|
|
270
|
-
|
|
271
216
|
return v7AgentValues;
|
|
272
217
|
};
|
|
273
|
-
|
|
274
218
|
exports.gatewayConnectivity = gatewayConnectivity;
|
|
275
|
-
|
|
276
219
|
const generateSuccessHelpMsg = installConfig => {
|
|
277
220
|
var _v7AgentValues$eventL;
|
|
278
|
-
|
|
279
221
|
const v7AgentValues = installConfig.gatewayConfig;
|
|
280
222
|
const configType = installConfig.deploymentType;
|
|
281
223
|
const trimmedDir = (_v7AgentValues$eventL = v7AgentValues.eventLogPath) === null || _v7AgentValues$eventL === void 0 ? void 0 : _v7AgentValues$eventL.trim();
|
|
282
224
|
const verifiedEventsPath = v7AgentValues.eventLogPath ? trimmedDir[trimmedDir.length - 1] === '/' ? `${trimmedDir.slice(0, -1)}:/events` : `${trimmedDir}:/events` : '';
|
|
283
|
-
|
|
284
225
|
if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
|
|
285
226
|
console.log(_cliKit.chalk.yellow('\nPlease make sure to copy the "private_key.pem" and "public_key.pem" files for the existing service account you selected.'));
|
|
286
227
|
}
|
|
287
|
-
|
|
288
228
|
if (configType === _types.AgentConfigTypes.BINARIES) {
|
|
289
229
|
binarySuccessMsg(installConfig.centralConfig.ampcDosaInfo.isNew, installConfig.switches.isDaEnabled, installConfig.switches.isTaEnabled);
|
|
290
230
|
} else if (configType === _types.AgentConfigTypes.DOCKERIZED) {
|
|
@@ -292,62 +232,52 @@ const generateSuccessHelpMsg = installConfig => {
|
|
|
292
232
|
} else if (installConfig.switches.isHelmInstall) {
|
|
293
233
|
helmSuccessMsg(v7AgentValues.namespace.name, installConfig.switches.isDaEnabled, installConfig.switches.isTaEnabled);
|
|
294
234
|
}
|
|
295
|
-
|
|
296
235
|
console.log(_cliKit.chalk.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.V7}`));
|
|
297
236
|
};
|
|
298
|
-
|
|
299
237
|
const installPreprocess = async installConfig => {
|
|
300
238
|
// Ask for key paths if HELM, and dosa NOT new
|
|
301
239
|
if (installConfig.deploymentType === _types.AgentConfigTypes.HELM && !installConfig.centralConfig.ampcDosaInfo.isNew) {
|
|
302
240
|
[installConfig.centralConfig.dosaAccount.publicKey, installConfig.centralConfig.dosaAccount.privateKey] = await helpers.askPublicAndPrivateKeysPath();
|
|
303
|
-
}
|
|
304
|
-
|
|
241
|
+
}
|
|
305
242
|
|
|
243
|
+
// attempt to download the binaries prior to creating resources
|
|
306
244
|
if (installConfig.switches.isBinaryInstall) {
|
|
307
245
|
await downloadBinaries(installConfig);
|
|
308
246
|
}
|
|
309
|
-
|
|
310
247
|
return installConfig;
|
|
311
248
|
};
|
|
312
|
-
|
|
313
249
|
exports.installPreprocess = installPreprocess;
|
|
314
|
-
|
|
315
250
|
const completeInstall = async installConfig => {
|
|
316
251
|
/**
|
|
317
252
|
* Create agent resources
|
|
318
253
|
*/
|
|
319
|
-
const v7AgentValues = installConfig.gatewayConfig;
|
|
254
|
+
const v7AgentValues = installConfig.gatewayConfig;
|
|
320
255
|
|
|
256
|
+
// Add final settings to v7AgentsValues
|
|
321
257
|
v7AgentValues.centralConfig = installConfig.centralConfig;
|
|
322
258
|
v7AgentValues.traceabilityConfig = installConfig.traceabilityConfig;
|
|
323
259
|
v7AgentValues.isGatewayOnly = installConfig.switches.isGatewayOnly;
|
|
324
260
|
v7AgentValues.daVersion = installConfig.daVersion;
|
|
325
261
|
v7AgentValues.taVersion = installConfig.taVersion;
|
|
326
|
-
|
|
327
262
|
if (installConfig.switches.isHelmInstall) {
|
|
328
263
|
if (v7AgentValues.namespace.isNew) {
|
|
329
264
|
await helpers.createNamespace(v7AgentValues.namespace.name);
|
|
330
265
|
}
|
|
331
|
-
|
|
332
266
|
await helpers.createSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, async () => {
|
|
333
267
|
if (installConfig.centralConfig.ampcDosaInfo.isNew) {
|
|
334
268
|
console.log(_cliKit.chalk.yellow(`The secret '${helpers.amplifyAgentsKeysSecret}' will be created with the same "private_key.pem" and "public_key.pem" that was auto generated to create the Service Account.`));
|
|
335
269
|
}
|
|
336
|
-
|
|
337
270
|
await helpers.createAmplifyAgentKeysSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, 'public_key', v7AgentValues.centralConfig.dosaAccount.publicKey, 'private_key', v7AgentValues.centralConfig.dosaAccount.privateKey);
|
|
338
271
|
});
|
|
339
272
|
await helpers.createSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, async () => {
|
|
340
273
|
await helpers.createGatewayAgentCredsSecret(v7AgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, v7AgentValues.apiManagerAuthUser, v7AgentValues.apiManagerAuthPass, v7AgentValues.apiGatewayAuthUser, v7AgentValues.apiGatewayAuthPass);
|
|
341
274
|
});
|
|
342
275
|
}
|
|
343
|
-
|
|
344
276
|
console.log('Generating the configuration file(s)...');
|
|
345
|
-
|
|
346
277
|
if (installConfig.switches.isHelmInstall) {
|
|
347
278
|
if (installConfig.switches.isDaEnabled) {
|
|
348
279
|
(0, _utils.writeTemplates)(ConfigFiles.DAHelmOverride, v7AgentValues, helpers.v7DAHelmOverrideTemplate);
|
|
349
280
|
}
|
|
350
|
-
|
|
351
281
|
if (installConfig.switches.isTaEnabled) {
|
|
352
282
|
(0, _utils.writeTemplates)(ConfigFiles.TAHelmOverride, v7AgentValues, helpers.v7TAHelmOverrideTemplate);
|
|
353
283
|
}
|
|
@@ -355,18 +285,14 @@ const completeInstall = async installConfig => {
|
|
|
355
285
|
if (installConfig.switches.isDaEnabled) {
|
|
356
286
|
(0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, v7AgentValues, helpers.v7DAEnvVarTemplate);
|
|
357
287
|
}
|
|
358
|
-
|
|
359
288
|
if (installConfig.switches.isTaEnabled) {
|
|
360
289
|
(0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, v7AgentValues, helpers.v7TAEnvVarTemplate);
|
|
361
290
|
}
|
|
362
291
|
}
|
|
363
|
-
|
|
364
292
|
console.log('Configuration file(s) have been successfully created.\n');
|
|
365
293
|
generateSuccessHelpMsg(installConfig);
|
|
366
294
|
};
|
|
367
|
-
|
|
368
295
|
exports.completeInstall = completeInstall;
|
|
369
|
-
|
|
370
296
|
const dockerSuccessMsg = (installConfig, eventLogPath) => {
|
|
371
297
|
let dockerInfo;
|
|
372
298
|
const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
@@ -377,7 +303,6 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
|
|
|
377
303
|
const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
|
|
378
304
|
const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
|
|
379
305
|
const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
|
|
380
|
-
|
|
381
306
|
if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
|
|
382
307
|
dockerInfo = `To utilize the agents, pull the latest Docker images and run them using the appropriate supplied environment files, (${helpers.configFiles.DA_ENV_VARS} & ${helpers.configFiles.TA_ENV_VARS}):`;
|
|
383
308
|
} else if (installConfig.switches.isDaEnabled) {
|
|
@@ -385,9 +310,7 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
|
|
|
385
310
|
} else {
|
|
386
311
|
dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
|
|
387
312
|
}
|
|
388
|
-
|
|
389
313
|
console.log(_cliKit.chalk.whiteBright(dockerInfo), '\n');
|
|
390
|
-
|
|
391
314
|
if (installConfig.switches.isDaEnabled) {
|
|
392
315
|
const daImageVersion = `${daImage}:${installConfig.daVersion}`;
|
|
393
316
|
console.log(_cliKit.chalk.white('Pull the latest image of the Discovery Agent:'));
|
|
@@ -396,7 +319,6 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
|
|
|
396
319
|
console.log(_cliKit.chalk.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
|
|
397
320
|
console.log('\t', _cliKit.chalk.cyan(`-v /data ${daImageVersion}`));
|
|
398
321
|
}
|
|
399
|
-
|
|
400
322
|
if (installConfig.switches.isTaEnabled) {
|
|
401
323
|
const taImageVersion = `${taImage}:${installConfig.taVersion}`;
|
|
402
324
|
console.log(_cliKit.chalk.white('Pull the latest image of the Traceability Agent:'));
|
|
@@ -406,63 +328,51 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
|
|
|
406
328
|
console.log('\t', _cliKit.chalk.cyan(`-v ${eventLogPath} -v /data ${taImageVersion}`));
|
|
407
329
|
}
|
|
408
330
|
};
|
|
409
|
-
|
|
410
331
|
const binarySuccessMsg = (isNewDosa, isDaEnabled, isTaEnabled) => {
|
|
411
332
|
const daFiles = [ConfigFiles.DAEnvVars, ConfigFiles.EdgeDABinaryFile, ConfigFiles.EdgeDAYaml];
|
|
412
333
|
const taFiles = [ConfigFiles.TAEnvVars, ConfigFiles.EdgeTABinaryFile, ConfigFiles.EdgeTAYaml];
|
|
413
334
|
const keys = ['private_key.pem', 'public_key.pem'];
|
|
414
335
|
let files = [];
|
|
415
|
-
|
|
416
336
|
if (isNewDosa) {
|
|
417
337
|
files = files.concat(keys);
|
|
418
338
|
}
|
|
419
|
-
|
|
420
339
|
if (isDaEnabled) {
|
|
421
340
|
files = files.concat(daFiles);
|
|
422
341
|
}
|
|
423
|
-
|
|
424
342
|
if (isTaEnabled) {
|
|
425
343
|
files = files.concat(taFiles);
|
|
426
344
|
}
|
|
427
|
-
|
|
428
345
|
const agents = isDaEnabled && isTaEnabled ? 'agents' : 'agent';
|
|
429
346
|
console.log(_cliKit.chalk.whiteBright('Please copy following files from current folder to API Gateway machine:'));
|
|
430
347
|
console.log(_cliKit.chalk.cyan(files.join('\n')));
|
|
431
348
|
console.log(_cliKit.chalk.whiteBright('for example'), _cliKit.chalk.cyan(`scp ${files.join(' ')} root@host:~/some_folder/`));
|
|
432
349
|
console.log(_cliKit.chalk.whiteBright(`\nTo start the ${agents}:`));
|
|
433
|
-
|
|
434
350
|
if (isDaEnabled) {
|
|
435
351
|
console.log(_cliKit.chalk.cyan(`./discovery_agent --envFile ./${helpers.configFiles.DA_ENV_VARS}`));
|
|
436
352
|
}
|
|
437
|
-
|
|
438
353
|
if (isTaEnabled) {
|
|
439
354
|
console.log(_cliKit.chalk.cyan(`./traceability_agent --envFile ./${helpers.configFiles.TA_ENV_VARS}`));
|
|
440
355
|
}
|
|
441
356
|
};
|
|
442
|
-
|
|
443
357
|
const helmSuccessMsg = (namespace, isDaEnabled, isTaEnabled) => {
|
|
444
358
|
let finishUp = 'helm repo update\n';
|
|
445
|
-
|
|
446
359
|
if (isDaEnabled) {
|
|
447
360
|
console.log(_cliKit.chalk.white(`Discovery Agent override file has been placed at ${process.cwd()}/${ConfigFiles.DAHelmOverride}`));
|
|
448
361
|
finishUp += `helm upgrade --install --namespace ${namespace} v7-discovery axway/v7-discovery -f ${ConfigFiles.DAHelmOverride}\n`;
|
|
449
362
|
}
|
|
450
|
-
|
|
451
363
|
if (isTaEnabled) {
|
|
452
364
|
console.log(_cliKit.chalk.white(`Traceability Agent override file has been placed at ${process.cwd()}/${ConfigFiles.TAHelmOverride}`));
|
|
453
365
|
finishUp += `helm upgrade --install --namespace ${namespace} v7-traceability axway/v7-traceability -f ${ConfigFiles.TAHelmOverride}`;
|
|
454
366
|
}
|
|
455
|
-
|
|
456
367
|
console.log(_cliKit.chalk.white('\nTo deploy the Agents run the following commands\n'));
|
|
457
368
|
console.log(_cliKit.chalk.cyan('helm repo add axway https://charts.axway.com/charts'));
|
|
458
369
|
console.log(_cliKit.chalk.cyan(finishUp));
|
|
459
370
|
};
|
|
460
|
-
|
|
461
371
|
const edgeAgentNameMap = {
|
|
462
372
|
[_types.AgentTypes.da]: _types.AgentNames.EDGE_DA,
|
|
463
373
|
[_types.AgentTypes.ta]: _types.AgentNames.EDGE_TA
|
|
464
374
|
};
|
|
465
|
-
const EdgeInstallMethods = {
|
|
375
|
+
const EdgeInstallMethods = exports.EdgeInstallMethods = {
|
|
466
376
|
GetBundleType: askBundleType,
|
|
467
377
|
GetDeploymentType: askConfigType,
|
|
468
378
|
AskGatewayQuestions: gatewayConnectivity,
|
|
@@ -472,8 +382,7 @@ const EdgeInstallMethods = {
|
|
|
472
382
|
AgentNameMap: edgeAgentNameMap,
|
|
473
383
|
GatewayDisplay: _types.GatewayTypes.EDGE_GATEWAY
|
|
474
384
|
};
|
|
475
|
-
exports.
|
|
476
|
-
const EdgeGWOnlyInstallMethods = {
|
|
385
|
+
const EdgeGWOnlyInstallMethods = exports.EdgeGWOnlyInstallMethods = {
|
|
477
386
|
GetBundleType: askBundleTypeGWOnly,
|
|
478
387
|
GetDeploymentType: askConfigType,
|
|
479
388
|
AskGatewayQuestions: gatewayConnectivity,
|
|
@@ -483,11 +392,9 @@ const EdgeGWOnlyInstallMethods = {
|
|
|
483
392
|
AgentNameMap: edgeAgentNameMap,
|
|
484
393
|
GatewayDisplay: _types.GatewayTypes.EDGE_GATEWAY
|
|
485
394
|
};
|
|
486
|
-
exports.
|
|
487
|
-
const testables = {
|
|
395
|
+
const testables = exports.testables = {
|
|
488
396
|
prompts,
|
|
489
397
|
ConfigFiles,
|
|
490
398
|
defaultLogFiles,
|
|
491
399
|
defaultOTLogFiles
|
|
492
|
-
};
|
|
493
|
-
exports.testables = testables;
|
|
400
|
+
};
|