Skip to content

Commit a85c69a

Browse files
committed
[Misc] Plugin: providerSubaccountId runtime support added
Enhancement to source `providerSubaccountId` at runtime. - misc adjustments until the field becomes mandatory (soon).
1 parent 1c577b9 commit a85c69a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+79
-27
lines changed

bin/cap-op-plugin.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ async function generateRuntimeValues(option, inputYamlPath) {
184184
answerStruct = yaml.parse(await cds.utils.read(cds.utils.path.join(cds.root, inputYamlPath)))
185185

186186
const requiredFields = isServiceOnly
187-
? ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId']
188-
: ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubdomain', 'tenantId']
187+
? ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId']
188+
: ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId', 'providerSubdomain', 'tenantId']
189189

190190
const missingFields = requiredFields.filter(field => !answerStruct[field])
191191
if (missingFields.length) {
@@ -198,14 +198,15 @@ async function generateRuntimeValues(option, inputYamlPath) {
198198
['Enter CAP Operator subdomain (In kyma cluster it is "cap-op" by default): ', 'cap-op', true],
199199
['Enter your cluster shoot domain: ', await getShootDomain(), true],
200200
['Enter your global account ID: ', '', true],
201+
['Enter your provider sub-account ID: ', '', true],
201202
...isServiceOnly ? [] : [['Enter your provider subdomain: ', '', true]],
202203
...isServiceOnly ? [] : [['Enter your provider tenant ID: ', '', true]],
203204
['Enter your HANA database instance ID: ', '', false],
204205
['Enter your image pull secrets: ', '', false]
205206
]
206207

207208
const answerKeys = [
208-
'appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId',
209+
'appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId',
209210
...isServiceOnly ? [] : ['providerSubdomain'],
210211
...isServiceOnly ? [] : ['tenantId'],
211212
'hanaInstanceId', 'imagePullSecret'

files/chart/values.yaml.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ app:
1616

1717
btp:
1818
# -- BTP Global account identifier where the application is hosted
19-
globalAccountId: # mandatory let helm fail if not provided
19+
globalAccountId:
20+
# -- BTP Provider sub-account identifier where the application is hosted
21+
providerSubaccountId:
2022
{{#isApp}}
2123
provider:
2224
# -- Subdomain of the provider sub-account where application services are created

files/configurableTemplatesChart/values.yaml.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ app:
1616

1717
btp:
1818
# -- BTP Global account identifier where the application is hosted
19-
globalAccountId: # mandatory let helm fail if not provided
19+
globalAccountId:
20+
# -- BTP Provider sub-account identifier where the application is hosted
21+
providerSubaccountId:
2022
{{#isApp}}
2123
provider:
2224
# -- Subdomain of the provider sub-account where application services are created

files/runtime-values.yaml.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ app:
5656

5757
btp:
5858
globalAccountId: {{globalAccountId}}
59+
providerSubaccountId: {{providerSubaccountId}}
5960
{{#isApp}}
6061
provider:
6162
subdomain: {{providerSubdomain}}

lib/util.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ function writeCAPApplicationCRO(yaml, hasIas, isService) {
280280
' name: {{ .name }}',
281281
'{{- end }}',
282282
'btpAppName: {{ include "appName" $ }}',
283-
'globalAccountId: {{ .Values.btp.globalAccountId }}'
283+
'globalAccountId: {{ .Values.btp.globalAccountId }}',
284+
'providerSubaccountId: {{ .Values.btp.providerSubaccountId }}'
284285
])
285286

286287
if (!isService) {

test/cap-op-plugin.test.js

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ EXAMPLES
9494
rlQuestion.onSecondCall().callsArgWith(1, '')
9595
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
9696
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
97-
rlQuestion.onCall(4).callsArgWith(1, 'bem-aad-sadad-123456789012')
98-
rlQuestion.onCall(5).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
99-
rlQuestion.onCall(6).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
100-
rlQuestion.onCall(7).callsArgWith(1, 'regcred')
97+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
98+
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
99+
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
100+
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
101+
rlQuestion.onCall(8).callsArgWith(1, 'regcred')
101102

102103
cds.root = bookshop
103104
await capOperatorPlugin('generate-runtime-values')
@@ -131,10 +132,11 @@ EXAMPLES
131132
rlQuestion.onSecondCall().callsArgWith(1, '')
132133
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
133134
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
134-
rlQuestion.onCall(4).callsArgWith(1, 'bem-aad-sadad-123456789012')
135-
rlQuestion.onCall(5).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
136-
rlQuestion.onCall(6).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
137-
rlQuestion.onCall(7).callsArgWith(1, 'regcred')
135+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
136+
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
137+
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
138+
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
139+
rlQuestion.onCall(8).callsArgWith(1, 'regcred')
138140

139141
cds.root = bookshop
140142
await capOperatorPlugin('generate-runtime-values')
@@ -157,8 +159,9 @@ EXAMPLES
157159
rlQuestion.onSecondCall().callsArgWith(1, '')
158160
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
159161
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
160-
rlQuestion.onCall(4).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
161-
rlQuestion.onCall(5).callsArgWith(1, 'regcred')
162+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
163+
rlQuestion.onCall(5).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
164+
rlQuestion.onCall(6).callsArgWith(1, 'regcred')
162165

163166
cds.root = bookshop
164167
await capOperatorPlugin('generate-runtime-values')
@@ -250,10 +253,11 @@ EXAMPLES
250253
rlQuestion.onSecondCall().callsArgWith(1, '')
251254
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
252255
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
253-
rlQuestion.onCall(4).callsArgWith(1, 'bem-aad-sadad-123456789012')
254-
rlQuestion.onCall(5).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
255-
rlQuestion.onCall(6).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
256-
rlQuestion.onCall(7).callsArgWith(1, 'regcred')
256+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
257+
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
258+
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
259+
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
260+
rlQuestion.onCall(8).callsArgWith(1, 'regcred')
257261

258262
cds.root = bookshop
259263
await capOperatorPlugin('generate-runtime-values')
@@ -277,10 +281,11 @@ EXAMPLES
277281
rlQuestion.onSecondCall().callsArgWith(1, '')
278282
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
279283
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
280-
rlQuestion.onCall(4).callsArgWith(1, 'bem-aad-sadad-123456789012')
281-
rlQuestion.onCall(5).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
282-
rlQuestion.onCall(6).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
283-
rlQuestion.onCall(7).callsArgWith(1, 'regcred')
284+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
285+
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
286+
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
287+
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
288+
rlQuestion.onCall(8).callsArgWith(1, 'regcred')
284289

285290
cds.root = bookshop
286291
await capOperatorPlugin('generate-runtime-values')
@@ -304,8 +309,9 @@ EXAMPLES
304309
rlQuestion.onSecondCall().callsArgWith(1, '')
305310
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
306311
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
307-
rlQuestion.onCall(4).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
308-
rlQuestion.onCall(5).callsArgWith(1, 'regcred')
312+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
313+
rlQuestion.onCall(5).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
314+
rlQuestion.onCall(6).callsArgWith(1, 'regcred')
309315

310316
cds.root = bookshop
311317
await capOperatorPlugin('generate-runtime-values')

test/files/expectedChart/runtime-values-ias.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ app:
2828
app: istio-ingressgateway
2929
btp:
3030
globalAccountId: dc94db56-asda-adssa-dada-123456789012
31+
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
3132
provider:
3233
subdomain: bem-aad-sadad-123456789012
3334
tenantId: dasdsd-1234-1234-1234-123456789012

test/files/expectedChart/runtime-values-svc-ias.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ app:
1616
app: istio-ingressgateway
1717
btp:
1818
globalAccountId: dc94db56-asda-adssa-dada-123456789012
19+
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
1920
imagePullSecrets:
2021
- regcred
2122
workloads:

test/files/expectedChart/runtime-values-svc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ app:
1111
app: istio-ingressgateway
1212
btp:
1313
globalAccountId: dc94db56-asda-adssa-dada-123456789012
14+
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
1415
imagePullSecrets:
1516
- regcred
1617
workloads:

test/files/expectedChart/runtime-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ app:
2020
app: istio-ingressgateway
2121
btp:
2222
globalAccountId: dc94db56-asda-adssa-dada-123456789012
23+
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
2324
provider:
2425
subdomain: bem-aad-sadad-123456789012
2526
tenantId: dasdsd-1234-1234-1234-123456789012

0 commit comments

Comments
 (0)