@sap/cds-dk 6.1.5 → 6.2.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.
- package/CHANGELOG.md +30 -2
- package/bin/cds.js +7 -5
- package/bin/deploy/index.js +3 -2
- package/bin/deploy/to-sqlite.js +4 -3
- package/bin/help.js +4 -0
- package/bin/init.js +2 -1
- package/bin/login.js +23 -9
- package/bin/mock.js +1 -0
- package/bin/pull.js +24 -19
- package/bin/push.js +20 -9
- package/bin/subscribe.js +40 -10
- package/bin/watch.js +15 -10
- package/lib/bind/kubernetesCredentialsProvider.js +1 -0
- package/lib/client/activate.js +42 -51
- package/lib/client/auth_manager.js +7 -8
- package/lib/client/base_command.js +5 -2
- package/lib/client/extend.js +33 -38
- package/lib/client/helper/cf_helper.js +11 -11
- package/lib/client/helper/dependency_helper.js +2 -2
- package/lib/client/helper/errors.js +4 -3
- package/lib/client/helper/logging.js +17 -23
- package/lib/client/params.js +5 -5
- package/lib/client/pull.js +19 -21
- package/lib/client/push.js +16 -15
- package/lib/client/settings_manager.js +54 -55
- package/lib/compile/openapi/csdl2openapi.js +18 -12
- package/lib/import/message.js +1 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +23 -17
- package/lib/import/odata/v2parser.js +43 -17
- package/lib/import/odata/v4parser.js +77 -22
- package/lib/init/constants.js +5 -2
- package/lib/init/index.js +16 -4
- package/lib/init/template/_merging/registry-mta.js +13 -0
- package/lib/init/template/approuter/index.js +9 -0
- package/lib/{k8s/connectivity/templates/connectivity.yaml → init/template/auditlog/files/auditlog.yaml} +0 -0
- package/lib/init/template/auditlog/index.js +46 -27
- package/lib/{k8s/connectivity/templates → init/template/connectivity/files}/connectivity-binding.yaml +0 -0
- package/lib/{k8s/connectivity/templates → init/template/connectivity/files}/connectivity-proxy-info.yaml +1 -1
- package/lib/init/template/connectivity/files/connectivity.yaml +1 -0
- package/lib/init/template/connectivity/files/values.yaml.hbs +26 -0
- package/lib/init/template/connectivity/index.js +41 -0
- package/lib/init/template/data/index.js +8 -8
- package/lib/init/template/destinations/files/destination.yaml +1 -0
- package/lib/init/template/destinations/index.js +44 -0
- package/lib/init/template/enterprise-messaging/files/cds.package.json +10 -0
- package/lib/init/template/enterprise-messaging/files/cds.profile.package.json.hbs +12 -0
- package/lib/init/template/enterprise-messaging/files/cdsrc.json +8 -0
- package/lib/init/template/enterprise-messaging/files/cdsrc.json.hbs +10 -0
- package/lib/init/template/enterprise-messaging/files/event-mesh.yaml +1 -0
- package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +13 -0
- package/lib/init/template/enterprise-messaging/files/values.yaml +8 -0
- package/lib/init/template/enterprise-messaging/index.js +56 -0
- package/lib/init/template/extensibility/files/cdsrc.json +5 -0
- package/lib/init/template/extensibility/files/cdsrc.json.hbs +7 -0
- package/lib/init/template/extensibility/index.js +18 -13
- package/lib/{k8s/hana-deployer/templates → init/template/hana/files}/hana-deployer-job.yaml +0 -0
- package/lib/init/template/hana/files/java/{cdsrc.json.hbs → cds.json.hbs} +0 -0
- package/lib/init/template/hana/files/java/{profile.cdsrc.json.hbs → cds.profile.json.hbs} +0 -0
- package/lib/init/template/hana/files/java/cds.shortcut.json.hbs +5 -0
- package/lib/init/template/hana/files/java/cds.shortcut.profile.json.hbs +8 -0
- package/lib/init/template/hana/files/java/db/package.json +2 -1
- package/lib/init/template/hana/files/mta.yaml.hbs +6 -0
- package/lib/init/template/hana/files/nodejs/{cds.package.json.hbs → cds.json.hbs} +0 -0
- package/lib/init/template/hana/files/nodejs/{cds.profile.package.json.hbs → cds.profile.json.hbs} +0 -0
- package/lib/init/template/hana/files/nodejs/cds.shortcut.json.hbs +7 -0
- package/lib/init/template/hana/files/nodejs/cds.shortcut.profile.json.hbs +10 -0
- package/lib/init/template/hana/files/values.yaml.hbs +19 -0
- package/lib/init/template/hana/index.js +29 -29
- package/lib/{k8s → init/template/helm}/Model.d.ts +0 -0
- package/lib/{k8s/resources → init/template}/helm/chart/templates/NOTES.txt +0 -0
- package/lib/{k8s/resources → init/template}/helm/chart/templates/_deployment_helpers.tpl +0 -0
- package/lib/{k8s/resources → init/template}/helm/chart/templates/_helpers.tpl +4 -5
- package/lib/{k8s/resources → init/template}/helm/chart/templates/_sapcp_helpers.tpl +0 -0
- package/lib/{k8s/resources/helm/chart/schemas → init/template/helm/chart}/values.root.schema.json +0 -0
- package/lib/{k8s/resources/helm/chart/schemas → init/template/helm/chart}/values.schema.json +0 -0
- package/lib/init/template/helm/files/Chart.yaml.hbs +13 -0
- package/lib/init/template/helm/files/values.yaml.hbs +26 -0
- package/lib/init/template/helm/index.js +74 -14
- package/lib/{k8s/deployment → init/template/helm}/subchart/Chart.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/_helpers.tpl +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/api-rule.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/deployment.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/network-policy.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/pod-disruption-budget.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/secret.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/service-binding.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/templates/service.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/values-lint.yaml +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/values.md +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/values.schema.json +0 -0
- package/lib/{k8s/deployment → init/template/helm}/subchart/values.yaml +0 -0
- package/lib/{k8s/html5-apps-deployer/templates → init/template/html5-repo/files}/_html5_deployment_helpers.tpl +0 -0
- package/lib/{k8s/html5-apps-deployer/templates → init/template/html5-repo/files}/html5-apps-deployer-job.yaml +1 -1
- package/lib/{k8s/html5-apps-repo-host/templates → init/template/html5-repo/files}/html5-apps-repo-host.yaml +0 -0
- package/lib/init/template/html5-repo/index.js +59 -0
- package/lib/init/template/kibana-logging/index.js +8 -0
- package/lib/init/template/lint/index.js +1 -4
- package/lib/init/template/mta/files/mta.yaml.hbs +3 -2
- package/lib/init/template/mta/index.js +6 -1
- package/lib/init/template/multitenancy/files/java/.cdsrc.json +3 -0
- package/lib/init/template/multitenancy/files/java/package.json +2 -6
- package/lib/{k8s/multitenancy/templates → init/template/multitenancy/files}/saas-registry.yaml +3 -3
- package/lib/init/template/multitenancy/files/xsuaa.yaml +1 -0
- package/lib/init/template/multitenancy/index.js +53 -26
- package/lib/init/template/nodejs/files/.gitignore.hbs +1 -0
- package/lib/init/template/templateBase.js +1 -1
- package/lib/init/template/xsuaa/files/values.yaml.hbs +10 -0
- package/lib/init/template/xsuaa/files/xsuaa.yaml +1 -0
- package/lib/init/template/xsuaa/index.js +34 -22
- package/lib/init/util/fsUtil.js +11 -5
- package/lib/init/util/projectReader.js +24 -32
- package/lib/init/util/templateUtil.js +17 -5
- package/lib/lint/Linter.js +9 -17
- package/lib/lint/checks.js +0 -1
- package/lib/lint/generators.js +2 -192
- package/lib/lint/io.js +1 -3
- package/lib/watch/node-watch.js +2 -2
- package/npm-shrinkwrap.json +1400 -779
- package/package.json +5 -4
- package/lib/init/template/helm/update/index.js +0 -28
- package/lib/k8s/ChartAdder.js +0 -75
- package/lib/k8s/ChartBuilder.js +0 -192
- package/lib/k8s/Context.js +0 -71
- package/lib/k8s/ImageUtil.js +0 -21
- package/lib/k8s/auditlog/index.js +0 -29
- package/lib/k8s/auditlog/templates/auditlog.yaml +0 -1
- package/lib/k8s/buildModel.js +0 -68
- package/lib/k8s/connectivity/index.js +0 -80
- package/lib/k8s/deployment/index.js +0 -79
- package/lib/k8s/deployment/subchart-override/templates/_web_application_helpers.tpl +0 -81
- package/lib/k8s/destinations/index.js +0 -40
- package/lib/k8s/destinations/lib.js +0 -16
- package/lib/k8s/destinations/templates/destinations.yaml +0 -1
- package/lib/k8s/docker/push.js +0 -8
- package/lib/k8s/event-mesh/index.js +0 -53
- package/lib/k8s/event-mesh/lib.js +0 -9
- package/lib/k8s/event-mesh/templates/event-mesh.yaml +0 -1
- package/lib/k8s/hana-deployer/index.js +0 -48
- package/lib/k8s/helm/Release.js +0 -80
- package/lib/k8s/html5-apps-deployer/index.js +0 -53
- package/lib/k8s/html5-apps-repo-host/index.js +0 -26
- package/lib/k8s/html5-apps-repo-host/lib.js +0 -16
- package/lib/k8s/index.js +0 -153
- package/lib/k8s/modules.js +0 -36
- package/lib/k8s/multitenancy/index.js +0 -24
- package/lib/k8s/multitenancy/lib.js +0 -25
- package/lib/k8s/readProject.js +0 -14
- package/lib/k8s/util.js +0 -186
- package/lib/k8s/wrapFeature.js +0 -55
- package/lib/k8s/xsuaa/index.js +0 -64
- package/lib/k8s/xsuaa/lib.js +0 -17
- package/lib/k8s/xsuaa/templates/xsuaa.yaml +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const TemplateBase = require('../templateBase')
|
|
3
|
+
const ProjectReader = require('../../util/projectReader')
|
|
4
|
+
const cds = require('../../../cds'), { fs } = cds.utils
|
|
5
|
+
|
|
6
|
+
module.exports = class ConnectivityTemplate extends TemplateBase {
|
|
7
|
+
constructor(projectPath, generator) {
|
|
8
|
+
super(projectPath, generator, __dirname)
|
|
9
|
+
this.projectReader = new ProjectReader(this)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async run() {
|
|
13
|
+
await this.runDependentMerging()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async runDependentMerging() {
|
|
17
|
+
const projectDescriptor = await this.projectReader.read(this.options)
|
|
18
|
+
const { hasHelmDeployment } = projectDescriptor.cap
|
|
19
|
+
|
|
20
|
+
if (hasHelmDeployment) {
|
|
21
|
+
await this.templateUtil.mergeYAML(
|
|
22
|
+
path.join(this.projectPath, 'chart', 'values.yaml'),
|
|
23
|
+
path.join(__dirname, 'files', 'values.yaml.hbs'),
|
|
24
|
+
projectDescriptor,
|
|
25
|
+
{ additions: [{
|
|
26
|
+
ref: `srv-additional-volumes`,
|
|
27
|
+
in: `srv.additionalVolumes`,
|
|
28
|
+
where: [{
|
|
29
|
+
property: 'name',
|
|
30
|
+
isEqualTo: 'connectivity-secret'
|
|
31
|
+
}]
|
|
32
|
+
}]}
|
|
33
|
+
)
|
|
34
|
+
const filesPath = path.join(__dirname, 'files')
|
|
35
|
+
const templatesPath = path.join(this.projectPath, 'chart', 'templates')
|
|
36
|
+
await fs.copy(path.join(filesPath, 'connectivity-binding.yaml'), path.join(templatesPath, 'connectivity-binding.yaml'))
|
|
37
|
+
await fs.copy(path.join(filesPath, 'connectivity-proxy-info.yaml'), path.join(templatesPath, 'connectivity-proxy-info.yaml'))
|
|
38
|
+
await fs.copy(path.join(filesPath, 'connectivity.yaml'), path.join(templatesPath, 'connectivity.yaml'))
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -127,14 +127,14 @@ function createDataFile (isFileExists, dataFilePath, dest, projectPath, force, e
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
function prepareDataFileContent (entity) {
|
|
130
|
-
const persistenceKeyNames = Object.
|
|
131
|
-
return Object.
|
|
132
|
-
.filter(element => !(element instanceof cds.Association)) // exclude associations+compositions
|
|
133
|
-
.filter(element => !!element['@cds.persistence.name']) // exclude no-persistence elements, e.g. virtual ones
|
|
134
|
-
.map (
|
|
135
|
-
.sort((
|
|
136
|
-
if (persistenceKeyNames.includes(
|
|
137
|
-
if (!persistenceKeyNames.includes(
|
|
130
|
+
const persistenceKeyNames = Object.keys(entity.keys||[])
|
|
131
|
+
return Object.entries(entity.elements)
|
|
132
|
+
.filter(([,element]) => !(element instanceof cds.Association)) // exclude associations+compositions
|
|
133
|
+
.filter(([,element]) => !!element['@cds.persistence.name']) // exclude no-persistence elements, e.g. virtual ones
|
|
134
|
+
.map (([key]) => key)
|
|
135
|
+
.sort((k1, k2) => { // sort with keys first
|
|
136
|
+
if (persistenceKeyNames.includes(k1) && !persistenceKeyNames.includes(k2)) return -1
|
|
137
|
+
if (!persistenceKeyNames.includes(k1) && persistenceKeyNames.includes(k2)) return 1
|
|
138
138
|
return 0 // preserve original order otherwise
|
|
139
139
|
})
|
|
140
140
|
.join(';')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{- include "cap.service-instance" . }}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const TemplateBase = require('../templateBase')
|
|
3
|
+
const ProjectReader = require('../../util/projectReader')
|
|
4
|
+
const cds = require('../../../cds'), { fs } = cds.utils
|
|
5
|
+
|
|
6
|
+
module.exports = class DestinationsTemplate extends TemplateBase {
|
|
7
|
+
constructor(projectPath, generator) {
|
|
8
|
+
super(projectPath, generator, __dirname)
|
|
9
|
+
this.projectReader = new ProjectReader(this)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async run() {
|
|
13
|
+
await this.runDependentMerging()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async runDependentMerging() {
|
|
17
|
+
const projectDescriptor = await this.projectReader.read(this.options)
|
|
18
|
+
const { hasHelmDeployment, hasDestination, hasHtml5Repo } = projectDescriptor.cap
|
|
19
|
+
|
|
20
|
+
if (hasHelmDeployment) {
|
|
21
|
+
const env = await this.getEnv()
|
|
22
|
+
const binding = hasDestination && { srv: { bindings: { destination: { serviceInstanceName: 'destinations' }}}}
|
|
23
|
+
const html5Binding = hasHtml5Repo && { html5_apps_deployer: { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
24
|
+
|
|
25
|
+
await this.templateUtil.mergeYAML(
|
|
26
|
+
path.join(this.projectPath, 'chart', 'values.yaml'),
|
|
27
|
+
{
|
|
28
|
+
...binding,
|
|
29
|
+
...html5Binding,
|
|
30
|
+
destination: {
|
|
31
|
+
serviceOfferingName: 'destination',
|
|
32
|
+
servicePlanName: 'lite',
|
|
33
|
+
parameters: {
|
|
34
|
+
version: '1.0.0',
|
|
35
|
+
...(hasHtml5Repo) && { HTML5Runtime_enabled: true }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
null, { forceOverwrite: true }
|
|
40
|
+
)
|
|
41
|
+
await fs.copy(path.join(__dirname, 'files', 'destination.yaml'), path.join(this.projectPath, 'chart', 'templates', 'destination.yaml'))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{- include "cap.service-instance" . }}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
modules:
|
|
3
|
+
- name: {{cap.appName}}-srv
|
|
4
|
+
type: {{cap.pLanguage}}
|
|
5
|
+
requires:
|
|
6
|
+
- name: {{cap.appName}}-messaging
|
|
7
|
+
|
|
8
|
+
resources:
|
|
9
|
+
- name: {{cap.appName}}-messaging
|
|
10
|
+
type: org.cloudfoundry.managed-service
|
|
11
|
+
parameters:
|
|
12
|
+
service: enterprise-messaging
|
|
13
|
+
service-plan: default
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const cds = require('../../../cds'), { fs } = cds.utils
|
|
3
|
+
const ProjectReader = require('../../util/projectReader')
|
|
4
|
+
const { srvNode, srvJava, enterpriseMessaging } = require('../_merging/registry-mta')
|
|
5
|
+
|
|
6
|
+
module.exports = class EnterpriseMessagingTemplate extends require('../templateBase') {
|
|
7
|
+
constructor(projectPath, generator) {
|
|
8
|
+
super(projectPath, generator, __dirname)
|
|
9
|
+
this.projectReader = new ProjectReader(this)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async run() {
|
|
13
|
+
const projectDescriptor = await this.projectReader.read(this.options)
|
|
14
|
+
const { for: forProfile, isNodejs } = projectDescriptor.cap
|
|
15
|
+
const templatePath = path.join(__dirname, 'files')
|
|
16
|
+
const cdsTemplateFile = (isNodejs ? 'cds.package.json' : 'cdsrc.json') + (forProfile ? '.hbs' : '')
|
|
17
|
+
const cdsTemplatePath = path.join(templatePath, cdsTemplateFile)
|
|
18
|
+
const configPath = path.join(this.projectPath, isNodejs ? 'package.json' : '.cdsrc.json')
|
|
19
|
+
await this.templateUtil.mergeJSON(configPath, cdsTemplatePath, projectDescriptor)
|
|
20
|
+
await this.runDependentMerging()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async runDependentMerging() {
|
|
24
|
+
const projectDescriptor = await this.projectReader.read(this.options)
|
|
25
|
+
const { hasHelmDeployment, hasMtaDeployment, isNodejs } = projectDescriptor.cap
|
|
26
|
+
|
|
27
|
+
if (hasMtaDeployment) {
|
|
28
|
+
const mtaYAMLPath = path.join(this.projectPath, 'mta.yaml')
|
|
29
|
+
const srv = isNodejs ? srvNode : srvJava
|
|
30
|
+
await this.templateUtil.mergeYAML(
|
|
31
|
+
mtaYAMLPath,
|
|
32
|
+
`${__dirname}/files/mta.yaml.hbs`,
|
|
33
|
+
projectDescriptor,
|
|
34
|
+
{
|
|
35
|
+
additions: [srv, enterpriseMessaging],
|
|
36
|
+
relationships: [{
|
|
37
|
+
insert: [enterpriseMessaging, 'name'],
|
|
38
|
+
into: [srv, 'requires', 'name']
|
|
39
|
+
}]
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (hasHelmDeployment) {
|
|
45
|
+
await this.templateUtil.mergeYAML(
|
|
46
|
+
path.join(this.projectPath, 'chart', 'values.yaml'),
|
|
47
|
+
path.join(__dirname, 'files', 'values.yaml'),
|
|
48
|
+
null, { forceOverwrite: true }
|
|
49
|
+
)
|
|
50
|
+
await fs.copy(
|
|
51
|
+
path.join(__dirname, 'files', 'event-mesh.yaml'),
|
|
52
|
+
path.join(this.projectPath, 'chart', 'templates', 'event-mesh.yaml')
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const cds = require('../../../cds'), { path } = cds.utils
|
|
1
|
+
const cds = require('../../../cds'), { fs, path } = cds.utils
|
|
2
2
|
const TemplateBase = require('../templateBase')
|
|
3
3
|
const ProjectReader = require('../../util/projectReader')
|
|
4
4
|
|
|
@@ -8,9 +8,18 @@ module.exports = class ExtensibilityTemplate extends TemplateBase {
|
|
|
8
8
|
this.projectReader = new ProjectReader(this)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
async run() {
|
|
12
|
+
const projectDescriptor = await this.projectReader.read(this.options)
|
|
13
|
+
const { for: forProfile, isJava } = projectDescriptor.cap
|
|
14
|
+
const cdsConfigPath = path.join(this.projectPath, isJava ? '.cdsrc.json' : 'package.json')
|
|
15
|
+
const cdsTemplateFile = forProfile ? (isJava ? 'cdsrc.json.hbs' : 'cds.package.json.hbs') : (isJava ? 'cdsrc.json' : 'cds.package.json')
|
|
16
|
+
await this.templateUtil.mergeJSON(cdsConfigPath, path.join(__dirname, 'files', cdsTemplateFile), projectDescriptor)
|
|
17
|
+
await this.runDependentMerging()
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
async runDependentMerging() {
|
|
12
21
|
const projectDescriptor = await this.projectReader.read()
|
|
13
|
-
const { hasXsuaa } = projectDescriptor.cap
|
|
22
|
+
const { hasXsuaa, hasHelmDeployment } = projectDescriptor.cap
|
|
14
23
|
if (hasXsuaa) {
|
|
15
24
|
await this.templateUtil.mergeJSON(
|
|
16
25
|
path.join(this.projectPath, 'xs-security.json'),
|
|
@@ -33,16 +42,12 @@ module.exports = class ExtensibilityTemplate extends TemplateBase {
|
|
|
33
42
|
}
|
|
34
43
|
)
|
|
35
44
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const cdsTemplateFile = forProfile ? 'cds.package.json.hbs' : 'cds.package.json'
|
|
44
|
-
await this.templateUtil.mergeJSON(packageJSONPath, path.join(__dirname, 'files', cdsTemplateFile), projectDescriptor)
|
|
45
|
-
await this.templateUtil.sortDependencies(packageJSONPath)
|
|
46
|
-
await this.runDependentMerging()
|
|
45
|
+
if (hasXsuaa && hasHelmDeployment) {
|
|
46
|
+
// REVISIT: Shared xs-security.json location for Helm and MTA?
|
|
47
|
+
await fs.copy(
|
|
48
|
+
path.join(this.projectPath, 'xs-security.json'),
|
|
49
|
+
path.join(this.projectPath, 'chart', 'xs-security.json')
|
|
50
|
+
)
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
53
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"requires": {
|
|
3
|
+
"[{{cap.for}}]": {
|
|
4
|
+
"db": "{{#cap.isMultitenant}}hana-mt{{/cap.isMultitenant}}{{^cap.isMultitenant}}hana-cloud{{/cap.isMultitenant}}"
|
|
5
|
+
},
|
|
6
|
+
"db": "{{#cap.isMultitenant}}sqlite{{/cap.isMultitenant}}{{^cap.isMultitenant}}sql{{/cap.isMultitenant}}"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -11,6 +11,12 @@ modules:
|
|
|
11
11
|
path: {{& cap.db.0.path}}
|
|
12
12
|
parameters:
|
|
13
13
|
buildpack: nodejs_buildpack
|
|
14
|
+
{{#cap.isJava}}
|
|
15
|
+
build-parameters:
|
|
16
|
+
builder: custom
|
|
17
|
+
commands:
|
|
18
|
+
- npm run build
|
|
19
|
+
{{/cap.isJava}}
|
|
14
20
|
requires:
|
|
15
21
|
- name: {{cap.appName}}-db
|
|
16
22
|
{{/cap.isMultitenant}}
|
|
File without changes
|
package/lib/init/template/hana/files/nodejs/{cds.profile.package.json.hbs → cds.profile.json.hbs}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cds": {
|
|
3
|
+
"requires": {
|
|
4
|
+
"[{{cap.for}}]": {
|
|
5
|
+
"db": "{{#cap.isMultitenant}}hana-mt{{/cap.isMultitenant}}{{^cap.isMultitenant}}hana-cloud{{/cap.isMultitenant}}"
|
|
6
|
+
},
|
|
7
|
+
"db": "{{#cap.isMultitenant}}sqlite{{/cap.isMultitenant}}{{^cap.isMultitenant}}sql{{/cap.isMultitenant}}"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
srv:
|
|
3
|
+
bindings:
|
|
4
|
+
db:
|
|
5
|
+
fromSecret: null
|
|
6
|
+
hana_deployer:
|
|
7
|
+
image:
|
|
8
|
+
repository: <your-container-registry>/{{cap.appName}}-hana-deployer
|
|
9
|
+
tag: latest
|
|
10
|
+
bindings:
|
|
11
|
+
hana:
|
|
12
|
+
fromSecret: null
|
|
13
|
+
resources:
|
|
14
|
+
limits:
|
|
15
|
+
cpu: 2000m
|
|
16
|
+
memory: 1G
|
|
17
|
+
requests:
|
|
18
|
+
cpu: 1000m
|
|
19
|
+
memory: 1G
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
1
|
const path = require('path');
|
|
3
2
|
|
|
4
3
|
const commandUtil = require('../../util/commandUtil');
|
|
@@ -9,9 +8,10 @@ const ProjectReader = require('../../util/projectReader');
|
|
|
9
8
|
const TemplateBase = require('../templateBase');
|
|
10
9
|
const versionCompare = require('../../util/versionCompare');
|
|
11
10
|
|
|
12
|
-
const { PROJECT_TYPE, OPTION_JAVA, URLS
|
|
11
|
+
const { PROJECT_TYPE, OPTION_JAVA, URLS } = require('../../constants');
|
|
13
12
|
const { nullLogger } = require('../../util/logger');
|
|
14
13
|
const { srvNode, srvJava, hdbDeployer, serviceManager, hdiContainer, mtxSidecar } = require('../_merging/registry-mta');
|
|
14
|
+
const cds = require('../../../cds'), { fs } = cds.utils
|
|
15
15
|
|
|
16
16
|
module.exports = class HanaTemplate extends TemplateBase {
|
|
17
17
|
constructor(projectPath, generator) {
|
|
@@ -19,10 +19,6 @@ module.exports = class HanaTemplate extends TemplateBase {
|
|
|
19
19
|
this.projectReader = new ProjectReader(this);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
async getDependencies() {
|
|
23
|
-
return [OPTION_HELM_UPDATE];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
22
|
// read env from project
|
|
27
23
|
async getEnv() {
|
|
28
24
|
const cdsEnvVar = process.env.CDS_ENV;
|
|
@@ -44,12 +40,10 @@ module.exports = class HanaTemplate extends TemplateBase {
|
|
|
44
40
|
|
|
45
41
|
async runDependentMerging() {
|
|
46
42
|
const projectDescriptor = await this.projectReader.read(this.options)
|
|
47
|
-
const { hasMtaDeployment, isNodejs, isJava, isMultitenant
|
|
43
|
+
const { hasMtaDeployment, hasHelmDeployment, isNodejs, isJava, isMultitenant } = projectDescriptor.cap
|
|
48
44
|
|
|
49
|
-
if (
|
|
45
|
+
if (isMultitenant) {
|
|
50
46
|
await this._updateCdsConfiguration()
|
|
51
|
-
} else if (isJava && isMultitenant) {
|
|
52
|
-
await this._updateCdsrcJson()
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
if (hasMtaDeployment) {
|
|
@@ -99,6 +93,17 @@ module.exports = class HanaTemplate extends TemplateBase {
|
|
|
99
93
|
{ additions: [...modules, db].filter(a => a), deletions, relationships }
|
|
100
94
|
)
|
|
101
95
|
}
|
|
96
|
+
|
|
97
|
+
if (hasHelmDeployment) {
|
|
98
|
+
await this.templateUtil.mergeYAML(
|
|
99
|
+
path.join(this.projectPath, 'chart', 'values.yaml'),
|
|
100
|
+
path.join(__dirname, 'files', 'values.yaml.hbs'),
|
|
101
|
+
projectDescriptor, { forceOverwrite: true })
|
|
102
|
+
await fs.copy(
|
|
103
|
+
path.join(__dirname, 'files', 'hana-deployer-job.yaml'),
|
|
104
|
+
path.join(this.projectPath, 'chart', 'templates', 'hana-deployer-job.yaml')
|
|
105
|
+
)
|
|
106
|
+
}
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
async run() {
|
|
@@ -117,7 +122,7 @@ module.exports = class HanaTemplate extends TemplateBase {
|
|
|
117
122
|
case PROJECT_TYPE.java: {
|
|
118
123
|
await this.templateUtil.copyFiles(path.join('java', 'db'), path.join(this.projectPath, env.folders.db), {}, this.options.force);
|
|
119
124
|
await this._updatePomXml();
|
|
120
|
-
await this.
|
|
125
|
+
await this._updateCdsConfiguration();
|
|
121
126
|
break;
|
|
122
127
|
}
|
|
123
128
|
case PROJECT_TYPE.nodejs: {
|
|
@@ -157,27 +162,22 @@ module.exports = class HanaTemplate extends TemplateBase {
|
|
|
157
162
|
await this.fsUtil.writeJSON(packageJsonPath, packageJson);
|
|
158
163
|
}
|
|
159
164
|
|
|
160
|
-
await this._updateCdsConfiguration(
|
|
165
|
+
await this._updateCdsConfiguration()
|
|
161
166
|
}
|
|
162
167
|
|
|
163
|
-
async _updateCdsConfiguration() {
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
const cdsTemplateFile = forProfile ? 'cds.profile.package.json.hbs' : 'cds.package.json.hbs';
|
|
168
|
-
const cdsTemplatePath = path.join(__dirname, 'files', 'nodejs', cdsTemplateFile);
|
|
169
|
-
await this.templateUtil.mergeJSON(packageJsonPath, cdsTemplatePath, projectDescriptor, { forceOverwrite: true })
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
async _updateCdsrcJson() {
|
|
173
|
-
const cdsrcJsonPath = path.join(this.projectPath, '.cdsrc.json');
|
|
168
|
+
async _updateCdsConfiguration(configPath) {
|
|
169
|
+
const projectType = await this.getProjectType();
|
|
170
|
+
const configFile = projectType === PROJECT_TYPE.nodejs ? 'package.json' : '.cdsrc.json';
|
|
171
|
+
configPath = configPath ?? path.join(this.projectPath, configFile)
|
|
174
172
|
const projectDescriptor = await this.projectReader.read(this.options);
|
|
175
173
|
const { for: forProfile } = projectDescriptor.cap;
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
174
|
+
let json; try { json = await this.fsUtil.readJSON(configPath) } catch { /* ignore */ }
|
|
175
|
+
const _cds = projectType === PROJECT_TYPE.nodejs ? json?.cds : json;
|
|
176
|
+
const shortcut = typeof _cds?.requires?.db === 'string' || !json ? 'shortcut.' : '';
|
|
177
|
+
const profile = forProfile ? 'profile.' : '';
|
|
178
|
+
const cdsTemplateFile = `cds.${shortcut}${profile}json.hbs`
|
|
179
|
+
const { pLanguage } = projectDescriptor.cap;
|
|
180
|
+
const cdsTemplatePath = path.join(__dirname, 'files', pLanguage, cdsTemplateFile);
|
|
181
|
+
await this.templateUtil.mergeJSON(configPath, cdsTemplatePath, projectDescriptor, { forceOverwrite: true })
|
|
182
182
|
}
|
|
183
183
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -23,15 +23,14 @@ Check for mandatory configuration options
|
|
|
23
23
|
Labels for a component
|
|
24
24
|
*/}}
|
|
25
25
|
{{- define "cap.labels" -}}
|
|
26
|
-
helm.sh/
|
|
26
|
+
helm.sh/revision: {{ .Release.Revision | quote }}
|
|
27
|
+
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
27
28
|
app.kubernetes.io/name: {{ .name }}
|
|
28
29
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
29
30
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
31
|
+
{{- if .Chart.AppVersion }}
|
|
30
32
|
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
|
31
|
-
{{- end
|
|
32
|
-
{{- define "cap.labelsWithRevision" -}}
|
|
33
|
-
{{- include "cap.labels" . }}
|
|
34
|
-
revision: "{{ .Release.Revision }}"
|
|
33
|
+
{{- end }}
|
|
35
34
|
{{- end -}}
|
|
36
35
|
|
|
37
36
|
{{/*
|
|
File without changes
|
package/lib/{k8s/resources/helm/chart/schemas → init/template/helm/chart}/values.root.schema.json
RENAMED
|
File without changes
|
package/lib/{k8s/resources/helm/chart/schemas → init/template/helm/chart}/values.schema.json
RENAMED
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
#
|
|
3
|
+
# This file is generated by "cds add helm"
|
|
4
|
+
apiVersion: v2
|
|
5
|
+
name: {{cap.appName}}
|
|
6
|
+
description: {{cap.appDescription}}
|
|
7
|
+
type: application
|
|
8
|
+
version: {{cap.appVersion}}
|
|
9
|
+
appVersion: {{cap.appVersion}}
|
|
10
|
+
dependencies:
|
|
11
|
+
- name: web-application
|
|
12
|
+
alias: srv
|
|
13
|
+
version: 0.1.0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
global:
|
|
3
|
+
domain: null
|
|
4
|
+
imagePullSecret: {}
|
|
5
|
+
srv:
|
|
6
|
+
bindings: {}
|
|
7
|
+
image:
|
|
8
|
+
repository: <your-container-registry>/{{cap.appName}}-srv
|
|
9
|
+
tag: latest
|
|
10
|
+
{{#cap.isJava}}
|
|
11
|
+
env:
|
|
12
|
+
SPRING_PROFILES_ACTIVE: cloud
|
|
13
|
+
{{/cap.isJava}}
|
|
14
|
+
resources:
|
|
15
|
+
limits:
|
|
16
|
+
ephemeral-storage: 1G
|
|
17
|
+
memory: {{#cap.isJava}}1G{{/cap.isJava}}{{^cap.isJava}}500M{{/cap.isJava}}
|
|
18
|
+
requests:
|
|
19
|
+
ephemeral-storage: 1G
|
|
20
|
+
cpu: {{#cap.isJava}}1000m{{/cap.isJava}}{{^cap.isJava}}500m{{/cap.isJava}}
|
|
21
|
+
memory: {{#cap.isJava}}1G{{/cap.isJava}}{{^cap.isJava}}500M{{/cap.isJava}}
|
|
22
|
+
health_check:
|
|
23
|
+
liveness:
|
|
24
|
+
path: /
|
|
25
|
+
readiness:
|
|
26
|
+
path: /
|