@axway/axway-central-cli 4.5.0 → 4.6.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.
Files changed (83) hide show
  1. package/.security-profile-branches.json +18 -0
  2. package/package.json +1 -1
  3. package/dist/cli.js +0 -71
  4. package/dist/commands/apply/index.js +0 -112
  5. package/dist/commands/completion/index.js +0 -100
  6. package/dist/commands/config/common/index.js +0 -28
  7. package/dist/commands/config/index.js +0 -20
  8. package/dist/commands/config/list.js +0 -24
  9. package/dist/commands/config/set.js +0 -102
  10. package/dist/commands/config/unset.js +0 -48
  11. package/dist/commands/create/agentResource.js +0 -108
  12. package/dist/commands/create/environment.js +0 -62
  13. package/dist/commands/create/index.js +0 -109
  14. package/dist/commands/create/serviceAccount.js +0 -15
  15. package/dist/commands/delete/index.js +0 -196
  16. package/dist/commands/edit/environment.js +0 -101
  17. package/dist/commands/edit/index.js +0 -28
  18. package/dist/commands/get/index.js +0 -272
  19. package/dist/commands/install/agents.js +0 -290
  20. package/dist/commands/install/apigeexAgents.js +0 -223
  21. package/dist/commands/install/apigeexSaasAgents.js +0 -300
  22. package/dist/commands/install/awsAgents.js +0 -525
  23. package/dist/commands/install/awsSaasAgents.js +0 -508
  24. package/dist/commands/install/azureAgents.js +0 -242
  25. package/dist/commands/install/azureSaasAgents.js +0 -519
  26. package/dist/commands/install/backstageAgents.js +0 -167
  27. package/dist/commands/install/edgeAgents.js +0 -409
  28. package/dist/commands/install/gitHubSaasAgents.js +0 -294
  29. package/dist/commands/install/gitLabAgents.js +0 -178
  30. package/dist/commands/install/graylogAgent.js +0 -147
  31. package/dist/commands/install/helpers/creators.js +0 -359
  32. package/dist/commands/install/helpers/deleters.js +0 -36
  33. package/dist/commands/install/helpers/getters.js +0 -95
  34. package/dist/commands/install/helpers/index.js +0 -267
  35. package/dist/commands/install/helpers/inputs.js +0 -593
  36. package/dist/commands/install/helpers/regex.js +0 -67
  37. package/dist/commands/install/helpers/templates/apigeexTemplates.js +0 -109
  38. package/dist/commands/install/helpers/templates/awsTemplates.js +0 -129
  39. package/dist/commands/install/helpers/templates/azureTemplates.js +0 -125
  40. package/dist/commands/install/helpers/templates/backstageTemplates.js +0 -95
  41. package/dist/commands/install/helpers/templates/edgeTemplates.js +0 -360
  42. package/dist/commands/install/helpers/templates/gitLabTemplates.js +0 -66
  43. package/dist/commands/install/helpers/templates/graylogTemplates.js +0 -75
  44. package/dist/commands/install/helpers/templates/ibmAPIConnectTemplates.js +0 -116
  45. package/dist/commands/install/helpers/templates/istioTemplates.js +0 -214
  46. package/dist/commands/install/helpers/templates/kafkaTemplates.js +0 -194
  47. package/dist/commands/install/helpers/templates/sapApiPortalTemplates.js +0 -114
  48. package/dist/commands/install/helpers/templates/softwareAGWebMethodsTemplates.js +0 -93
  49. package/dist/commands/install/helpers/templates/traceableTemplates.js +0 -135
  50. package/dist/commands/install/helpers/templates/wso2Templates.js +0 -85
  51. package/dist/commands/install/helpers/util.js +0 -26
  52. package/dist/commands/install/ibmAPIConnectAgents.js +0 -213
  53. package/dist/commands/install/index.js +0 -36
  54. package/dist/commands/install/istioAgents.js +0 -346
  55. package/dist/commands/install/kafkaAgents.js +0 -303
  56. package/dist/commands/install/platform.js +0 -175
  57. package/dist/commands/install/sapApiPortalAgents.js +0 -198
  58. package/dist/commands/install/softwareAGWebMethodsAgents.js +0 -161
  59. package/dist/commands/install/swaggerHubSaasAgents.js +0 -272
  60. package/dist/commands/install/traceableAgents.js +0 -257
  61. package/dist/commands/install/traceableSaasAgents.js +0 -275
  62. package/dist/commands/install/wso2Agents.js +0 -163
  63. package/dist/commands/productize/helpers/productizationHelper.js +0 -408
  64. package/dist/commands/productize/index.js +0 -99
  65. package/dist/common/ApiServerClient.js +0 -1109
  66. package/dist/common/CacheController.js +0 -146
  67. package/dist/common/CliConfigManager.js +0 -76
  68. package/dist/common/CompositeError.js +0 -95
  69. package/dist/common/CoreConfigController.js +0 -174
  70. package/dist/common/DefinitionsManager.js +0 -298
  71. package/dist/common/Kubectl.js +0 -68
  72. package/dist/common/PlatformClient.js +0 -128
  73. package/dist/common/Renderer.js +0 -409
  74. package/dist/common/TmpFile.js +0 -96
  75. package/dist/common/bashCommands.js +0 -97
  76. package/dist/common/basicPrompts.js +0 -160
  77. package/dist/common/dataService.js +0 -312
  78. package/dist/common/errorHandler.js +0 -46
  79. package/dist/common/modules.d.js +0 -1
  80. package/dist/common/resultsRenderers.js +0 -164
  81. package/dist/common/types.js +0 -746
  82. package/dist/common/utils.js +0 -476
  83. package/dist/main.js +0 -8
@@ -1,346 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.testables = exports.setupKubernetes = exports.setupIstio = exports.istioSystemNs = exports.istioPrompts = exports.installPreprocess = 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
- var _chalk = _interopRequireDefault(require("chalk"));
8
- var _snooplogg = _interopRequireDefault(require("snooplogg"));
9
- var _bashCommands = require("../../common/bashCommands");
10
- var _basicPrompts = require("../../common/basicPrompts");
11
- var _Kubectl = require("../../common/Kubectl");
12
- var _types = require("../../common/types");
13
- var _utils = require("../../common/utils");
14
- var _helpers = _interopRequireWildcard(require("./helpers"));
15
- var helpers = _helpers;
16
- var _inputs = require("./helpers/inputs");
17
- var _istioTemplates = require("./helpers/templates/istioTemplates");
18
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
19
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
- // @ts-ignore
21
- const {
22
- log
23
- } = (0, _snooplogg.default)('engage: install: agents: istio:');
24
- const amplifyAgentsNs = exports.amplifyAgentsNs = 'amplify-agents';
25
- const gatewayCertSecret = exports.gatewayCertSecret = 'gateway-cert';
26
- const istioSystemNs = exports.istioSystemNs = 'istio-system';
27
- const ampcDemoNs = exports.ampcDemoNs = 'ampc-demo';
28
- const defaultLogFiles = exports.defaultLogFiles = '/group-*_instance-*.log';
29
- const amplifyAgentsCredsSecret = exports.amplifyAgentsCredsSecret = 'amplify-agents-credentials';
30
- let AlsMode = exports.AlsMode = /*#__PURE__*/function (AlsMode) {
31
- AlsMode["Verbose"] = "verbose";
32
- AlsMode["Default"] = "default";
33
- return AlsMode;
34
- }({}); // ConfigFiles - all the config file that are used in the setup
35
- const ConfigFiles = exports.ConfigFiles = {
36
- IstioOverrideFile: 'istio-override.yaml',
37
- HybridOverrideFile: 'hybrid-override.yaml'
38
- };
39
- const istioPrompts = exports.istioPrompts = {
40
- // istio
41
- enterProtocol: 'Enter the protocol to use for the ingress gateway',
42
- enterPort: 'Enter the Kubernetes cluster port',
43
- enterIstioSecret: 'Enter the name of the secret to store the Istio gateway certificate',
44
- generateCertPrompt: 'Would you like to generate a self signed certificate, or provide your own?',
45
- enterDomainName: 'Enter the public domain name for your cluster (FQDN), if available. (leave blank to skip)',
46
- enterCertPath: 'Enter the file path to the certificate',
47
- existingIstio: 'Use existing Istio installation?',
48
- askEnvoyFilterNamespace: 'Select the namespace where you would like the ALS Envoy Filters to be applied',
49
- istioProfile: 'Select the Istio profile to use',
50
- // agents
51
- meshAgentNamespace: 'Enter the namespace to use for the Amplify Istio Agents',
52
- vsNamespaces: 'Select the namespace where the agent should discover Virtual Service resources',
53
- alsMode: 'Select Traceability Agent HTTP header publishing mode',
54
- demoService: 'Do you want to deploy the optional demo application?'
55
- };
56
- const askBundleType = async () => {
57
- return await (0, _basicPrompts.askList)({
58
- msg: helpers.agentMessages.selectAgentType,
59
- choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
60
- });
61
- };
62
- exports.askBundleType = askBundleType;
63
- const askConfigType = async () => {
64
- return _types.AgentConfigTypes.DOCKERIZED;
65
- };
66
- exports.askConfigType = askConfigType;
67
- const gatewayConnectivity = async installConfig => {
68
- let istioValues = new _istioTemplates.IstioValues();
69
- console.log('\nCONNECTING A KUBERNETES CLUSTER TO AMPLIFY CENTRAL\n');
70
- console.log(_chalk.default.gray(`The Amplify Istio Discovery Agent needs to be deployed to your Kubernetes cluster to discover APIs for publishing to Amplify Central and/or the Amplify Marketplace.
71
- The Amplify Istio Traceability Agent needs to be deployed to your Kubernetes cluster to collect transaction telemetry to send to the Amplify Central Observer and Visibility Dashboard.`));
72
- console.log(`
73
- For more details on client prerequesites or Kubernetes preparation refer to the documentation here:
74
- https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/mesh_management/build_hybrid_env/index.html
75
- `);
76
- const {
77
- error
78
- } = await _Kubectl.kubectl.isInstalled();
79
- if (error) {
80
- throw new Error(`Kubectl is required to fill out the following prompts. It appears to be missing or misconfigured.\n${error}`);
81
- }
82
- const istioOverrides = await setupIstio(istioValues);
83
- installConfig.gatewayConfig = istioValues;
84
-
85
- // Set up the following values from installConfig to be used in setupKubernetes
86
- istioValues.istioAgentValues.alsEnabled = installConfig.switches.isTaEnabled;
87
- istioValues.istioAgentValues.discoveryEnabled = installConfig.switches.isDaEnabled;
88
- const hybridOverrides = await setupKubernetes(istioValues);
89
- hybridOverrides.envoyFilterNamespace = istioOverrides.envoyFilterNamespace;
90
- istioOverrides.alsNamespace = hybridOverrides.namespace.name;
91
- istioOverrides.enableAls = hybridOverrides.alsMode === AlsMode.Verbose;
92
- istioOverrides.enableTracing = hybridOverrides.alsEnabled;
93
- return istioValues;
94
- };
95
-
96
- // Questions for the istio configuration
97
- exports.gatewayConnectivity = gatewayConnectivity;
98
- const askUseExistingIstio = async () => (0, _basicPrompts.askList)({
99
- msg: istioPrompts.existingIstio,
100
- choices: _types.YesNoChoices
101
- });
102
- const askEnvoyFilterNamespace = async namespaces => (0, _basicPrompts.askList)({
103
- msg: istioPrompts.askEnvoyFilterNamespace,
104
- choices: namespaces.data
105
- });
106
- const askHost = async () => await (0, _basicPrompts.askInput)({
107
- msg: istioPrompts.enterDomainName,
108
- validate: (0, _basicPrompts.validateRegex)(_helpers.domainNameRegex, _helpers.invalidDomainName),
109
- allowEmptyInput: true
110
- });
111
- const askProtocol = async () => (0, _basicPrompts.askList)({
112
- msg: istioPrompts.enterProtocol,
113
- choices: [{
114
- name: _types.Protocol.HTTP.toUpperCase(),
115
- value: _types.Protocol.HTTP
116
- }, {
117
- name: _types.Protocol.HTTPS.toUpperCase(),
118
- value: _types.Protocol.HTTPS
119
- }]
120
- });
121
- const askPort = async protocol => await (0, _basicPrompts.askInput)({
122
- msg: istioPrompts.enterPort,
123
- type: 'number',
124
- defaultValue: protocol === _types.Protocol.HTTP ? 8080 : 443
125
- });
126
- const askCertificateOption = async () => (0, _basicPrompts.askList)({
127
- msg: istioPrompts.generateCertPrompt,
128
- choices: [{
129
- name: 'Generate self signed certificate',
130
- value: _types.Certificate.GENERATE
131
- }, {
132
- name: 'Provide certificate',
133
- value: _types.Certificate.PROVIDE
134
- }]
135
- });
136
- const askIstioProfile = async () => (0, _basicPrompts.askList)({
137
- msg: istioPrompts.istioProfile,
138
- choices: _types.IstioProfileChoices
139
- });
140
-
141
- //Setup Overrides
142
- const setupIstio = async istioValues => {
143
- let istioInstallValues = istioValues.istioInstallValues;
144
- console.log(_chalk.default.gray('If Istio is not yet installed, select No. If Istio is already running select Yes.\n'));
145
- const useExistingIstio = await askUseExistingIstio();
146
- if (useExistingIstio === _types.YesNo.Yes) {
147
- const namespaces = await _Kubectl.kubectl.get('namespaces');
148
- if (namespaces.error) throw new Error(namespaces.error);
149
- const filterNamespace = await askEnvoyFilterNamespace(namespaces);
150
- istioInstallValues.envoyFilterNamespace = filterNamespace;
151
- istioInstallValues.isNewInstall = false;
152
- return istioInstallValues;
153
- }
154
- istioInstallValues.profile = await askIstioProfile();
155
- 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'));
156
- istioInstallValues.host = (await askHost()).toLowerCase();
157
- if (istioInstallValues.host) {
158
- istioInstallValues.protocol = await askProtocol();
159
- istioInstallValues.port = await askPort(istioInstallValues.protocol);
160
- if (istioInstallValues.protocol === _types.Protocol.HTTPS) {
161
- istioInstallValues.certSecretName = await askIstioSecret(istioPrompts.enterIstioSecret, istioSystemNs, gatewayCertSecret);
162
- istioInstallValues.certificateOption = await askCertificateOption();
163
- }
164
- }
165
- istioInstallValues.targetPort = istioInstallValues.protocol === _types.Protocol.HTTP ? 8080 : 8443;
166
- return istioValues.istioInstallValues;
167
- };
168
- exports.setupIstio = setupIstio;
169
- const askIstioSecret = async (msg, namespace, defaultSecretName) => {
170
- const allSecrets = await _Kubectl.kubectl.get('secrets', `-n ${namespace}`);
171
- // No resources errors are ok. Throw an error for anything else.
172
- if (allSecrets.error && !allSecrets.error.includes('K8S secrets: No resources found')) throw Error(allSecrets.error);
173
- return (0, _inputs.askForSecretName)(msg, defaultSecretName, allSecrets.data);
174
- };
175
- exports.askIstioSecret = askIstioSecret;
176
- const completeIstio = async istioOverrides => {
177
- if (istioOverrides.protocol === _types.Protocol.HTTPS) {
178
- if (istioOverrides.isNewInstall) {
179
- await _Kubectl.kubectl.create('ns', istioSystemNs);
180
- }
181
- await createIstioGatewayCert(istioOverrides.envoyFilterNamespace, istioOverrides);
182
- }
183
- };
184
-
185
- // Above this line is Istio. Below is Kubernetes
186
-
187
- // Questions for the kubernetes configuration
188
- const askALSMode = async () => {
189
- return (0, _basicPrompts.askList)({
190
- msg: istioPrompts.alsMode,
191
- choices: [{
192
- name: AlsMode.Default.charAt(0).toUpperCase() + AlsMode.Default.slice(1),
193
- value: AlsMode.Default
194
- }, {
195
- name: AlsMode.Verbose.charAt(0).toUpperCase() + AlsMode.Verbose.slice(1),
196
- value: AlsMode.Verbose
197
- }]
198
- });
199
- };
200
- const askVsNamespacePrompt = async () => {
201
- const namespaces = await _Kubectl.kubectl.get('ns');
202
- if (namespaces.error) throw Error(namespaces.error);
203
- return await (0, _basicPrompts.askList)({
204
- msg: istioPrompts.vsNamespaces,
205
- choices: namespaces.data
206
- });
207
- };
208
- const askEnableDemoSvc = async () => {
209
- const res = (0, _basicPrompts.askList)({
210
- msg: istioPrompts.demoService,
211
- choices: _types.YesNoChoices
212
- });
213
- return (await res) === _types.YesNo.Yes ? true : false;
214
- };
215
-
216
- //Setup Overrides
217
- const setupKubernetes = async istioValues => {
218
- let istioAgentValues = istioValues.istioAgentValues;
219
- 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`));
220
- if (istioAgentValues.alsEnabled) {
221
- 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`));
222
- istioAgentValues.alsMode = await askALSMode();
223
- }
224
- if (istioAgentValues.discoveryEnabled) {
225
- const ns = await askVsNamespacePrompt();
226
- istioAgentValues.discoveryNamespaces = [ns];
227
- }
228
- istioAgentValues.namespace = await (0, _inputs.askNamespace)(istioPrompts.meshAgentNamespace, amplifyAgentsNs);
229
- istioAgentValues.demoSvcEnabled = await askEnableDemoSvc();
230
- if (istioAgentValues.discoveryEnabled && istioAgentValues.demoSvcEnabled && !istioAgentValues.discoveryNamespaces.includes(ampcDemoNs)) {
231
- istioAgentValues.discoveryNamespaces.push(ampcDemoNs);
232
- }
233
-
234
- // set keySecretName
235
- istioAgentValues.keysSecretName = helpers.amplifyAgentsKeysSecret;
236
- istioAgentValues.clusterName = await (0, _helpers.askK8sClusterName)();
237
- return istioAgentValues;
238
- };
239
- exports.setupKubernetes = setupKubernetes;
240
- const createIstioGatewayCert = async (namespace, istioOverrides) => {
241
- let privateKey = '';
242
- let cert = '';
243
- if (istioOverrides.certificateOption === _types.Certificate.GENERATE) {
244
- ({
245
- cert,
246
- privateKey
247
- } = await (0, _bashCommands.createTlsCert)(istioOverrides.certSecretName, istioOverrides.host));
248
- console.log(`Created ${istioOverrides.certSecretName}.crt and ${istioOverrides.certSecretName}.key in ${process.cwd()}`);
249
- } else {
250
- privateKey = await (0, _basicPrompts.askInput)({
251
- msg: _helpers.enterPublicKeyPath
252
- });
253
- cert = await (0, _basicPrompts.askInput)({
254
- msg: istioPrompts.enterCertPath
255
- });
256
- }
257
- const {
258
- data,
259
- error
260
- } = await _Kubectl.kubectl.create('secret', `-n ${namespace} tls ${istioOverrides.certSecretName} --cert=${cert} --key=${privateKey}`);
261
- if (error) throw new Error(error);
262
- console.log(`Created ${data[0]} in the ${namespace} namespace.`);
263
- };
264
- exports.createIstioGatewayCert = createIstioGatewayCert;
265
- const createIstioOverride = overrides => {
266
- const overrideFileName = ConfigFiles.IstioOverrideFile;
267
- (0, _utils.writeTemplates)(overrideFileName, overrides, helpers.istioInstallTemplate);
268
- console.log(`\nIstio override file has been placed at ${process.cwd()}/${overrideFileName}`);
269
- if (overrides.istioInstallValues.isNewInstall) {
270
- 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`));
271
- } else {
272
- console.log(_chalk.default.cyan(` Please merge the generated ${overrideFileName} file with your Istio configuration to allow the Traceability Agent to function.\n`));
273
- }
274
- };
275
- exports.createIstioOverride = createIstioOverride;
276
- const createEnvResources = async (client, defs, clusterName) => {
277
- // Create the mesh K8SCluster resource
278
- await helpers.createByResourceType(client, defs, clusterName, 'K8SCluster', 'k8sc', {}, '');
279
- };
280
- exports.createEnvResources = createEnvResources;
281
- const createHybridOverride = overrides => {
282
- const overrideFileName = ConfigFiles.HybridOverrideFile;
283
- (0, _utils.writeTemplates)(overrideFileName, overrides, helpers.istioAgentsTemplate);
284
- console.log(`Istio agent override file has been placed at ${process.cwd()}/${overrideFileName}`);
285
- helpers.helmImageSecretInfo(overrides.istioAgentValues.namespace.name);
286
- let agentHelmInfo = new Set();
287
- agentHelmInfo.add({
288
- helmReleaseName: 'ampc-hybrid',
289
- helmChartName: 'axway/ampc-hybrid',
290
- overrideFileName: overrideFileName,
291
- imageSecretOverrides: `--set da.image.pullSecret=<image-pull-secret-name> --set als.image.pullSecret=<image-pull-secret-name>`
292
- });
293
- helpers.helmInstallInfo('Istio', overrides.istioAgentValues.namespace.name, agentHelmInfo);
294
- };
295
- exports.createHybridOverride = createHybridOverride;
296
- const installPreprocess = async installConfig => {
297
- // name of the service account, and if it is new or not
298
-
299
- if (!installConfig.centralConfig.ampcDosaInfo.isNew) {
300
- [installConfig.centralConfig.dosaAccount.publicKey, installConfig.centralConfig.dosaAccount.privateKey] = await helpers.askPublicAndPrivateKeysPath();
301
- } else {
302
- 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.`));
303
- }
304
- return installConfig;
305
- };
306
- exports.installPreprocess = installPreprocess;
307
- const completeInstall = async installConfig => {
308
- // Contents of completeKubernetes moved here.
309
-
310
- const istioValues = installConfig.gatewayConfig;
311
-
312
- // Add final settings to IstioAgentsValues
313
- istioValues.centralConfig = installConfig.centralConfig;
314
- istioValues.traceabilityConfig = installConfig.traceabilityConfig;
315
- await completeIstio(istioValues.istioInstallValues);
316
- if (istioValues.istioAgentValues.namespace.isNew) {
317
- await helpers.createNamespace(istioValues.istioAgentValues.namespace.name);
318
- }
319
- await helpers.createSecret(istioValues.istioAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, async () => {
320
- if (installConfig.centralConfig.ampcDosaInfo.isNew) {
321
- 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.`));
322
- }
323
- await helpers.createAmplifyAgentKeysSecret(istioValues.istioAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, 'publicKey', istioValues.centralConfig.dosaAccount.publicKey, 'privateKey', istioValues.centralConfig.dosaAccount.privateKey);
324
- });
325
- console.log('Generating the configuration file(s)...');
326
- createIstioOverride(istioValues);
327
- createHybridOverride(istioValues);
328
- console.log('Configuration file(s) have been successfully created.\n');
329
- console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.ISTIO}`));
330
- };
331
- exports.completeInstall = completeInstall;
332
- const IstioInstallMethods = exports.IstioInstallMethods = {
333
- GetBundleType: askBundleType,
334
- GetDeploymentType: askConfigType,
335
- AskGatewayQuestions: gatewayConnectivity,
336
- InstallPreprocess: installPreprocess,
337
- FinalizeGatewayInstall: completeInstall,
338
- ConfigFiles: Object.values(ConfigFiles),
339
- GatewayDisplay: _types.GatewayTypes.ISTIO
340
- };
341
- const testables = exports.testables = {
342
- istioPrompts,
343
- ConfigFiles,
344
- defaultLogFiles,
345
- amplifyAgentsCredsSecret
346
- };
@@ -1,303 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.testables = exports.gatewayConnectivity = exports.completeInstall = exports.askSaslMechanism = exports.askIsSchemaRegistryAuthEnabled = exports.askIsCloudEnabled = exports.askConfigType = exports.askBundleType = exports.SaslMechanismTypes = exports.KafkaInstallMethods = exports.DeploymentTypes = exports.ConfigFiles = void 0;
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
- var _snooplogg = _interopRequireDefault(require("snooplogg"));
9
- var _basicPrompts = require("../../common/basicPrompts");
10
- var _types = require("../../common/types");
11
- var _utils = require("../../common/utils");
12
- var helpers = _interopRequireWildcard(require("./helpers"));
13
- var _kafkaTemplates = require("./helpers/templates/kafkaTemplates");
14
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- // @ts-ignore
17
- const {
18
- log
19
- } = (0, _snooplogg.default)('central: install: agents: kafka');
20
- const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.KAFKA_DA}`;
21
- const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.KAFKA_TA}`;
22
-
23
- // ConfigFiles - all the config file that are used in the setup
24
- const ConfigFiles = exports.ConfigFiles = {
25
- DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`,
26
- TAEnvVars: `${helpers.configFiles.TA_ENV_VARS}`
27
- };
28
-
29
- // DeploymentTypes - types of Kafka cluster deployments
30
- let DeploymentTypes = exports.DeploymentTypes = /*#__PURE__*/function (DeploymentTypes) {
31
- DeploymentTypes["CONFLUENT_CLOUD"] = "Confluent Cloud";
32
- DeploymentTypes["CONFLUENT_PLATFORM"] = "Confluent Platform";
33
- return DeploymentTypes;
34
- }({}); // SaslMechanismTypes - SASL authentication mechanism types
35
- let SaslMechanismTypes = exports.SaslMechanismTypes = /*#__PURE__*/function (SaslMechanismTypes) {
36
- SaslMechanismTypes["SCRAM_SHA_256"] = "SCRAM-SHA-256";
37
- SaslMechanismTypes["SCRAM_SHA_512"] = "SCRAM-SHA-512";
38
- SaslMechanismTypes["PLAIN"] = "PLAIN";
39
- SaslMechanismTypes["OAUTHBEARER"] = "OAUTHBEARER";
40
- SaslMechanismTypes["NONE"] = "NONE";
41
- return SaslMechanismTypes;
42
- }({}); // KafkaPrompts - prompts for user inputs
43
- const prompts = {
44
- deploymentTypeMsg: 'Select the type of deployment you wish to configure',
45
- enterEnvironmentId: 'Enter the Environment Id',
46
- enterClusterId: 'Enter the Cluster Id',
47
- enterCloudAPIKey: 'Enter the Cloud API Key Id',
48
- enterCloudAPISecret: 'Enter the Cloud API Key Secret',
49
- enterClusterServer: 'Enter the Bootstrap Server Name',
50
- enterClusterAPIKey: 'Enter the Cluster API Key Id',
51
- enterClusterAPISecret: 'Enter the Cluster API Key Secret',
52
- saslMechanismMsg: "Select the SASL Mechanism you wish to use for authentication",
53
- enterSaslUsername: "Enter the SASL Username",
54
- enterSaslPassword: "Enter the SASL Password",
55
- enterSaslOAuthTokenUrl: "Enter the SASL/OAUTHBEARER Token Url",
56
- enterSaslOAuthClientId: "Enter the SASL/OAUTHBEARER Client Id",
57
- enterSaslOAuthClientSecret: "Enter the SASL/OAUTHBEARER Client Secret",
58
- enterSaslOAuthClientScopes: "Enter the SASL/OAUTHBEARER Client Scopes(comma separated list)",
59
- schemaRegistryEnabledMsg: 'Do you want to use Schema Registry with Kafka cluster?',
60
- enterSchemaRegistryUrl: 'Enter the Schema Registry Url',
61
- schemaRegistryAuthEnabled: 'Do you want to authenticate Schema Registry with SASL mechanism?',
62
- enterSchemaRegistryAPIKey: 'Enter the Schema Registry API Key Id',
63
- enterSchemaRegistryAPISecret: 'Enter the Schema Registry API Key Secret'
64
- };
65
- const askBundleType = async () => {
66
- return await (0, _basicPrompts.askList)({
67
- msg: helpers.agentMessages.selectAgentType,
68
- choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
69
- });
70
- };
71
- exports.askBundleType = askBundleType;
72
- const askConfigType = async () => {
73
- return _types.AgentConfigTypes.DOCKERIZED;
74
- };
75
-
76
- //
77
- // Questions for the configuration of Kafka agents
78
- //
79
- exports.askConfigType = askConfigType;
80
- const askIsCloudEnabled = async () => {
81
- const deploymentType = await (0, _basicPrompts.askList)({
82
- msg: prompts.deploymentTypeMsg,
83
- default: DeploymentTypes.CONFLUENT_CLOUD,
84
- choices: [{
85
- name: DeploymentTypes.CONFLUENT_CLOUD,
86
- value: DeploymentTypes.CONFLUENT_CLOUD
87
- }, {
88
- name: DeploymentTypes.CONFLUENT_PLATFORM,
89
- value: DeploymentTypes.CONFLUENT_PLATFORM
90
- }]
91
- });
92
- return deploymentType == DeploymentTypes.CONFLUENT_CLOUD;
93
- };
94
- exports.askIsCloudEnabled = askIsCloudEnabled;
95
- const askEnvironmentId = async () => await (0, _basicPrompts.askInput)({
96
- msg: prompts.enterEnvironmentId
97
- });
98
- const askClusterId = async () => await (0, _basicPrompts.askInput)({
99
- msg: prompts.enterClusterId
100
- });
101
- const askCloudAPIKey = async () => await (0, _basicPrompts.askInput)({
102
- msg: prompts.enterCloudAPIKey
103
- });
104
- const askCloudAPISecret = async () => await (0, _basicPrompts.askInput)({
105
- msg: prompts.enterCloudAPISecret
106
- });
107
- const askClusterServer = async () => await (0, _basicPrompts.askInput)({
108
- msg: prompts.enterClusterServer,
109
- validate: (0, _basicPrompts.validateRegex)(helpers.KafkaRegexPatterns.bootstrapServerRegex, helpers.invalidValueExampleErrMsg('Bootstrap Server Name', 'SASL_SSL://somehost.testdomain.com:9092'))
110
- });
111
- const askClusterAPIKey = async () => await (0, _basicPrompts.askInput)({
112
- msg: prompts.enterClusterAPIKey
113
- });
114
- const askClusterAPISecret = async () => await (0, _basicPrompts.askInput)({
115
- msg: prompts.enterClusterAPISecret
116
- });
117
- const askSaslMechanism = async () => {
118
- return await (0, _basicPrompts.askList)({
119
- msg: prompts.saslMechanismMsg,
120
- default: SaslMechanismTypes.PLAIN,
121
- choices: [{
122
- name: SaslMechanismTypes.NONE,
123
- value: SaslMechanismTypes.NONE
124
- }, {
125
- name: SaslMechanismTypes.PLAIN,
126
- value: SaslMechanismTypes.PLAIN
127
- }, {
128
- name: SaslMechanismTypes.SCRAM_SHA_256,
129
- value: SaslMechanismTypes.SCRAM_SHA_256
130
- }, {
131
- name: SaslMechanismTypes.SCRAM_SHA_512,
132
- value: SaslMechanismTypes.SCRAM_SHA_512
133
- }, {
134
- name: SaslMechanismTypes.OAUTHBEARER,
135
- value: SaslMechanismTypes.OAUTHBEARER
136
- }]
137
- });
138
- };
139
- exports.askSaslMechanism = askSaslMechanism;
140
- const askSaslOAuthBearerTokenUrl = async () => await (0, _basicPrompts.askInput)({
141
- msg: prompts.enterSaslOAuthTokenUrl,
142
- allowEmptyInput: false,
143
- validate: (0, _basicPrompts.validateRegex)(helpers.KafkaRegexPatterns.urlRegex, helpers.invalidValueExampleErrMsg('Token URL', 'https://www.testdomain.com/oauth/token'))
144
- });
145
- const askSaslOAuthBearerClientId = async () => await (0, _basicPrompts.askInput)({
146
- msg: prompts.enterSaslOAuthClientId,
147
- allowEmptyInput: false
148
- });
149
- const askSaslOAuthBearerClientSecret = async () => await (0, _basicPrompts.askInput)({
150
- msg: prompts.enterSaslOAuthClientSecret,
151
- allowEmptyInput: false
152
- });
153
- const askSaslOAuthBearerScopes = async () => await (0, _basicPrompts.askInput)({
154
- msg: prompts.enterSaslOAuthClientScopes,
155
- allowEmptyInput: true
156
- });
157
- const askSaslUsername = async () => await (0, _basicPrompts.askInput)({
158
- msg: prompts.enterSaslUsername
159
- });
160
- const askSaslPassword = async () => await (0, _basicPrompts.askInput)({
161
- msg: prompts.enterSaslPassword
162
- });
163
- const askIsSchemaRegistryEnabled = async () => {
164
- const enabled = await (0, _basicPrompts.askList)({
165
- msg: prompts.schemaRegistryEnabledMsg,
166
- default: _types.YesNo.Yes,
167
- choices: _types.YesNoChoices
168
- });
169
- return enabled == _types.YesNo.Yes;
170
- };
171
- const askIsSchemaRegistryAuthEnabled = async () => {
172
- const enabled = await (0, _basicPrompts.askList)({
173
- msg: prompts.schemaRegistryAuthEnabled,
174
- default: _types.YesNo.Yes,
175
- choices: _types.YesNoChoices
176
- });
177
- return enabled == _types.YesNo.Yes;
178
- };
179
- exports.askIsSchemaRegistryAuthEnabled = askIsSchemaRegistryAuthEnabled;
180
- const askSchemaRegistryUrl = async () => await (0, _basicPrompts.askInput)({
181
- msg: prompts.enterSchemaRegistryUrl,
182
- validate: (0, _basicPrompts.validateRegex)(helpers.KafkaRegexPatterns.urlRegex, helpers.invalidValueExampleErrMsg('Schema Registry Url', 'https://www.testdomain.com'))
183
- });
184
- const askSchemaRegistryAPIKey = async () => await (0, _basicPrompts.askInput)({
185
- msg: prompts.enterSchemaRegistryAPIKey
186
- });
187
- const askSchemaRegistryAPISecret = async () => await (0, _basicPrompts.askInput)({
188
- msg: prompts.enterSchemaRegistryAPISecret
189
- });
190
- const gatewayConnectivity = async installConfig => {
191
- const kafkaAgentValues = new _kafkaTemplates.KafkaAgentValues();
192
- kafkaAgentValues.cloudEnabled = await askIsCloudEnabled();
193
- if (kafkaAgentValues.cloudEnabled) {
194
- kafkaAgentValues.cloudEnvironmentId = await askEnvironmentId();
195
- kafkaAgentValues.cloudClusterId = await askClusterId();
196
- kafkaAgentValues.cloudAPIKey = await askCloudAPIKey();
197
- kafkaAgentValues.cloudAPISecret = await askCloudAPISecret();
198
- kafkaAgentValues.clusterAPIKey = await askClusterAPIKey();
199
- kafkaAgentValues.clusterAPISecret = await askClusterAPISecret();
200
- } else {
201
- kafkaAgentValues.clusterServer = await askClusterServer();
202
- kafkaAgentValues.clusterSaslMechanism = await askSaslMechanism();
203
- if (kafkaAgentValues.clusterSaslMechanism !== SaslMechanismTypes.NONE) {
204
- if (kafkaAgentValues.clusterSaslMechanism == SaslMechanismTypes.OAUTHBEARER) {
205
- kafkaAgentValues.saslOauthTokenUrl = await askSaslOAuthBearerTokenUrl();
206
- kafkaAgentValues.saslOauthClientId = await askSaslOAuthBearerClientId();
207
- kafkaAgentValues.saslOauthClientSecret = await askSaslOAuthBearerClientSecret();
208
- kafkaAgentValues.saslOauthClientScopes = await askSaslOAuthBearerScopes();
209
- } else {
210
- kafkaAgentValues.clusterSaslUser = await askSaslUsername();
211
- kafkaAgentValues.clusterSaslPassword = await askSaslPassword();
212
- }
213
- }
214
- }
215
- if (installConfig.switches.isDaEnabled) {
216
- if (kafkaAgentValues.cloudEnabled) {
217
- kafkaAgentValues.schemaRegistryAPIKey = await askSchemaRegistryAPIKey();
218
- kafkaAgentValues.schemaRegistryAPISecret = await askSchemaRegistryAPISecret();
219
- } else {
220
- kafkaAgentValues.schemaRegistryEnabled = await askIsSchemaRegistryEnabled();
221
- if (kafkaAgentValues.schemaRegistryEnabled) {
222
- kafkaAgentValues.schemaRegistryUrl = await askSchemaRegistryUrl();
223
- kafkaAgentValues.schemaRegistryAuthEnabled = await askIsSchemaRegistryAuthEnabled();
224
- }
225
- }
226
- }
227
- return kafkaAgentValues;
228
- };
229
- exports.gatewayConnectivity = gatewayConnectivity;
230
- const generateSuccessHelpMsg = installConfig => {
231
- if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
232
- console.log(_chalk.default.yellow('\nPlease make sure to copy the "private_key.pem" and "public_key.pem" files for the existing service account you selected.'));
233
- }
234
- dockerSuccessMsg(installConfig);
235
- console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.AZURE}`));
236
- };
237
- const dockerSuccessMsg = installConfig => {
238
- let dockerInfo;
239
- const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
240
- const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
241
- const runTaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
242
- const runTaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.TA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
243
- const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
244
- const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
245
- const startTaLinuxMsg = `\nStart the Traceability Agent on a Linux based machine`;
246
- const startTaWinMsg = `\nStart the Traceability Agent on a Windows machine`;
247
- if (installConfig.switches.isDaEnabled && installConfig.switches.isTaEnabled) {
248
- 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}):`;
249
- } else if (installConfig.switches.isDaEnabled) {
250
- dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
251
- } else {
252
- dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
253
- }
254
- console.log(_chalk.default.whiteBright(dockerInfo), '\n');
255
- if (installConfig.switches.isDaEnabled) {
256
- const daImageVersion = `${daImage}:${installConfig.daVersion}`;
257
- console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
258
- console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
259
- console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
260
- console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
261
- console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`), '\n');
262
- }
263
- if (installConfig.switches.isTaEnabled) {
264
- const taImageVersion = `${taImage}:${installConfig.taVersion}`;
265
- console.log(_chalk.default.white('Pull the latest image of the Traceability Agent:'));
266
- console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
267
- console.log(_chalk.default.white(_utils.isWindows ? startTaWinMsg : startTaLinuxMsg));
268
- console.log(_chalk.default.cyan(_utils.isWindows ? runTaWinMsg : runTaLinuxMsg));
269
- console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
270
- }
271
- };
272
- const completeInstall = async installConfig => {
273
- // Add final settings to kafkaAgentsValues
274
- const kafkaAgentValues = installConfig.gatewayConfig;
275
- kafkaAgentValues.centralConfig = installConfig.centralConfig;
276
- kafkaAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
277
- console.log('Generating the configuration file(s)...');
278
- if (installConfig.switches.isDaEnabled) {
279
- (0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, kafkaAgentValues, helpers.kafkaDAEnvVarTemplate);
280
- }
281
- if (installConfig.switches.isTaEnabled) {
282
- (0, _utils.writeTemplates)(ConfigFiles.TAEnvVars, kafkaAgentValues, helpers.kafkaTAEnvVarTemplate);
283
- }
284
- console.log('Configuration file(s) have been successfully created.\n');
285
- generateSuccessHelpMsg(installConfig);
286
- };
287
- exports.completeInstall = completeInstall;
288
- const KafkaInstallMethods = exports.KafkaInstallMethods = {
289
- GetBundleType: askBundleType,
290
- GetDeploymentType: askConfigType,
291
- AskGatewayQuestions: gatewayConnectivity,
292
- FinalizeGatewayInstall: completeInstall,
293
- ConfigFiles: Object.values(ConfigFiles),
294
- AgentNameMap: {
295
- [_types.AgentTypes.da]: _types.AgentNames.KAFKA_DA,
296
- [_types.AgentTypes.ta]: _types.AgentNames.KAFKA_TA
297
- },
298
- GatewayDisplay: _types.GatewayTypes.KAFKA
299
- };
300
- const testables = exports.testables = {
301
- prompts,
302
- ConfigFiles
303
- };