From 2f86e319c3e767c951bbcbfd68bcedd0aee15fdb Mon Sep 17 00:00:00 2001 From: i325261 Date: Thu, 31 Oct 2024 10:43:50 +0100 Subject: [PATCH] Added primary subdomain to runtime prompts --- bin/cap-op-plugin.js | 10 +++++++--- test/cap-op-plugin.test.js | 10 ++++++---- test/files/expectedChart/runtime-values.yaml | 2 +- test/files/input_values.yaml | 1 + 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/bin/cap-op-plugin.js b/bin/cap-op-plugin.js index 418919c..8232fd4 100755 --- a/bin/cap-op-plugin.js +++ b/bin/cap-op-plugin.js @@ -155,14 +155,15 @@ async function generateRuntimeValues(option, inputYamlPath) { ['Enter your global account ID: ', '', true], ['Enter your provider subdomain: ', '', true], ['Enter your provider tenant ID: ', '', true], - ['Enter your HANA database instance ID: ', '', false], - ['Enter your image pull secrets: ', '', false] + ['Enter primary subdomain of you application url (Optional): ', '', false], + ['Enter your HANA database instance ID (Optional): ', '', false], + ['Enter your image pull secrets (Optional): ', '', false] ] const answerKeys = [ 'appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubdomain', 'tenantId', - 'hanaInstanceId', 'imagePullSecret' + 'primarySubdomain','hanaInstanceId', 'imagePullSecret' ] const answer = await ask(...questions) @@ -182,6 +183,9 @@ async function generateRuntimeValues(option, inputYamlPath) { if (!answerStruct['imagePullSecret']) delete runtimeValuesYaml['imagePullSecrets'] + if (answerStruct['primarySubdomain']) + runtimeValuesYaml['app']['domains']['primary'] = answerStruct['primarySubdomain'] + '.' + answerStruct['clusterDomain'] + if (isConfigurableTempChart && answerStruct['hanaInstanceId']) runtimeValuesYaml['hanaInstanceId'] = answerStruct['hanaInstanceId'] diff --git a/test/cap-op-plugin.test.js b/test/cap-op-plugin.test.js index b3f5733..c7f1d76 100644 --- a/test/cap-op-plugin.test.js +++ b/test/cap-op-plugin.test.js @@ -92,8 +92,9 @@ EXAMPLES rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012') rlQuestion.onCall(4).callsArgWith(1, 'bem-aad-sadad-123456789012') rlQuestion.onCall(5).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012') - rlQuestion.onCall(6).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012') - rlQuestion.onCall(7).callsArgWith(1, 'regcred') + rlQuestion.onCall(6).callsArgWith(1, 'primary-sub-domain') + rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012') + rlQuestion.onCall(8).callsArgWith(1, 'regcred') cds.root = bookshop await capOperatorPlugin('generate-runtime-values') @@ -129,8 +130,9 @@ EXAMPLES rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012') rlQuestion.onCall(4).callsArgWith(1, 'bem-aad-sadad-123456789012') rlQuestion.onCall(5).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012') - rlQuestion.onCall(6).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012') - rlQuestion.onCall(7).callsArgWith(1, 'regcred') + rlQuestion.onCall(6).callsArgWith(1, '') + rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012') + rlQuestion.onCall(8).callsArgWith(1, 'regcred') cds.root = bookshop await capOperatorPlugin('generate-runtime-values') diff --git a/test/files/expectedChart/runtime-values.yaml b/test/files/expectedChart/runtime-values.yaml index 6cfd868..ff82868 100644 --- a/test/files/expectedChart/runtime-values.yaml +++ b/test/files/expectedChart/runtime-values.yaml @@ -16,7 +16,7 @@ serviceInstances: - https://*bkshop.c-abc.kyma.ondemand.com/** app: domains: - primary: bkshop.c-abc.kyma.ondemand.com + primary: primary-sub-domain.c-abc.kyma.ondemand.com secondary: [] istioIngressGatewayLabels: istio: ingressgateway diff --git a/test/files/input_values.yaml b/test/files/input_values.yaml index eeae9af..b396027 100644 --- a/test/files/input_values.yaml +++ b/test/files/input_values.yaml @@ -4,5 +4,6 @@ clusterDomain: c-abc.kyma.ondemand.com globalAccountId: dc94db56-asda-adssa-dada-123456789012 providerSubdomain: bem-aad-sadad-123456789012 tenantId: dasdsd-1234-1234-1234-123456789012 +primarySubdomain: primary-sub-domain imagePullSecret: regcred hanaInstanceId: sdasd-4c4d-4d4d-4d4d-123456789012