Skip to content

Commit 2da0841

Browse files
committed
[Misc] Plugin: providerSubaccountId runtime support added
minor enhancement to source `providerSubaccountId`. - misc adjustments until the field becomes mandatory (soon).
1 parent d6228bd commit 2da0841

35 files changed

+64
-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.schema.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2897,7 +2897,6 @@
28972897
}
28982898
},
28992899
"required": [
2900-
"globalAccountId",
29012900
"provider"
29022901
],
29032902
"type": "object"

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.schema.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
}
150150
},
151151
"required": [
152-
"globalAccountId",
153152
"provider"
154153
],
155154
"type": "object"

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}}

hack/schema-generation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type serviceBindingExt struct {
4444
}
4545

4646
type btp struct {
47-
GlobalAccountId string `json:"globalAccountId"`
47+
GlobalAccountId string `json:"globalAccountId,omitempty"`
4848
ProviderSubaccountId string `json:"providerSubaccountId,omitempty"`
4949
Provider provider `json:"provider"`
5050
}

test/cap-op-plugin.test.js

Lines changed: 23 additions & 18 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')
@@ -250,10 +252,11 @@ EXAMPLES
250252
rlQuestion.onSecondCall().callsArgWith(1, '')
251253
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
252254
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')
255+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
256+
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
257+
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
258+
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
259+
rlQuestion.onCall(8).callsArgWith(1, 'regcred')
257260

258261
cds.root = bookshop
259262
await capOperatorPlugin('generate-runtime-values')
@@ -277,10 +280,11 @@ EXAMPLES
277280
rlQuestion.onSecondCall().callsArgWith(1, '')
278281
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
279282
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')
283+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
284+
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
285+
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
286+
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
287+
rlQuestion.onCall(8).callsArgWith(1, 'regcred')
284288

285289
cds.root = bookshop
286290
await capOperatorPlugin('generate-runtime-values')
@@ -304,8 +308,9 @@ EXAMPLES
304308
rlQuestion.onSecondCall().callsArgWith(1, '')
305309
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
306310
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')
311+
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
312+
rlQuestion.onCall(5).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
313+
rlQuestion.onCall(6).callsArgWith(1, 'regcred')
309314

310315
cds.root = bookshop
311316
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:

0 commit comments

Comments
 (0)