@sap/cds-dk 8.5.0 → 8.6.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 +36 -4
- package/bin/cds.js +48 -28
- package/bin/deploy/index.js +9 -11
- package/bin/import.js +6 -2
- package/bin/repl.js +86 -14
- package/bin/watch.js +1 -1
- package/lib/bind/cfKeyProvider.js +4 -3
- package/lib/bind/index.js +1 -1
- package/lib/build/buildTaskEngine.js +4 -4
- package/lib/build/plugins/helm/files/subcharts/content-deployment/Chart.yaml +3 -1
- package/lib/build/plugins/helm/files/subcharts/content-deployment/templates/_helpers.tpl +3 -5
- package/lib/build/plugins/helm/files/subcharts/content-deployment/values.schema.json +1 -16
- package/lib/build/plugins/helm/files/subcharts/content-deployment/values.yaml +6 -7
- package/lib/build/plugins/helm/files/subcharts/web-application/Chart.yaml +3 -1
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/_helpers.tpl +25 -5
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/api-rule.yaml +13 -4
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/service-binding.yaml +6 -1
- package/lib/build/plugins/helm/files/subcharts/web-application/values.schema.json +55 -48
- package/lib/build/plugins/helm/files/subcharts/web-application/values.yaml +19 -7
- package/lib/cds.js +10 -2
- package/lib/import/common.js +2 -2
- package/lib/init/constants.js +3 -1
- package/lib/init/index.js +10 -0
- package/lib/init/merge.js +1 -1
- package/lib/init/projectReader.js +1 -0
- package/lib/init/registries/mta.js +7 -1
- package/lib/init/template/ams/files/Chart.yaml.hbs +4 -0
- package/lib/init/template/ams/files/containerize.yaml.hbs +20 -0
- package/lib/init/template/ams/files/manifest.yml.hbs +24 -0
- package/lib/init/template/ams/files/mta.yaml.hbs +31 -0
- package/lib/init/template/ams/files/package.json.hbs +10 -0
- package/lib/init/template/ams/files/values.yaml.hbs +13 -0
- package/lib/init/template/ams/index.js +80 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +6 -4
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/helm/files/values.schema.json +0 -2079
- package/lib/init/template/html5-repo/files/xs-app.json.hbs +1 -0
- package/lib/init/template/html5-repo/index.js +2 -0
- package/lib/init/template/http/index.js +10 -8
- package/lib/init/template/ias/files/Chart.yaml.hbs +4 -0
- package/lib/init/template/ias/files/manifest.yml.hbs +8 -0
- package/lib/init/template/ias/files/mta.yaml.hbs +61 -0
- package/lib/init/template/ias/files/package.json.hbs +22 -0
- package/lib/init/template/ias/files/services-manifest.yml.hbs +6 -0
- package/lib/init/template/ias/files/values.yaml.hbs +52 -0
- package/lib/init/template/ias/index.js +71 -0
- package/lib/init/template/mta/files/mta.yaml.hbs +15 -1
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +38 -5
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +5 -2
- package/lib/init/template/multitenancy/index.js +40 -31
- package/lib/init/template/nodejs/files/package.json.hbs +1 -1
- package/lib/init/template/typescript/files/package.json +1 -1
- package/lib/init/template/xsuaa/index.js +1 -1
- package/lib/util/cf.js +4 -4
- package/lib/util/command.js +1 -9
- package/npm-shrinkwrap.json +140 -96
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://github.tools.sap/unified-runtime/web-application/blob/main/values.schema.json",
|
|
3
4
|
"type": "object",
|
|
4
5
|
"required": [
|
|
5
6
|
"image",
|
|
@@ -19,27 +20,12 @@
|
|
|
19
20
|
"type": "object",
|
|
20
21
|
"properties": {
|
|
21
22
|
"name": {
|
|
23
|
+
"default": "image-pull-secret",
|
|
22
24
|
"$ref": "#/definitions/KubernetesName"
|
|
23
25
|
},
|
|
24
26
|
"dockerconfigjson": {
|
|
25
27
|
"type": "string"
|
|
26
28
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"name": {
|
|
30
|
-
"not": {
|
|
31
|
-
"required": [
|
|
32
|
-
"dockerconfigjson"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"dockerconfigjson": {
|
|
37
|
-
"not": {
|
|
38
|
-
"required": [
|
|
39
|
-
"name"
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
29
|
}
|
|
44
30
|
},
|
|
45
31
|
"image": {
|
|
@@ -352,41 +338,11 @@
|
|
|
352
338
|
"properties": {
|
|
353
339
|
"liveness": {
|
|
354
340
|
"$id": "#/properties/health/properties/liveness",
|
|
355
|
-
"
|
|
356
|
-
"additionalProperties": false,
|
|
357
|
-
"properties": {
|
|
358
|
-
"path": {
|
|
359
|
-
"type": "string",
|
|
360
|
-
"default": "/healthz"
|
|
361
|
-
},
|
|
362
|
-
"periodSeconds": {
|
|
363
|
-
"type": "integer",
|
|
364
|
-
"minimum": 1
|
|
365
|
-
},
|
|
366
|
-
"failureThreshold": {
|
|
367
|
-
"type": "integer",
|
|
368
|
-
"minimum": 1
|
|
369
|
-
}
|
|
370
|
-
}
|
|
341
|
+
"$ref": "#/definitions/Probe"
|
|
371
342
|
},
|
|
372
343
|
"readiness": {
|
|
373
344
|
"$id": "#/properties/health/properties/readiness",
|
|
374
|
-
"
|
|
375
|
-
"additionalProperties": false,
|
|
376
|
-
"properties": {
|
|
377
|
-
"path": {
|
|
378
|
-
"type": "string",
|
|
379
|
-
"default": "/healthz"
|
|
380
|
-
},
|
|
381
|
-
"periodSeconds": {
|
|
382
|
-
"type": "integer",
|
|
383
|
-
"minimum": 1
|
|
384
|
-
},
|
|
385
|
-
"failureThreshold": {
|
|
386
|
-
"type": "integer",
|
|
387
|
-
"minimum": 1
|
|
388
|
-
}
|
|
389
|
-
}
|
|
345
|
+
"$ref": "#/definitions/Probe"
|
|
390
346
|
}
|
|
391
347
|
}
|
|
392
348
|
},
|
|
@@ -617,6 +573,13 @@
|
|
|
617
573
|
"$id": "#/properties/expose/properties/host",
|
|
618
574
|
"type": "string"
|
|
619
575
|
},
|
|
576
|
+
"hosts": {
|
|
577
|
+
"$id": "#/properties/expose/properties/hosts",
|
|
578
|
+
"type": "array",
|
|
579
|
+
"items": {
|
|
580
|
+
"type": "string"
|
|
581
|
+
}
|
|
582
|
+
},
|
|
620
583
|
"enabled": {
|
|
621
584
|
"$id": "#/properties/expose/properties/enabled",
|
|
622
585
|
"type": "boolean",
|
|
@@ -631,6 +594,16 @@
|
|
|
631
594
|
"$id": "#/properties/expose/properties/gateway",
|
|
632
595
|
"type": "string"
|
|
633
596
|
},
|
|
597
|
+
"APIRule": {
|
|
598
|
+
"$id": "#/properties/expose/properties/APIRule",
|
|
599
|
+
"type": "object",
|
|
600
|
+
"additionalProperties": false,
|
|
601
|
+
"properties": {
|
|
602
|
+
"experimental": {
|
|
603
|
+
"type": "boolean"
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
},
|
|
634
607
|
"corsPolicy": {
|
|
635
608
|
"$id": "#/properties/expose/properties/corsPolicy",
|
|
636
609
|
"type": "object",
|
|
@@ -824,12 +797,19 @@
|
|
|
824
797
|
"serviceInstanceFullname": {
|
|
825
798
|
"type": "string"
|
|
826
799
|
},
|
|
800
|
+
"serviceInstanceNamespace": {
|
|
801
|
+
"type": "string"
|
|
802
|
+
},
|
|
827
803
|
"externalName": {
|
|
828
804
|
"type": "string"
|
|
829
805
|
},
|
|
830
806
|
"secretName": {
|
|
831
807
|
"type": "string"
|
|
832
808
|
},
|
|
809
|
+
"secretKey": {
|
|
810
|
+
"type": "string",
|
|
811
|
+
"default": "credentials"
|
|
812
|
+
},
|
|
833
813
|
"parameters": {
|
|
834
814
|
"type": "object"
|
|
835
815
|
},
|
|
@@ -1332,6 +1312,33 @@
|
|
|
1332
1312
|
"title": "ImagePullPolicy",
|
|
1333
1313
|
"type": "string",
|
|
1334
1314
|
"enum": ["Always", "IfNotPresent", "Never"]
|
|
1315
|
+
},
|
|
1316
|
+
"Probe": {
|
|
1317
|
+
"title": "Probe configuration",
|
|
1318
|
+
"type": "object",
|
|
1319
|
+
"additionalProperties": false,
|
|
1320
|
+
"properties": {
|
|
1321
|
+
"path": {
|
|
1322
|
+
"type": "string",
|
|
1323
|
+
"default": "/healthz"
|
|
1324
|
+
},
|
|
1325
|
+
"periodSeconds": {
|
|
1326
|
+
"type": "integer",
|
|
1327
|
+
"minimum": 1
|
|
1328
|
+
},
|
|
1329
|
+
"failureThreshold": {
|
|
1330
|
+
"type": "integer",
|
|
1331
|
+
"minimum": 1
|
|
1332
|
+
},
|
|
1333
|
+
"successThreshold": {
|
|
1334
|
+
"type": "integer",
|
|
1335
|
+
"minimum": 1
|
|
1336
|
+
},
|
|
1337
|
+
"timeoutSeconds": {
|
|
1338
|
+
"type": "integer",
|
|
1339
|
+
"minimum": 1
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1335
1342
|
}
|
|
1336
1343
|
}
|
|
1337
1344
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# Helm global values, for more information, see https://helm.sh/docs/chart_template_guide/subcharts_and_globals/#global-chart-values
|
|
2
2
|
global:
|
|
3
3
|
# Image Pull Secret configuration, for more information, see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
|
4
|
-
imagePullSecret:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# Either name or repository is required.
|
|
4
|
+
imagePullSecret:
|
|
5
|
+
## Name of the Kubernetes Secret, used as an image pull secret (must be of type kubernetes.io/dockerconfigjson).
|
|
6
|
+
name: image-pull-secret
|
|
7
|
+
## The content for the dynamically generated Kubernetes Secret, which will be used as an image pull secret.
|
|
8
|
+
# dockerconfigjson: ""
|
|
10
9
|
image: {}
|
|
11
10
|
## Setting the imagePullPolicy, see https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy
|
|
12
11
|
# imagePullPolicy: Always
|
|
@@ -15,7 +14,7 @@ global:
|
|
|
15
14
|
_internal:
|
|
16
15
|
web-application:
|
|
17
16
|
versions:
|
|
18
|
-
1.
|
|
17
|
+
1.20.0: true
|
|
19
18
|
## Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.
|
|
20
19
|
# nameOverride: name
|
|
21
20
|
|
|
@@ -103,6 +102,10 @@ health:
|
|
|
103
102
|
# periodSeconds: 3
|
|
104
103
|
## Number of probes to fail in a row, in order to consider the check failed.
|
|
105
104
|
# failureThreshold: 5
|
|
105
|
+
## Number of probes to succeed in a row, in order to consider the check successful.
|
|
106
|
+
# successThreshold: 1
|
|
107
|
+
## Connection timeout
|
|
108
|
+
# timeoutSeconds: 1
|
|
106
109
|
# Readiness-probe configuration.
|
|
107
110
|
readiness:
|
|
108
111
|
# HTTP path used by Kubernetes, to perform readiness-probe calls.
|
|
@@ -111,6 +114,10 @@ health:
|
|
|
111
114
|
# periodSeconds: 3
|
|
112
115
|
## Number of probes to fail in a row, in order to consider the check failed.
|
|
113
116
|
# failureThreshold: 5
|
|
117
|
+
## Number of probes to succeed in a row, in order to consider the check successful.
|
|
118
|
+
# successThreshold: 1
|
|
119
|
+
## Connection timeout
|
|
120
|
+
# timeoutSeconds: 1
|
|
114
121
|
# Initial timeout in seconds, during which the app must start giving the response to the liveness-probe.
|
|
115
122
|
startupTimeoutSeconds: 30
|
|
116
123
|
## Use read only filesystem for the Deployment.
|
|
@@ -145,8 +152,12 @@ envFrom: []
|
|
|
145
152
|
# name: my-secret-ref1
|
|
146
153
|
|
|
147
154
|
expose:
|
|
155
|
+
APIRule: {}
|
|
156
|
+
# experimental: true
|
|
148
157
|
## Specifies the service's dns name for inbound external traffic. If it doesn't contain a dot, the default cluster domain will be appended.
|
|
149
158
|
# host: ""
|
|
159
|
+
## Since v2alpha1, multiple hosts can be configured
|
|
160
|
+
# hosts: []
|
|
150
161
|
|
|
151
162
|
# Expose the application to the internet.
|
|
152
163
|
enabled: true
|
|
@@ -226,6 +237,7 @@ rbac: {}
|
|
|
226
237
|
# verbs: ["get", "watch", "list"]
|
|
227
238
|
bindings:
|
|
228
239
|
defaultProperties:
|
|
240
|
+
secretKey: credentials
|
|
229
241
|
credentialsRotationPolicy:
|
|
230
242
|
enabled: false
|
|
231
243
|
rotationFrequency: "720h"
|
package/lib/cds.js
CHANGED
|
@@ -6,11 +6,19 @@ module.exports = Object.defineProperties (cds, {
|
|
|
6
6
|
// for internal use in cds-dk only
|
|
7
7
|
_log: { value: _local ('../bin/util/log'), configurable: true },
|
|
8
8
|
_local: { value: _local, configurable: true },
|
|
9
|
+
_localOrGlobal: { value: id => _local(id, _npmRoot()), configurable: true },
|
|
9
10
|
})
|
|
10
11
|
|
|
11
|
-
function _local (id) {
|
|
12
|
+
function _local (id, ...morePaths) {
|
|
12
13
|
return require(require.resolve (id, {paths:[
|
|
13
14
|
process.cwd(), // project-local module is preferred
|
|
14
|
-
__dirname // otherwise from our own dependencies
|
|
15
|
+
__dirname, // otherwise from our own dependencies
|
|
16
|
+
...morePaths
|
|
15
17
|
]}))
|
|
16
18
|
}
|
|
19
|
+
|
|
20
|
+
function _npmRoot() {
|
|
21
|
+
try {
|
|
22
|
+
return require ('child_process').execSync('npm root -g').toString().trim()
|
|
23
|
+
} catch { return '' }
|
|
24
|
+
}
|
package/lib/import/common.js
CHANGED
|
@@ -17,7 +17,7 @@ let optionsMapping = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
let apiOptions = ['includeNamespaces', 'keepNamespace', 'beta'];
|
|
20
|
-
let commonOptions = ['no_copy', 'no_save', 'out', 'dry', 'as', 'from', 'force', 'config', 'destination', 'name'];
|
|
20
|
+
let commonOptions = ['no_copy', 'no_save', 'out', 'dry', 'as', 'from', 'force', 'config', 'destination', 'group', 'name'];
|
|
21
21
|
|
|
22
22
|
async function generateEDMX2JSON(edmx) {
|
|
23
23
|
let cjson = convert.xml2json(edmx, {
|
|
@@ -344,7 +344,7 @@ async function _updatePackageJson(dest, services, kind, cwd, config, destination
|
|
|
344
344
|
if (!config && destination) {
|
|
345
345
|
config = { "[production]": { credentials: { destination } } };
|
|
346
346
|
}
|
|
347
|
-
|
|
347
|
+
|
|
348
348
|
let package_json_updated = false;
|
|
349
349
|
for (let service of services) {
|
|
350
350
|
// existing service configuration data can be updated, e.g. in case of delta imports
|
package/lib/init/constants.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports = {
|
|
|
5
5
|
COMMAND_ADD: 'add',
|
|
6
6
|
|
|
7
7
|
JAVA_LTS_VERSIONS: [17, 21],
|
|
8
|
-
MAVEN_ARCHETYPE_VERSION: '3.
|
|
8
|
+
MAVEN_ARCHETYPE_VERSION: '3.5.0',
|
|
9
9
|
|
|
10
10
|
OPTIONS: Object.freeze({
|
|
11
11
|
COMPLETION: 'completion',
|
|
@@ -31,6 +31,8 @@ module.exports = {
|
|
|
31
31
|
SIDE_BY_SIDE_EXTENSIBILITY: 'side-by-side-extensibility',
|
|
32
32
|
MTX: 'mtx',
|
|
33
33
|
XSUAA: 'xsuaa',
|
|
34
|
+
IAS: 'ias',
|
|
35
|
+
AMS: 'ams',
|
|
34
36
|
HANA: 'hana',
|
|
35
37
|
POSTGRES: 'postgres',
|
|
36
38
|
SQLITE: 'sqlite',
|
package/lib/init/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const validate = require('./validate')
|
|
|
5
5
|
const { OPTIONS, COMMAND_INIT, PROJECT_FILES } = require('./constants')
|
|
6
6
|
const { readdirSync } = require('fs')
|
|
7
7
|
const { join } = require('path')
|
|
8
|
+
const cmd = require('../util/command')
|
|
8
9
|
const { NODEJS, JAVA } = OPTIONS
|
|
9
10
|
|
|
10
11
|
const cds = require('..'), { exists } = cds.utils
|
|
@@ -107,6 +108,10 @@ module.exports = class CDSGenerator {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
_initialize(projectName) {
|
|
111
|
+
// avoid config files to be created in the home dir
|
|
112
|
+
if (cds.cli.command === COMMAND_INIT && !projectName && process.cwd() === require('os').homedir()) {
|
|
113
|
+
throw `In your home directory, use 'cds init <project>'`
|
|
114
|
+
}
|
|
110
115
|
const { options } = cds.cli
|
|
111
116
|
this.cwd = options.cwd || process.cwd();
|
|
112
117
|
cds.root = path.resolve(this.cwd, projectName || '.');
|
|
@@ -151,6 +156,11 @@ module.exports = class CDSGenerator {
|
|
|
151
156
|
await template.combineSupported();
|
|
152
157
|
}
|
|
153
158
|
|
|
159
|
+
if (cds.env['project-nature'] === 'java') {
|
|
160
|
+
console.log('Updating frozen dependencies in package-lock.json...')
|
|
161
|
+
await cmd.spawnCommand('npm' , ['i', '--package-lock-only'], { cwd:cds.root })
|
|
162
|
+
}
|
|
163
|
+
|
|
154
164
|
if (cds.cli.command === COMMAND_INIT) {
|
|
155
165
|
const relativeProjectPath = path.relative(this.cwd, cds.root)
|
|
156
166
|
let message = 'Successfully created project.'
|
package/lib/init/merge.js
CHANGED
|
@@ -153,7 +153,7 @@ async function _mergeYAML(into, from, project, semantics = {}) {
|
|
|
153
153
|
relationships?.forEach(relationship => {
|
|
154
154
|
const [entry] = relationship.into
|
|
155
155
|
const [insertEntry] = relationship.insert
|
|
156
|
-
const hash = insertEntry + ' -> ' + entry
|
|
156
|
+
const hash = JSON.stringify(insertEntry) + ' -> ' + JSON.stringify(entry)
|
|
157
157
|
entryMap.set(hash, undefined)
|
|
158
158
|
})
|
|
159
159
|
|
|
@@ -167,6 +167,7 @@ module.exports = new class ProjectReader {
|
|
|
167
167
|
appUIPaths: () => (fs.readdirSync(path.resolve(cds.root, cds.env.folders.app))).filter(e =>
|
|
168
168
|
isdir(join(cds.root, cds.env.folders.app, e)) && isApp(e)
|
|
169
169
|
),
|
|
170
|
+
hasIndexHtml: () => {},
|
|
170
171
|
appPath: () => env.folders.app,
|
|
171
172
|
appVersion: () => appVersion,
|
|
172
173
|
jdkVersion: () => jdkVersion,
|
|
@@ -100,6 +100,11 @@ const saasRegistry = {
|
|
|
100
100
|
where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'saas-registry' }
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
const subscriptionManager = {
|
|
104
|
+
in: 'resources',
|
|
105
|
+
where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'subscription-manager' }
|
|
106
|
+
}
|
|
107
|
+
|
|
103
108
|
const srvApi4 = srv => ({
|
|
104
109
|
in: [srv, 'provides'],
|
|
105
110
|
where: { name: 'srv-api', 'properties.srv-url': '${default-url}' }
|
|
@@ -127,7 +132,7 @@ const providedAppApi = {
|
|
|
127
132
|
|
|
128
133
|
const requiredAppApi4 = module => ({
|
|
129
134
|
in: [module, 'requires'],
|
|
130
|
-
where: { name: 'app-api'
|
|
135
|
+
where: { name: 'app-api' }
|
|
131
136
|
})
|
|
132
137
|
|
|
133
138
|
const requiredMtxSidecarApi4 = srv => ({
|
|
@@ -202,6 +207,7 @@ module.exports = {
|
|
|
202
207
|
postgres,
|
|
203
208
|
postgresDeployer,
|
|
204
209
|
saasRegistry,
|
|
210
|
+
subscriptionManager,
|
|
205
211
|
redis,
|
|
206
212
|
srvApi4,
|
|
207
213
|
mtxSidecar4,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
modules:
|
|
2
|
+
- name: {{appName}}-ams-policies-deployer
|
|
3
|
+
build-parameters:
|
|
4
|
+
buildpack:
|
|
5
|
+
{{#hasHelmUnifiedRuntime}}
|
|
6
|
+
builder: proxy-unified-runtime-dmz.int.repositories.cloud.sap/builder/noble
|
|
7
|
+
{{/hasHelmUnifiedRuntime}}
|
|
8
|
+
{{^hasHelmUnifiedRuntime}}
|
|
9
|
+
type: nodejs
|
|
10
|
+
builder: builder-jammy-base
|
|
11
|
+
{{/hasHelmUnifiedRuntime}}
|
|
12
|
+
{{#isJava}}
|
|
13
|
+
path: srv/src/gen/policies
|
|
14
|
+
{{/isJava}}
|
|
15
|
+
{{^isJava}}
|
|
16
|
+
path: gen/policies
|
|
17
|
+
{{/isJava}}
|
|
18
|
+
env:
|
|
19
|
+
BP_NODE_RUN_SCRIPTS: ""
|
|
20
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
applications:
|
|
3
|
+
- name: {{appName}}-srv
|
|
4
|
+
env:
|
|
5
|
+
AMS_DCL_ROOT: ams/dcl
|
|
6
|
+
|
|
7
|
+
- name: {{appName}}-ams-policies-deployer
|
|
8
|
+
{{#isJava}}
|
|
9
|
+
path: srv/src/gen/policies
|
|
10
|
+
{{/isJava}}
|
|
11
|
+
{{^isJava}}
|
|
12
|
+
path: gen/policies
|
|
13
|
+
{{/isJava}}
|
|
14
|
+
no-route: true
|
|
15
|
+
health-check-type: none
|
|
16
|
+
memory: 256M
|
|
17
|
+
instances: 1
|
|
18
|
+
buildpack: nodejs_buildpack
|
|
19
|
+
command: (npm start && echo "This application may now be stopped to free resources." || echo "AMS Policy Deployment unsuccessful.") && sleep infinity
|
|
20
|
+
services:
|
|
21
|
+
- name: {{appName}}-auth
|
|
22
|
+
parameters:
|
|
23
|
+
credential-type: X509_GENERATED
|
|
24
|
+
app-identifier: ams-policy-deployer
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
modules:
|
|
2
|
+
- name: {{appName}}-srv
|
|
3
|
+
type: {{language}}
|
|
4
|
+
path: {{& srvPath}}
|
|
5
|
+
deployed-after:
|
|
6
|
+
- {{appName}}-ams-policies-deployer
|
|
7
|
+
properties:
|
|
8
|
+
AMS_DCL_ROOT: ams/dcl
|
|
9
|
+
|
|
10
|
+
- name: {{appName}}-ams-policies-deployer
|
|
11
|
+
type: javascript.nodejs
|
|
12
|
+
{{#isJava}}
|
|
13
|
+
path: srv/src/gen/policies
|
|
14
|
+
{{/isJava}}
|
|
15
|
+
{{^isJava}}
|
|
16
|
+
path: gen/policies
|
|
17
|
+
{{/isJava}}
|
|
18
|
+
parameters:
|
|
19
|
+
buildpack: nodejs_buildpack
|
|
20
|
+
no-route: true
|
|
21
|
+
no-start: true
|
|
22
|
+
tasks:
|
|
23
|
+
- name: deploy-dcl
|
|
24
|
+
command: npm start
|
|
25
|
+
memory: 512M
|
|
26
|
+
requires:
|
|
27
|
+
- name: {{appName}}-auth
|
|
28
|
+
parameters:
|
|
29
|
+
config:
|
|
30
|
+
credential-type: X509_GENERATED
|
|
31
|
+
app-identifier: ams-policy-deployer
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
srv:
|
|
2
|
+
env:
|
|
3
|
+
AMS_DCL_ROOT: ams/dcl
|
|
4
|
+
|
|
5
|
+
ams-policies-deployer:
|
|
6
|
+
image:
|
|
7
|
+
repository: {{appName}}-ams-policies-deployer
|
|
8
|
+
bindings:
|
|
9
|
+
identity:
|
|
10
|
+
serviceInstanceName: identity
|
|
11
|
+
parameters:
|
|
12
|
+
credential-type: X509_GENERATED
|
|
13
|
+
app-identifier: ams-policy-deployer
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const cds = require('../../../cds')
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge, sort } = require('../../merge')
|
|
4
|
+
const { srv4 } = require('../../registries/mta')
|
|
5
|
+
const mvn = require('../../mvn')
|
|
6
|
+
|
|
7
|
+
module.exports = class AmsTemplate extends require('../../plugin') {
|
|
8
|
+
|
|
9
|
+
static help() {
|
|
10
|
+
return 'authorization via AMS'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
requires() {
|
|
14
|
+
return ['ias']
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static hasInProduction(env) {
|
|
18
|
+
return env.requires?.auth?.ams || cds.cli.options?.add?.has('ams') || cds.cli.argv?.some(arg => arg?.match?.(/(^|,)ams(,|$)/))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async run() {
|
|
22
|
+
const project = readProject()
|
|
23
|
+
await merge(__dirname, 'files/package.json.hbs').into('package.json', { project, forceOverwrite: true })
|
|
24
|
+
project.isNodejs && await sort('package.json', 'dependencies')
|
|
25
|
+
await sort('package.json', 'devDependencies')
|
|
26
|
+
if (project.isJava) await mvn.add('ams')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async combine() {
|
|
30
|
+
const project = readProject()
|
|
31
|
+
const { hasMta, hasCfManifest, hasHelm, hasHelmUnifiedRuntime, hasContainerize } = project
|
|
32
|
+
|
|
33
|
+
if (hasMta) {
|
|
34
|
+
await this.#combineWithMta(project)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (hasCfManifest) {
|
|
38
|
+
await this.#combineWithCfManifest(project)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
42
|
+
await this.#combineWithHelm(project)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (hasContainerize) {
|
|
46
|
+
await this.#combineWithContainerize(project)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async #combineWithMta(project) {
|
|
51
|
+
const srv = srv4(project.srvPath)
|
|
52
|
+
const amsPoliciesDeployer = {
|
|
53
|
+
in: 'modules',
|
|
54
|
+
where: { 'name': `${project.appName}-ams-policies-deployer` }
|
|
55
|
+
}
|
|
56
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions: [srv, amsPoliciesDeployer] })
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async #combineWithCfManifest(project) {
|
|
60
|
+
const amsPoliciesDeployer = {
|
|
61
|
+
in: 'applications',
|
|
62
|
+
where: { 'name': `${project.appName}-ams-policies-deployer` }
|
|
63
|
+
}
|
|
64
|
+
await merge(__dirname, 'files/manifest.yml.hbs').into('manifest.yml', { project, additions: [amsPoliciesDeployer] })
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async #combineWithHelm(project) {
|
|
68
|
+
const amsPoliciesDeployer = {
|
|
69
|
+
in: 'dependencies',
|
|
70
|
+
where: { 'alias': 'ams-policies-deployer' }
|
|
71
|
+
}
|
|
72
|
+
await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { project, additions: [amsPoliciesDeployer] })
|
|
73
|
+
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { project })
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async #combineWithContainerize(project) {
|
|
77
|
+
const amsDeployer = { in: 'modules', where: { 'name': `${project.appName}-ams-policies-deployer` } }
|
|
78
|
+
await merge(__dirname, 'files/containerize.yaml.hbs').into('containerize.yaml', { project, additions: [amsDeployer] })
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -33,8 +33,10 @@ modules:
|
|
|
33
33
|
group: destinations
|
|
34
34
|
properties:
|
|
35
35
|
name: srv-api # must be used in xs-app.json as well
|
|
36
|
-
url: ~{srv-url}
|
|
37
|
-
forwardAuthToken: true
|
|
36
|
+
url: {{#hasIas}}~{srv-cert-url}{{/hasIas}}{{^hasIas}}~{srv-url}{{/hasIas}}
|
|
37
|
+
forwardAuthToken: true{{#hasIas}}
|
|
38
|
+
forwardAuthCertificates: true
|
|
39
|
+
strictSSL: true{{/hasIas}}
|
|
38
40
|
{{#hasMultitenancy}}
|
|
39
41
|
- name: mtx-api
|
|
40
42
|
group: destinations
|
|
@@ -42,7 +44,6 @@ modules:
|
|
|
42
44
|
name: mtx-api # must be used in xs-app.json as well
|
|
43
45
|
url: ~{mtx-url}
|
|
44
46
|
{{/hasMultitenancy}}
|
|
45
|
-
{{#hasMultitenancy}}
|
|
46
47
|
{{#isNodejs}}
|
|
47
48
|
provides:
|
|
48
49
|
- name: app-api
|
|
@@ -50,11 +51,12 @@ modules:
|
|
|
50
51
|
app-protocol: ${protocol}
|
|
51
52
|
app-uri: ${default-uri}
|
|
52
53
|
{{/isNodejs}}
|
|
53
|
-
{{/hasMultitenancy}}
|
|
54
54
|
{{#isJava}}
|
|
55
55
|
provides:
|
|
56
56
|
- name: app-api
|
|
57
57
|
properties:
|
|
58
|
+
app-protocol: ${protocol}
|
|
59
|
+
app-uri: ${default-uri}
|
|
58
60
|
url: ${default-url}
|
|
59
61
|
{{/isJava}}
|
|
60
62
|
|