Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/cap-op-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ async function generateRuntimeValues(option, inputYamlPath) {
answerStruct = yaml.parse(await cds.utils.read(cds.utils.path.join(cds.root, inputYamlPath)))

const requiredFields = isServiceOnly
? ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId']
: ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubdomain', 'tenantId']
? ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId']
: ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId', 'providerSubdomain', 'tenantId']
Comment on lines +187 to +188
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic Error: Inconsistency in globalAccountId required status

The globalAccountId is listed as a required field here (lines 187-188), but in the schema files (files/chart/values.schema.json and files/configurableTemplatesChart/values.schema.json), it has been removed from the required array, and in hack/schema-generation.go:47 it's marked with omitempty. This creates an inconsistency where the plugin will reject YAML files missing globalAccountId even though the schema allows it to be optional.

Either globalAccountId should remain required in all places, or it should be made optional everywhere. Based on the PR description mentioning "misc adjustments until the field becomes mandatory (soon)", it appears both fields should be optional for now.

Suggested change
? ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId']
: ['appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId', 'providerSubdomain', 'tenantId']
const requiredFields = isServiceOnly
? ['appName', 'capOperatorSubdomain', 'clusterDomain', 'providerSubaccountId']
: ['appName', 'capOperatorSubdomain', 'clusterDomain', 'providerSubaccountId', 'providerSubdomain', 'tenantId']

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful


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

const answerKeys = [
'appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId',
'appName', 'capOperatorSubdomain', 'clusterDomain', 'globalAccountId', 'providerSubaccountId',
...isServiceOnly ? [] : ['providerSubdomain'],
...isServiceOnly ? [] : ['tenantId'],
'hanaInstanceId', 'imagePullSecret'
Expand Down
1 change: 0 additions & 1 deletion files/chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2897,7 +2897,6 @@
}
},
"required": [
"globalAccountId",
"provider"
],
"type": "object"
Expand Down
4 changes: 3 additions & 1 deletion files/chart/values.yaml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ app:

btp:
# -- BTP Global account identifier where the application is hosted
globalAccountId: # mandatory let helm fail if not provided
globalAccountId:
# -- BTP Provider sub-account identifier where the application is hosted
providerSubaccountId:
{{#isApp}}
provider:
# -- Subdomain of the provider sub-account where application services are created
Expand Down
1 change: 0 additions & 1 deletion files/configurableTemplatesChart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
}
},
"required": [
"globalAccountId",
"provider"
],
"type": "object"
Expand Down
4 changes: 3 additions & 1 deletion files/configurableTemplatesChart/values.yaml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ app:

btp:
# -- BTP Global account identifier where the application is hosted
globalAccountId: # mandatory let helm fail if not provided
globalAccountId:
# -- BTP Provider sub-account identifier where the application is hosted
providerSubaccountId:
{{#isApp}}
provider:
# -- Subdomain of the provider sub-account where application services are created
Expand Down
1 change: 1 addition & 0 deletions files/runtime-values.yaml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ app:

btp:
globalAccountId: {{globalAccountId}}
providerSubaccountId: {{providerSubaccountId}}
{{#isApp}}
provider:
subdomain: {{providerSubdomain}}
Expand Down
2 changes: 1 addition & 1 deletion hack/schema-generation.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type serviceBindingExt struct {
}

type btp struct {
GlobalAccountId string `json:"globalAccountId"`
GlobalAccountId string `json:"globalAccountId,omitempty"`
Copy link
Contributor Author

@Pavan-SAP Pavan-SAP Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking perhaps we should for now leave both as required instead, but maybe optional is better for now?

ProviderSubaccountId string `json:"providerSubaccountId,omitempty"`
Provider provider `json:"provider"`
}
Expand Down
46 changes: 26 additions & 20 deletions test/cap-op-plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ EXAMPLES
rlQuestion.onSecondCall().callsArgWith(1, '')
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
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(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(8).callsArgWith(1, 'regcred')

cds.root = bookshop
await capOperatorPlugin('generate-runtime-values')
Expand Down Expand Up @@ -131,10 +132,11 @@ EXAMPLES
rlQuestion.onSecondCall().callsArgWith(1, '')
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
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(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(8).callsArgWith(1, 'regcred')

cds.root = bookshop
await capOperatorPlugin('generate-runtime-values')
Expand All @@ -157,8 +159,9 @@ EXAMPLES
rlQuestion.onSecondCall().callsArgWith(1, '')
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(4).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'regcred')
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(6).callsArgWith(1, 'regcred')

cds.root = bookshop
await capOperatorPlugin('generate-runtime-values')
Expand Down Expand Up @@ -250,10 +253,11 @@ EXAMPLES
rlQuestion.onSecondCall().callsArgWith(1, '')
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
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(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(8).callsArgWith(1, 'regcred')

cds.root = bookshop
await capOperatorPlugin('generate-runtime-values')
Expand All @@ -277,10 +281,11 @@ EXAMPLES
rlQuestion.onSecondCall().callsArgWith(1, '')
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
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(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'bem-aad-sadad-123456789012')
rlQuestion.onCall(6).callsArgWith(1, 'dasdsd-1234-1234-1234-123456789012')
rlQuestion.onCall(7).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(8).callsArgWith(1, 'regcred')

cds.root = bookshop
await capOperatorPlugin('generate-runtime-values')
Expand All @@ -304,8 +309,9 @@ EXAMPLES
rlQuestion.onSecondCall().callsArgWith(1, '')
rlQuestion.onThirdCall().callsArgWith(1, 'c-abc.kyma.ondemand.com')
rlQuestion.onCall(3).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(4).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'regcred')
rlQuestion.onCall(4).callsArgWith(1, 'dc94db56-asda-adssa-dada-123456789012')
rlQuestion.onCall(5).callsArgWith(1, 'sdasd-4c4d-4d4d-4d4d-123456789012')
rlQuestion.onCall(6).callsArgWith(1, 'regcred')

cds.root = bookshop
await capOperatorPlugin('generate-runtime-values')
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/runtime-values-ias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
provider:
subdomain: bem-aad-sadad-123456789012
tenantId: dasdsd-1234-1234-1234-123456789012
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/runtime-values-svc-ias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
imagePullSecrets:
- regcred
workloads:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/runtime-values-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
imagePullSecrets:
- regcred
workloads:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/runtime-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
provider:
subdomain: bem-aad-sadad-123456789012
tenantId: dasdsd-1234-1234-1234-123456789012
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/values-ias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/values-svc-ias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
imagePullSecrets: []
workloads:
server:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/values-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
imagePullSecrets: []
workloads:
server:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/valuesWithDestination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/valuesWithMTA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
provider:
subdomain: bem-aad-sadad-123456789012
tenantId: dasdsd-1234-1234-1234-123456789012
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
imagePullSecrets:
- regcred
hanaInstanceId: sdasd-4c4d-4d4d-4d4d-123456789012
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
provider:
subdomain: bem-aad-sadad-123456789012
tenantId: dasdsd-1234-1234-1234-123456789012
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
imagePullSecrets: []
workloads:
server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
imagePullSecrets: []
hanaInstanceId: null
workloads:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
imagePullSecrets: []
hanaInstanceId: null
workloads:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedConfigurableTemplatesChart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
1 change: 1 addition & 0 deletions test/files/input_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ appName: bkshop
capOperatorSubdomain: cap-op
clusterDomain: c-abc.kyma.ondemand.com
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
providerSubdomain: bem-aad-sadad-123456789012
tenantId: dasdsd-1234-1234-1234-123456789012
imagePullSecret: regcred
Expand Down
1 change: 1 addition & 0 deletions test/files/input_values_wrong.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
capOperatorSubdomain: cap-op
clusterDomain: c-abc.kyma.ondemand.com
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
providerSubdomain: bem-aad-sadad-123456789012
tenantId: dasdsd-1234-1234-1234-123456789012
imagePullSecret: regcred
Expand Down
1 change: 1 addition & 0 deletions test/files/runtime-values-of-simple-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
provider:
subdomain: bem-aad-sadad-123456789012
tenantId: dasdsd-1234-1234-1234-123456789012
Expand Down
1 change: 1 addition & 0 deletions test/files/runtime-values-of-simple-service-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: dc94db56-asda-adssa-dada-123456789012
providerSubaccountId: dc94db56-asda-adssa-dada-123456789012
imagePullSecrets:
- regcred
workloads:
Expand Down
4 changes: 3 additions & 1 deletion test/files/updatedValues.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2373,12 +2373,14 @@
},
"provider": {
"$ref": "#/$defs/provider"
},
"providerSubaccountId": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"globalAccountId",
"provider"
]
},
Expand Down
1 change: 1 addition & 0 deletions test/files/values-of-simple-chart-filled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
provider:
subdomain: null
tenantId: null
Expand Down
1 change: 1 addition & 0 deletions test/files/values-of-simple-service-chart-filled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ app:
app: istio-ingressgateway
btp:
globalAccountId: null
providerSubaccountId: null
imagePullSecrets: []
workloads:
server:
Expand Down
Loading