@axway/axway-central-cli 2.17.0 → 2.18.0-rc.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 +44 -73
- package/dist/commands/install/apigeexSaasAgents.js +35 -98
- package/dist/commands/install/awsAgents.js +89 -139
- package/dist/commands/install/awsSaasAgents.js +50 -142
- package/dist/commands/install/azureAgents.js +39 -79
- package/dist/commands/install/edgeAgents.js +17 -110
- 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 +40 -117
- package/dist/commands/install/platform.js +20 -52
- 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 +116 -341
- package/dist/common/utils.js +37 -99
- package/dist/main.js +0 -2
- package/package.json +2 -2
|
@@ -4,64 +4,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.testables = exports.setupKubernetes = exports.setupIstio = exports.istioSystemNs = exports.istioPrompts = exports.installPreprocess = exports.getCondorHost = exports.gatewayConnectivity = exports.gatewayCertSecret = exports.defaultLogFiles = exports.createIstioOverride = exports.createIstioGatewayCert = exports.createHybridOverride = exports.createEnvResources = exports.completeInstall = exports.askIstioSecret = exports.askConfigType = exports.askBundleType = exports.amplifyAgentsNs = exports.amplifyAgentsCredsSecret = exports.ampcDemoNs = exports.IstioInstallMethods = exports.ConfigFiles = exports.AlsMode = void 0;
|
|
7
|
-
|
|
8
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
|
|
10
8
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
11
|
-
|
|
12
9
|
var _bashCommands = require("../../common/bashCommands");
|
|
13
|
-
|
|
14
10
|
var _basicPrompts = require("../../common/basicPrompts");
|
|
15
|
-
|
|
16
11
|
var _Kubectl = require("../../common/Kubectl");
|
|
17
|
-
|
|
18
12
|
var _types = require("../../common/types");
|
|
19
|
-
|
|
20
13
|
var _utils = require("../../common/utils");
|
|
21
|
-
|
|
22
|
-
var helpers =
|
|
23
|
-
|
|
14
|
+
var _helpers = _interopRequireWildcard(require("./helpers"));
|
|
15
|
+
var helpers = _helpers;
|
|
24
16
|
var _inputs = require("./helpers/inputs");
|
|
25
|
-
|
|
26
17
|
var _istioTemplates = require("./helpers/templates/istioTemplates");
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
21
|
// @ts-ignore
|
|
35
22
|
const {
|
|
36
23
|
log
|
|
37
24
|
} = (0, _snooplogg.default)('central: install: agents: istio:');
|
|
38
|
-
const amplifyAgentsNs = 'amplify-agents';
|
|
39
|
-
exports.
|
|
40
|
-
const
|
|
41
|
-
exports.
|
|
42
|
-
const
|
|
43
|
-
exports.
|
|
44
|
-
|
|
45
|
-
exports.ampcDemoNs = ampcDemoNs;
|
|
46
|
-
const defaultLogFiles = '/group-*_instance-*.log';
|
|
47
|
-
exports.defaultLogFiles = defaultLogFiles;
|
|
48
|
-
const amplifyAgentsCredsSecret = 'amplify-agents-credentials';
|
|
49
|
-
exports.amplifyAgentsCredsSecret = amplifyAgentsCredsSecret;
|
|
50
|
-
let AlsMode; // ConfigFiles - all the config file that are used in the setup
|
|
51
|
-
|
|
52
|
-
exports.AlsMode = AlsMode;
|
|
53
|
-
|
|
54
|
-
(function (AlsMode) {
|
|
25
|
+
const amplifyAgentsNs = exports.amplifyAgentsNs = 'amplify-agents';
|
|
26
|
+
const gatewayCertSecret = exports.gatewayCertSecret = 'gateway-cert';
|
|
27
|
+
const istioSystemNs = exports.istioSystemNs = 'istio-system';
|
|
28
|
+
const ampcDemoNs = exports.ampcDemoNs = 'ampc-demo';
|
|
29
|
+
const defaultLogFiles = exports.defaultLogFiles = '/group-*_instance-*.log';
|
|
30
|
+
const amplifyAgentsCredsSecret = exports.amplifyAgentsCredsSecret = 'amplify-agents-credentials';
|
|
31
|
+
let AlsMode = exports.AlsMode = /*#__PURE__*/function (AlsMode) {
|
|
55
32
|
AlsMode["Verbose"] = "verbose";
|
|
56
33
|
AlsMode["Default"] = "default";
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const ConfigFiles = {
|
|
34
|
+
return AlsMode;
|
|
35
|
+
}({}); // ConfigFiles - all the config file that are used in the setup
|
|
36
|
+
const ConfigFiles = exports.ConfigFiles = {
|
|
60
37
|
IstioOverrideFile: 'istio-override.yaml',
|
|
61
38
|
HybridOverrideFile: 'hybrid-override.yaml'
|
|
62
39
|
};
|
|
63
|
-
exports.
|
|
64
|
-
const istioPrompts = {
|
|
40
|
+
const istioPrompts = exports.istioPrompts = {
|
|
65
41
|
// istio
|
|
66
42
|
enterProtocol: 'Enter the protocol to use for the ingress gateway',
|
|
67
43
|
enterPort: 'Enter the Kubernetes cluster port',
|
|
@@ -78,23 +54,17 @@ const istioPrompts = {
|
|
|
78
54
|
alsMode: 'Select Traceability Agent HTTP header publishing mode',
|
|
79
55
|
demoService: 'Do you want to deploy the optional demo application?'
|
|
80
56
|
};
|
|
81
|
-
exports.istioPrompts = istioPrompts;
|
|
82
|
-
|
|
83
57
|
const askBundleType = async () => {
|
|
84
58
|
return await (0, _basicPrompts.askList)({
|
|
85
59
|
msg: helpers.agentMessages.selectAgentType,
|
|
86
60
|
choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
|
|
87
61
|
});
|
|
88
62
|
};
|
|
89
|
-
|
|
90
63
|
exports.askBundleType = askBundleType;
|
|
91
|
-
|
|
92
64
|
const askConfigType = async () => {
|
|
93
65
|
return _types.AgentConfigTypes.DOCKERIZED;
|
|
94
66
|
};
|
|
95
|
-
|
|
96
67
|
exports.askConfigType = askConfigType;
|
|
97
|
-
|
|
98
68
|
const gatewayConnectivity = async (installConfig, apiServerClient, defsManager) => {
|
|
99
69
|
let istioValues = new _istioTemplates.IstioValues();
|
|
100
70
|
console.log('\nCONNECTING A KUBERNETES CLUSTER TO AMPLIFY CENTRAL\n');
|
|
@@ -107,14 +77,13 @@ https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/m
|
|
|
107
77
|
const {
|
|
108
78
|
error
|
|
109
79
|
} = await _Kubectl.kubectl.isInstalled();
|
|
110
|
-
|
|
111
80
|
if (error) {
|
|
112
81
|
throw new Error(`Kubectl is required to fill out the following prompts. It appears to be missing or misconfigured.\n${error}`);
|
|
113
82
|
}
|
|
114
|
-
|
|
115
83
|
const istioOverrides = await setupIstio(istioValues);
|
|
116
|
-
installConfig.gatewayConfig = istioValues;
|
|
84
|
+
installConfig.gatewayConfig = istioValues;
|
|
117
85
|
|
|
86
|
+
// Set up the following values from installConfig to be used in setupKubernetes
|
|
118
87
|
istioValues.istioAgentValues.alsEnabled = installConfig.switches.isTaEnabled;
|
|
119
88
|
istioValues.istioAgentValues.discoveryEnabled = installConfig.switches.isDaEnabled;
|
|
120
89
|
const hybridOverrides = await setupKubernetes(istioValues, apiServerClient, defsManager);
|
|
@@ -123,27 +92,23 @@ https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/m
|
|
|
123
92
|
istioOverrides.enableAls = hybridOverrides.alsMode === AlsMode.Verbose;
|
|
124
93
|
istioOverrides.enableTracing = hybridOverrides.alsEnabled;
|
|
125
94
|
return istioValues;
|
|
126
|
-
};
|
|
127
|
-
|
|
95
|
+
};
|
|
128
96
|
|
|
97
|
+
// Questions for the istio configuration
|
|
129
98
|
exports.gatewayConnectivity = gatewayConnectivity;
|
|
130
|
-
|
|
131
99
|
const askUseExistingIstio = async () => (0, _basicPrompts.askList)({
|
|
132
100
|
msg: istioPrompts.existingIstio,
|
|
133
101
|
choices: _types.YesNoChoices
|
|
134
102
|
});
|
|
135
|
-
|
|
136
103
|
const askEnvoyFilterNamespace = async namespaces => (0, _basicPrompts.askList)({
|
|
137
104
|
msg: istioPrompts.askEnvoyFilterNamespace,
|
|
138
105
|
choices: namespaces.data
|
|
139
106
|
});
|
|
140
|
-
|
|
141
107
|
const askHost = async () => await (0, _basicPrompts.askInput)({
|
|
142
108
|
msg: istioPrompts.enterDomainName,
|
|
143
|
-
validate: (0, _basicPrompts.validateRegex)(
|
|
109
|
+
validate: (0, _basicPrompts.validateRegex)(_helpers.domainNameRegex, _helpers.invalidDomainName),
|
|
144
110
|
allowEmptyInput: true
|
|
145
111
|
});
|
|
146
|
-
|
|
147
112
|
const askProtocol = async () => (0, _basicPrompts.askList)({
|
|
148
113
|
msg: istioPrompts.enterProtocol,
|
|
149
114
|
choices: [{
|
|
@@ -154,13 +119,11 @@ const askProtocol = async () => (0, _basicPrompts.askList)({
|
|
|
154
119
|
value: _types.Protocol.HTTPS
|
|
155
120
|
}]
|
|
156
121
|
});
|
|
157
|
-
|
|
158
122
|
const askPort = async protocol => await (0, _basicPrompts.askInput)({
|
|
159
123
|
msg: istioPrompts.enterPort,
|
|
160
124
|
type: 'number',
|
|
161
125
|
defaultValue: protocol === _types.Protocol.HTTP ? 8080 : 443
|
|
162
126
|
});
|
|
163
|
-
|
|
164
127
|
const askCertificateOption = async () => (0, _basicPrompts.askList)({
|
|
165
128
|
msg: istioPrompts.generateCertPrompt,
|
|
166
129
|
choices: [{
|
|
@@ -171,18 +134,16 @@ const askCertificateOption = async () => (0, _basicPrompts.askList)({
|
|
|
171
134
|
value: _types.Certificate.PROVIDE
|
|
172
135
|
}]
|
|
173
136
|
});
|
|
174
|
-
|
|
175
137
|
const askIstioProfile = async () => (0, _basicPrompts.askList)({
|
|
176
138
|
msg: istioPrompts.istioProfile,
|
|
177
139
|
choices: _types.IstioProfileChoices
|
|
178
|
-
});
|
|
179
|
-
|
|
140
|
+
});
|
|
180
141
|
|
|
142
|
+
//Setup Overrides
|
|
181
143
|
const setupIstio = async istioValues => {
|
|
182
144
|
let istioInstallValues = istioValues.istioInstallValues;
|
|
183
145
|
console.log(_chalk.default.gray('If Istio is not yet installed, select No. If Istio is already running select Yes.\n'));
|
|
184
146
|
const useExistingIstio = await askUseExistingIstio();
|
|
185
|
-
|
|
186
147
|
if (useExistingIstio === _types.YesNo.Yes) {
|
|
187
148
|
const namespaces = await _Kubectl.kubectl.get('namespaces');
|
|
188
149
|
if (namespaces.error) throw new Error(namespaces.error);
|
|
@@ -191,48 +152,40 @@ const setupIstio = async istioValues => {
|
|
|
191
152
|
istioInstallValues.isNewInstall = false;
|
|
192
153
|
return istioInstallValues;
|
|
193
154
|
}
|
|
194
|
-
|
|
195
155
|
istioInstallValues.profile = await askIstioProfile();
|
|
196
156
|
console.log(_chalk.default.gray('\nFor a Kubernetes cluster exposing HTTPS endpoints, you must own or be able to configure a certificate for the correspoinding fully qualified domain name\n'));
|
|
197
157
|
istioInstallValues.host = (await askHost()).toLowerCase();
|
|
198
|
-
|
|
199
158
|
if (istioInstallValues.host) {
|
|
200
159
|
istioInstallValues.protocol = await askProtocol();
|
|
201
160
|
istioInstallValues.port = await askPort(istioInstallValues.protocol);
|
|
202
|
-
|
|
203
161
|
if (istioInstallValues.protocol === _types.Protocol.HTTPS) {
|
|
204
162
|
istioInstallValues.certSecretName = await askIstioSecret(istioPrompts.enterIstioSecret, istioSystemNs, gatewayCertSecret);
|
|
205
163
|
istioInstallValues.certificateOption = await askCertificateOption();
|
|
206
164
|
}
|
|
207
165
|
}
|
|
208
|
-
|
|
209
166
|
istioInstallValues.targetPort = istioInstallValues.protocol === _types.Protocol.HTTP ? 8080 : 8443;
|
|
210
167
|
return istioValues.istioInstallValues;
|
|
211
168
|
};
|
|
212
|
-
|
|
213
169
|
exports.setupIstio = setupIstio;
|
|
214
|
-
|
|
215
170
|
const askIstioSecret = async (msg, namespace, defaultSecretName) => {
|
|
216
|
-
const allSecrets = await _Kubectl.kubectl.get('secrets', `-n ${namespace}`);
|
|
217
|
-
|
|
171
|
+
const allSecrets = await _Kubectl.kubectl.get('secrets', `-n ${namespace}`);
|
|
172
|
+
// No resources errors are ok. Throw an error for anything else.
|
|
218
173
|
if (allSecrets.error && !allSecrets.error.includes('K8S secrets: No resources found')) throw Error(allSecrets.error);
|
|
219
174
|
return (0, _inputs.askForSecretName)(msg, defaultSecretName, allSecrets.data);
|
|
220
175
|
};
|
|
221
|
-
|
|
222
176
|
exports.askIstioSecret = askIstioSecret;
|
|
223
|
-
|
|
224
177
|
const completeIstio = async istioOverrides => {
|
|
225
178
|
if (istioOverrides.protocol === _types.Protocol.HTTPS) {
|
|
226
179
|
if (istioOverrides.isNewInstall) {
|
|
227
180
|
await _Kubectl.kubectl.create('ns', istioSystemNs);
|
|
228
181
|
}
|
|
229
|
-
|
|
230
182
|
await createIstioGatewayCert(istioOverrides.envoyFilterNamespace, istioOverrides);
|
|
231
183
|
}
|
|
232
|
-
};
|
|
233
|
-
// Questions for the kubernetes configuration
|
|
184
|
+
};
|
|
234
185
|
|
|
186
|
+
// Above this line is Istio. Below is Kubernetes
|
|
235
187
|
|
|
188
|
+
// Questions for the kubernetes configuration
|
|
236
189
|
const askALSMode = async () => {
|
|
237
190
|
return (0, _basicPrompts.askList)({
|
|
238
191
|
msg: istioPrompts.alsMode,
|
|
@@ -245,7 +198,6 @@ const askALSMode = async () => {
|
|
|
245
198
|
}]
|
|
246
199
|
});
|
|
247
200
|
};
|
|
248
|
-
|
|
249
201
|
const askVsNamespacePrompt = async () => {
|
|
250
202
|
const namespaces = await _Kubectl.kubectl.get('ns');
|
|
251
203
|
if (namespaces.error) throw Error(namespaces.error);
|
|
@@ -254,49 +206,41 @@ const askVsNamespacePrompt = async () => {
|
|
|
254
206
|
choices: namespaces.data
|
|
255
207
|
});
|
|
256
208
|
};
|
|
257
|
-
|
|
258
209
|
const askEnableDemoSvc = async () => {
|
|
259
210
|
const res = (0, _basicPrompts.askList)({
|
|
260
211
|
msg: istioPrompts.demoService,
|
|
261
212
|
choices: _types.YesNoChoices
|
|
262
213
|
});
|
|
263
214
|
return (await res) === _types.YesNo.Yes ? true : false;
|
|
264
|
-
};
|
|
265
|
-
|
|
215
|
+
};
|
|
266
216
|
|
|
217
|
+
//Setup Overrides
|
|
267
218
|
const setupKubernetes = async (istioValues, apiServerClient, defsManager) => {
|
|
268
219
|
let istioAgentValues = istioValues.istioAgentValues;
|
|
269
220
|
console.log(_chalk.default.gray(`\nThere are several steps to prepare a Kubernetes cluster for the Amplify Istio Agents.\nThe following questions collect the namespace and secret to use for the Istio gateway.\n`));
|
|
270
|
-
|
|
271
221
|
if (istioAgentValues.alsEnabled) {
|
|
272
222
|
console.log(_chalk.default.gray(`\nThe Istio Traceability Agent can log a minimal set of HTTP headers needed for transaction publishing (default) or it can capture all headers (verbose).\n`));
|
|
273
223
|
istioAgentValues.alsMode = await askALSMode();
|
|
274
224
|
}
|
|
275
|
-
|
|
276
225
|
if (istioAgentValues.discoveryEnabled) {
|
|
277
226
|
const ns = await askVsNamespacePrompt();
|
|
278
227
|
istioAgentValues.discoveryNamespaces = [ns];
|
|
279
228
|
}
|
|
280
|
-
|
|
281
229
|
istioAgentValues.namespace = await (0, _inputs.askNamespace)(istioPrompts.meshAgentNamespace, amplifyAgentsNs);
|
|
282
230
|
istioAgentValues.demoSvcEnabled = await askEnableDemoSvc();
|
|
283
|
-
|
|
284
231
|
if (istioAgentValues.discoveryEnabled && istioAgentValues.demoSvcEnabled && !istioAgentValues.discoveryNamespaces.includes(ampcDemoNs)) {
|
|
285
232
|
istioAgentValues.discoveryNamespaces.push(ampcDemoNs);
|
|
286
|
-
}
|
|
287
|
-
|
|
233
|
+
}
|
|
288
234
|
|
|
235
|
+
// set keySecretName
|
|
289
236
|
istioAgentValues.keysSecretName = helpers.amplifyAgentsKeysSecret;
|
|
290
|
-
istioAgentValues.clusterName = await (0,
|
|
237
|
+
istioAgentValues.clusterName = await (0, _helpers.askK8sClusterName)(apiServerClient, defsManager);
|
|
291
238
|
return istioAgentValues;
|
|
292
239
|
};
|
|
293
|
-
|
|
294
240
|
exports.setupKubernetes = setupKubernetes;
|
|
295
|
-
|
|
296
241
|
const createIstioGatewayCert = async (namespace, istioOverrides) => {
|
|
297
242
|
let privateKey = '';
|
|
298
243
|
let cert = '';
|
|
299
|
-
|
|
300
244
|
if (istioOverrides.certificateOption === _types.Certificate.GENERATE) {
|
|
301
245
|
({
|
|
302
246
|
cert,
|
|
@@ -305,13 +249,12 @@ const createIstioGatewayCert = async (namespace, istioOverrides) => {
|
|
|
305
249
|
console.log(`Created ${istioOverrides.certSecretName}.crt and ${istioOverrides.certSecretName}.key in ${process.cwd()}`);
|
|
306
250
|
} else {
|
|
307
251
|
privateKey = await (0, _basicPrompts.askInput)({
|
|
308
|
-
msg:
|
|
252
|
+
msg: _helpers.enterPublicKeyPath
|
|
309
253
|
});
|
|
310
254
|
cert = await (0, _basicPrompts.askInput)({
|
|
311
255
|
msg: istioPrompts.enterCertPath
|
|
312
256
|
});
|
|
313
257
|
}
|
|
314
|
-
|
|
315
258
|
const {
|
|
316
259
|
data,
|
|
317
260
|
error
|
|
@@ -319,12 +262,9 @@ const createIstioGatewayCert = async (namespace, istioOverrides) => {
|
|
|
319
262
|
if (error) throw new Error(error);
|
|
320
263
|
console.log(`Created ${data[0]} in the ${namespace} namespace.`);
|
|
321
264
|
};
|
|
322
|
-
|
|
323
265
|
exports.createIstioGatewayCert = createIstioGatewayCert;
|
|
324
|
-
|
|
325
266
|
const getCondorHost = (region, env, apicDeployment) => {
|
|
326
267
|
var _hosts$region, _hosts$region$env;
|
|
327
|
-
|
|
328
268
|
const hosts = {
|
|
329
269
|
[_types.Regions.US]: {
|
|
330
270
|
[_types.Platforms.prod]: {
|
|
@@ -355,30 +295,23 @@ const getCondorHost = (region, env, apicDeployment) => {
|
|
|
355
295
|
};
|
|
356
296
|
return ((_hosts$region = hosts[region]) === null || _hosts$region === void 0 ? void 0 : (_hosts$region$env = _hosts$region[env]) === null || _hosts$region$env === void 0 ? void 0 : _hosts$region$env[apicDeployment]) || _types.IngestionHosts.US;
|
|
357
297
|
};
|
|
358
|
-
|
|
359
298
|
exports.getCondorHost = getCondorHost;
|
|
360
|
-
|
|
361
299
|
const createIstioOverride = overrides => {
|
|
362
300
|
const overrideFileName = ConfigFiles.IstioOverrideFile;
|
|
363
301
|
(0, _utils.writeTemplates)(overrideFileName, overrides, helpers.istioInstallTemplate);
|
|
364
302
|
console.log(`\nIstio override file has been placed at ${process.cwd()}/${overrideFileName}`);
|
|
365
|
-
|
|
366
303
|
if (overrides.istioInstallValues.isNewInstall) {
|
|
367
304
|
console.log('To complete the istio installation run the following command:', _chalk.default.cyan(`\n istioctl install --set profile=${overrides.istioInstallValues.profile} -f ${overrideFileName}\n`));
|
|
368
305
|
} else {
|
|
369
306
|
console.log(_chalk.default.cyan(` Please merge the generated ${overrideFileName} file with your Istio configuration to allow the Traceability Agent to function.\n`));
|
|
370
307
|
}
|
|
371
308
|
};
|
|
372
|
-
|
|
373
309
|
exports.createIstioOverride = createIstioOverride;
|
|
374
|
-
|
|
375
310
|
const createEnvResources = async (client, defs, clusterName) => {
|
|
376
311
|
// Create the mesh K8SCluster resource
|
|
377
312
|
await helpers.createByResourceType(client, defs, clusterName, 'K8SCluster', 'k8sc', {}, '');
|
|
378
313
|
};
|
|
379
|
-
|
|
380
314
|
exports.createEnvResources = createEnvResources;
|
|
381
|
-
|
|
382
315
|
const createHybridOverride = overrides => {
|
|
383
316
|
const overrideFileName = ConfigFiles.HybridOverrideFile;
|
|
384
317
|
(0, _utils.writeTemplates)(overrideFileName, overrides, helpers.istioAgentsTemplate);
|
|
@@ -386,55 +319,47 @@ const createHybridOverride = overrides => {
|
|
|
386
319
|
const installCmd = `helm upgrade --install --namespace ${overrides.istioAgentValues.namespace.name} ampc-hybrid axway/ampc-hybrid -f ${overrideFileName}`;
|
|
387
320
|
console.log('To complete the Istio agent installation run the following commands:', _chalk.default.cyan('\n helm repo add axway https://charts.axway.com/charts'), _chalk.default.cyan(`\n helm repo update\n ${installCmd}`));
|
|
388
321
|
};
|
|
389
|
-
|
|
390
322
|
exports.createHybridOverride = createHybridOverride;
|
|
391
|
-
|
|
392
323
|
const installPreprocess = async installConfig => {
|
|
393
324
|
// name of the service account, and if it is new or not
|
|
325
|
+
|
|
394
326
|
if (!installConfig.centralConfig.ampcDosaInfo.isNew) {
|
|
395
327
|
[installConfig.centralConfig.dosaAccount.publicKey, installConfig.centralConfig.dosaAccount.privateKey] = await helpers.askPublicAndPrivateKeysPath();
|
|
396
328
|
} else {
|
|
397
329
|
console.log(_chalk.default.yellow(`The secret will be created with the same "private_key.pem" and "public_key.pem" that will be auto generated to create the Service Account, following the completion of these prompts.`));
|
|
398
330
|
}
|
|
399
|
-
|
|
400
331
|
return installConfig;
|
|
401
332
|
};
|
|
402
|
-
|
|
403
333
|
exports.installPreprocess = installPreprocess;
|
|
404
|
-
|
|
405
334
|
const completeInstall = async (installConfig, apiServerClient, defsManager) => {
|
|
406
335
|
// Contents of completeKubernetes moved here.
|
|
407
|
-
const istioValues = installConfig.gatewayConfig; // Add final settings to IstioAgentsValues
|
|
408
336
|
|
|
337
|
+
const istioValues = installConfig.gatewayConfig;
|
|
338
|
+
|
|
339
|
+
// Add final settings to IstioAgentsValues
|
|
409
340
|
istioValues.centralConfig = installConfig.centralConfig;
|
|
410
341
|
istioValues.traceabilityConfig = installConfig.traceabilityConfig;
|
|
411
342
|
await completeIstio(istioValues.istioInstallValues);
|
|
412
|
-
|
|
413
343
|
if (istioValues.istioAgentValues.namespace.isNew) {
|
|
414
344
|
await helpers.createNamespace(istioValues.istioAgentValues.namespace.name);
|
|
415
345
|
}
|
|
416
|
-
|
|
417
346
|
await helpers.createSecret(istioValues.istioAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, async () => {
|
|
418
347
|
if (installConfig.centralConfig.ampcDosaInfo.isNew) {
|
|
419
348
|
console.log(_chalk.default.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.`));
|
|
420
349
|
}
|
|
421
|
-
|
|
422
350
|
await helpers.createAmplifyAgentKeysSecret(istioValues.istioAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, 'publicKey', istioValues.centralConfig.dosaAccount.publicKey, 'privateKey', istioValues.centralConfig.dosaAccount.privateKey);
|
|
423
351
|
});
|
|
424
|
-
|
|
425
352
|
if (installConfig.switches.isDaEnabled) {
|
|
426
353
|
await createEnvResources(apiServerClient, defsManager, istioValues.istioAgentValues.clusterName);
|
|
427
354
|
}
|
|
428
|
-
|
|
429
355
|
console.log('Generating the configuration file(s)...');
|
|
430
356
|
createIstioOverride(istioValues);
|
|
431
357
|
createHybridOverride(istioValues);
|
|
432
358
|
console.log('Configuration file(s) have been successfully created.\n');
|
|
433
359
|
console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.ISTIO}`));
|
|
434
360
|
};
|
|
435
|
-
|
|
436
361
|
exports.completeInstall = completeInstall;
|
|
437
|
-
const IstioInstallMethods = {
|
|
362
|
+
const IstioInstallMethods = exports.IstioInstallMethods = {
|
|
438
363
|
GetBundleType: askBundleType,
|
|
439
364
|
GetDeploymentType: askConfigType,
|
|
440
365
|
AskGatewayQuestions: gatewayConnectivity,
|
|
@@ -443,11 +368,9 @@ const IstioInstallMethods = {
|
|
|
443
368
|
ConfigFiles: Object.values(ConfigFiles),
|
|
444
369
|
GatewayDisplay: _types.GatewayTypes.ISTIO
|
|
445
370
|
};
|
|
446
|
-
exports.
|
|
447
|
-
const testables = {
|
|
371
|
+
const testables = exports.testables = {
|
|
448
372
|
istioPrompts,
|
|
449
373
|
ConfigFiles,
|
|
450
374
|
defaultLogFiles,
|
|
451
375
|
amplifyAgentsCredsSecret
|
|
452
|
-
};
|
|
453
|
-
exports.testables = testables;
|
|
376
|
+
};
|
|
@@ -4,48 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getTraceabilityConfig = exports.getCentralConfig = exports.getApicDeployment = exports.finalizeCentralInstall = void 0;
|
|
7
|
-
|
|
8
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
|
|
10
8
|
var _basicPrompts = require("../../common/basicPrompts");
|
|
11
|
-
|
|
12
9
|
var _CliConfigManager = require("../../common/CliConfigManager");
|
|
13
|
-
|
|
14
10
|
var _CoreConfigController = require("../../common/CoreConfigController");
|
|
15
|
-
|
|
16
11
|
var _types = require("../../common/types");
|
|
17
|
-
|
|
18
12
|
var _utils = require("../../common/utils");
|
|
19
|
-
|
|
20
13
|
var _awsAgents = require("./awsAgents");
|
|
21
|
-
|
|
22
14
|
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
|
|
30
18
|
//
|
|
31
19
|
// Complex prompts
|
|
32
20
|
//
|
|
33
21
|
const askTeamName = async client => {
|
|
34
22
|
var _teams$find;
|
|
35
|
-
|
|
36
23
|
const teams = await client.getTeams();
|
|
37
|
-
|
|
38
24
|
if (!(teams !== null && teams !== void 0 && teams.length)) {
|
|
39
25
|
throw new Error('Account has no teams!');
|
|
40
26
|
}
|
|
41
|
-
|
|
42
27
|
return (0, _basicPrompts.askList)({
|
|
43
28
|
msg: helpers.envMessages.selectTeam,
|
|
44
29
|
choices: teams.map(t => t.name).sort((name1, name2) => name1.localeCompare(name2)),
|
|
45
30
|
default: (_teams$find = teams.find(t => t.default)) === null || _teams$find === void 0 ? void 0 : _teams$find.name
|
|
46
31
|
});
|
|
47
32
|
};
|
|
48
|
-
|
|
49
33
|
const askIsProductionEnvironment = async () => {
|
|
50
34
|
return (await (0, _basicPrompts.askList)({
|
|
51
35
|
msg: helpers.envMessages.isProduction,
|
|
@@ -53,16 +37,14 @@ const askIsProductionEnvironment = async () => {
|
|
|
53
37
|
default: _types.YesNo.Yes
|
|
54
38
|
})) === _types.YesNo.Yes;
|
|
55
39
|
};
|
|
56
|
-
|
|
57
40
|
const getTraceabilityConfig = async installConfig => {
|
|
58
41
|
let traceabilityConfig = new _types.TraceabilityConfig();
|
|
59
|
-
|
|
60
42
|
if (installConfig.gatewayType === _types.GatewayTypes.AWS_GATEWAY && installConfig.gatewayConfig.cloudFormationConfig.DeploymentType === _awsAgents.DeploymentTypes.ECS_FARGATE) {
|
|
61
43
|
return traceabilityConfig;
|
|
62
44
|
}
|
|
45
|
+
traceabilityConfig.usageReportingOffline = installConfig.bundleType === _types.BundleType.TRACEABILITY_OFFLINE;
|
|
63
46
|
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
// Do not ask Traceability questions in offline mode
|
|
66
48
|
if (!traceabilityConfig.usageReportingOffline) {
|
|
67
49
|
console.log('\nCONNECTION TO TRACEABILITY MODULE:');
|
|
68
50
|
const {
|
|
@@ -77,100 +59,87 @@ const getTraceabilityConfig = async installConfig => {
|
|
|
77
59
|
traceabilityConfig.protocol = traceabilityProtocol;
|
|
78
60
|
traceabilityConfig.host = helpers.getIngestionHost(installConfig.centralConfig.region, _CoreConfigController.CoreConfigController.getEnv(), installConfig.centralConfig.deployment, traceabilityProtocol);
|
|
79
61
|
}
|
|
80
|
-
|
|
81
62
|
return traceabilityConfig;
|
|
82
63
|
};
|
|
83
|
-
|
|
84
64
|
exports.getTraceabilityConfig = getTraceabilityConfig;
|
|
85
|
-
|
|
86
65
|
const getCentralConfig = async (apiServerClient, platformClient, defsManager, apicDeployment, installConfig) => {
|
|
87
66
|
// initiate CentralAgentConfig
|
|
88
67
|
let centralConfig = installConfig.centralConfig;
|
|
89
68
|
await centralConfig.setBaseHost();
|
|
90
69
|
centralConfig.authUrl = `${_CoreConfigController.CoreConfigController.getAuthUrl()}/auth`;
|
|
91
70
|
centralConfig.region = String(apiServerClient.region || (await (0, _utils.getConfig)())[_types.ConfigTypes.REGION] || _types.Regions.US).toUpperCase();
|
|
92
|
-
centralConfig.deployment = apicDeployment || getApicDeployment(centralConfig.region, _CoreConfigController.CoreConfigController.getEnv());
|
|
71
|
+
centralConfig.deployment = apicDeployment || getApicDeployment(centralConfig.region, _CoreConfigController.CoreConfigController.getEnv());
|
|
93
72
|
|
|
73
|
+
// apic config
|
|
94
74
|
console.log('\nCONNECTION TO AMPLIFY PLATFORM:');
|
|
95
|
-
console.log(_chalk.default.gray(`The agents need access to the Amplify Platform to register services.`));
|
|
75
|
+
console.log(_chalk.default.gray(`The agents need access to the Amplify Platform to register services.`));
|
|
96
76
|
|
|
77
|
+
// create/find environment
|
|
97
78
|
centralConfig.orgId = await helpers.getCurrentUserOrgId();
|
|
98
79
|
centralConfig.ampcEnvInfo = await helpers.askEnvironmentName(apiServerClient, defsManager, centralConfig.axwayManaged);
|
|
99
80
|
centralConfig.production = centralConfig.ampcEnvInfo.isNew ? await askIsProductionEnvironment() : false;
|
|
100
|
-
|
|
101
81
|
if (!installConfig.switches.isOrgRep) {
|
|
102
82
|
centralConfig.ampcTeamName = await askTeamName(platformClient);
|
|
103
83
|
}
|
|
104
|
-
|
|
105
84
|
centralConfig.ampcDosaInfo = {
|
|
106
85
|
clientId: '',
|
|
107
86
|
name: '',
|
|
108
87
|
isNew: false
|
|
109
88
|
};
|
|
110
|
-
|
|
111
89
|
if (installConfig.bundleType !== _types.BundleType.TRACEABILITY_OFFLINE && !installConfig.switches.isHostedInstall) {
|
|
112
90
|
centralConfig.ampcDosaInfo = await helpers.askDosaClientId(platformClient);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
centralConfig.daAgentName = ''; // Istio will not prompt for agent name. Remove when that ability exists
|
|
91
|
+
}
|
|
117
92
|
|
|
93
|
+
// Get the DA Agent name
|
|
94
|
+
centralConfig.daAgentName = '';
|
|
95
|
+
// Istio will not prompt for agent name. Remove when that ability exists
|
|
118
96
|
if (installConfig.switches.isDaEnabled && !installConfig.switches.isHostedInstall) {
|
|
119
97
|
centralConfig.daAgentName = await helpers.askAgentName(apiServerClient, defsManager, _types.AgentTypes.da, centralConfig.ampcEnvInfo.name);
|
|
120
|
-
}
|
|
121
|
-
|
|
98
|
+
}
|
|
122
99
|
|
|
100
|
+
// Get the TA Agent name
|
|
123
101
|
centralConfig.taAgentName = '';
|
|
124
|
-
|
|
125
102
|
if (installConfig.switches.isTaEnabled && !installConfig.switches.isHostedInstall) {
|
|
126
103
|
centralConfig.taAgentName = await helpers.askAgentName(apiServerClient, defsManager, _types.AgentTypes.ta, centralConfig.ampcEnvInfo.name);
|
|
127
104
|
}
|
|
128
|
-
|
|
129
105
|
return centralConfig;
|
|
130
106
|
};
|
|
131
|
-
|
|
132
107
|
exports.getCentralConfig = getCentralConfig;
|
|
133
|
-
|
|
134
108
|
const finalizeCentralInstall = async (apiServerClient, platformClient, defsManager, installConfig) => {
|
|
135
109
|
/**
|
|
136
110
|
* Create agent resources
|
|
137
111
|
*/
|
|
138
112
|
console.log('Creating agent resources');
|
|
139
|
-
|
|
140
113
|
if (installConfig.centralConfig.ampcDosaInfo.isNew) {
|
|
141
114
|
installConfig.centralConfig.dosaAccount = await helpers.createDosaAndCerts(platformClient, installConfig.centralConfig.ampcDosaInfo.name);
|
|
142
115
|
} else {
|
|
143
116
|
installConfig.centralConfig.dosaAccount.clientId = installConfig.centralConfig.ampcDosaInfo.clientId;
|
|
144
117
|
}
|
|
118
|
+
installConfig.centralConfig.dosaAccount.updateKeyTemplateValues(installConfig.deploymentType);
|
|
145
119
|
|
|
146
|
-
|
|
147
|
-
|
|
120
|
+
// environment name
|
|
148
121
|
installConfig.centralConfig.environment = installConfig.centralConfig.ampcEnvInfo.isNew ? await helpers.createByResourceType(apiServerClient, defsManager, installConfig.centralConfig.ampcEnvInfo.name, 'Environment', 'env', {
|
|
149
122
|
axwayManaged: installConfig.centralConfig.axwayManaged,
|
|
150
123
|
production: installConfig.centralConfig.production
|
|
151
|
-
}) : installConfig.centralConfig.ampcEnvInfo.name;
|
|
124
|
+
}) : installConfig.centralConfig.ampcEnvInfo.name;
|
|
152
125
|
|
|
126
|
+
// Create DiscoveryAgent Resource unless gateway type is Istio. This can be removed when this is available for Istio
|
|
153
127
|
if (installConfig.centralConfig.daAgentName != '') {
|
|
154
128
|
installConfig.centralConfig.daAgentName = await helpers.createNewAgentResource(apiServerClient, defsManager, installConfig.centralConfig.environment, _types.GatewayTypeToDataPlane[installConfig.gatewayType], _types.AgentResourceKind.da, _types.AgentTypes.da, installConfig.centralConfig.ampcTeamName, installConfig.centralConfig.daAgentName);
|
|
155
|
-
}
|
|
156
|
-
|
|
129
|
+
}
|
|
157
130
|
|
|
131
|
+
// Create TraceabilityAgent Resource
|
|
158
132
|
if (installConfig.centralConfig.taAgentName != '') {
|
|
159
133
|
installConfig.centralConfig.taAgentName = await helpers.createNewAgentResource(apiServerClient, defsManager, installConfig.centralConfig.environment, _types.GatewayTypeToDataPlane[installConfig.gatewayType], _types.AgentResourceKind.ta, _types.AgentTypes.ta, installConfig.centralConfig.ampcTeamName, installConfig.centralConfig.taAgentName);
|
|
160
134
|
}
|
|
161
|
-
|
|
162
135
|
if (installConfig.bundleType === _types.BundleType.TRACEABILITY_OFFLINE || installConfig.gatewayType === _types.GatewayTypes.ISTIO) {
|
|
163
136
|
installConfig.centralConfig.environmentId = await helpers.getEnvironmentId(apiServerClient, defsManager, installConfig.centralConfig.environment);
|
|
164
137
|
}
|
|
165
|
-
|
|
166
138
|
return installConfig;
|
|
167
139
|
};
|
|
168
|
-
|
|
169
140
|
exports.finalizeCentralInstall = finalizeCentralInstall;
|
|
170
|
-
|
|
171
141
|
const getApicDeployment = (region, env) => {
|
|
172
142
|
var _deployments$region;
|
|
173
|
-
|
|
174
143
|
const deployments = {
|
|
175
144
|
[_types.Regions.US]: {
|
|
176
145
|
[_types.Platforms.prod]: _types.APICDeployments.US,
|
|
@@ -188,5 +157,4 @@ const getApicDeployment = (region, env) => {
|
|
|
188
157
|
const savedDeployment = new _CliConfigManager.CliConfigManager().getAll()['apic-deployment'];
|
|
189
158
|
return savedDeployment || (deployments === null || deployments === void 0 ? void 0 : (_deployments$region = deployments[region]) === null || _deployments$region === void 0 ? void 0 : _deployments$region[env]) || _types.APICDeployments.US;
|
|
190
159
|
};
|
|
191
|
-
|
|
192
160
|
exports.getApicDeployment = getApicDeployment;
|