@sap/cds-dk 7.7.2 → 7.8.1

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.
Files changed (58) hide show
  1. package/bin/add.js +40 -17
  2. package/bin/bind.js +21 -12
  3. package/bin/build.js +14 -2
  4. package/bin/cds.js +8 -0
  5. package/bin/deploy/to-sqlite.js +1 -1
  6. package/bin/help.js +4 -1
  7. package/bin/version.js +54 -22
  8. package/lib/bind/userCdsrcJsonStorageProvider.js +1 -1
  9. package/lib/build/buildTaskFactory.js +2 -2
  10. package/lib/build/provider/hana/index.js +1 -1
  11. package/lib/build/provider/internalBuildTaskProvider.js +23 -11
  12. package/lib/build/provider/mtx/resourcesTarBuilder.js +16 -4
  13. package/lib/build/provider/mtx-extension/extensionCompilation.js +13 -2
  14. package/lib/build/provider/mtx-extension/index.js +6 -2
  15. package/lib/build/provider/nodejs/index.js +4 -4
  16. package/lib/build/util.js +7 -18
  17. package/lib/compile/openapi/index.js +2 -1
  18. package/lib/index.js +2 -2
  19. package/lib/init/constants.js +3 -2
  20. package/lib/init/index.js +9 -23
  21. package/lib/init/plugin.js +8 -0
  22. package/lib/init/registries/mta.js +6 -0
  23. package/lib/init/template/data/as-csv.js +60 -0
  24. package/lib/init/template/data/as-json.js +441 -0
  25. package/lib/init/template/data/index.js +116 -86
  26. package/lib/init/template/enterprise-messaging/files/package.json.hbs +2 -1
  27. package/lib/init/template/enterprise-messaging/index.js +16 -3
  28. package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +2 -1
  29. package/lib/init/template/enterprise-messaging-shared/index.js +16 -3
  30. package/lib/init/template/helm/files/content-deployment/Chart.yaml +1 -1
  31. package/lib/init/template/helm/files/content-deployment/templates/job.yaml +7 -0
  32. package/lib/init/template/helm/files/content-deployment/values.schema.json +17 -0
  33. package/lib/init/template/helm/files/content-deployment/values.yaml +6 -1
  34. package/lib/init/template/helm/files/service-instance/Chart.yaml +1 -1
  35. package/lib/init/template/helm/files/service-instance/templates/serviceinstance.yaml +4 -0
  36. package/lib/init/template/helm/files/service-instance/values.schema.json +17 -1
  37. package/lib/init/template/helm/files/service-instance/values.yaml +4 -1
  38. package/lib/init/template/helm/files/values.yaml.hbs +2 -2
  39. package/lib/init/template/helm/files/web-application/Chart.yaml +1 -1
  40. package/lib/init/template/helm/files/web-application/templates/api-rule.yaml +4 -0
  41. package/lib/init/template/helm/files/web-application/templates/network-policy.yaml +15 -0
  42. package/lib/init/template/helm/files/web-application/values.schema.json +41 -0
  43. package/lib/init/template/helm/files/web-application/values.yaml +19 -1
  44. package/lib/init/template/helm/index.js +5 -2
  45. package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +2 -2
  46. package/lib/init/template/helm-unified-runtime/index.js +13 -7
  47. package/lib/init/template/html5-repo/index.js +0 -1
  48. package/lib/init/template/http/index.js +182 -0
  49. package/lib/init/template/kafka/files/mta.yaml.hbs +14 -0
  50. package/lib/init/template/kafka/files/package.json.hbs +22 -0
  51. package/lib/init/template/kafka/files/values.yaml +10 -0
  52. package/lib/init/template/kafka/index.js +39 -0
  53. package/lib/init/template/lint/index.js +4 -4
  54. package/lib/init/template/mta/files/mta.yaml.hbs +4 -0
  55. package/lib/init/template/multitenancy/files/values.yaml.hbs +2 -2
  56. package/lib/util/cf.js +6 -2
  57. package/npm-shrinkwrap.json +269 -293
  58. package/package.json +1 -1
@@ -1,57 +1,91 @@
1
-
2
1
  const cds = require('../../../cds')
3
2
  const { exists, fs } = cds.utils
4
- const { resolve, join, relative } = require('path');
5
- const DEBUG = cds.debug('cli')
3
+ const { resolve, join, relative } = require('path')
4
+ const { URLSearchParams } = require('url')
6
5
  const { env4 } = require('../../projectReader')
6
+ const asJson = require('./as-json')
7
+ const asCsv = require('./as-csv')
7
8
 
8
9
  module.exports = class DataTemplate extends require('../../plugin') {
9
10
 
11
+ options() {
12
+ return {
13
+ 'filter': {
14
+ type: 'string',
15
+ short: 'f',
16
+ help: `Filter for entities matching the given pattern. If it contains meta
17
+ characters like '^' or '*', it is treated like a regular expression,
18
+ otherwise as a prefix.`
19
+ },
20
+ 'data:for': {
21
+ type: 'string',
22
+ help: `Deprecated. Use '--filter' instead.`
23
+ },
24
+ 'records': {
25
+ type: 'number',
26
+ short: 'n',
27
+ help: 'The number of records to be created for each entity.'
28
+ },
29
+ 'content-type': {
30
+ type: 'string',
31
+ short: 'c',
32
+ help: 'The content type of the data. One of "json" or "csv".'
33
+ },
34
+ 'out': {
35
+ type: 'string',
36
+ short: 'o',
37
+ help: 'The output target folder.'
38
+ }
39
+ }
40
+ }
41
+
10
42
  async run() {
11
43
  if (cds.cli.options.for) {
12
44
  throw `\nError: Did you mean \`... --data:for\` ?`
13
45
  }
14
46
 
15
- const env = env4('production')
16
-
17
- let dest = (typeof cds.cli.options.out === 'string') // target folder
18
- ? cds.cli.options.out
19
- : getDefaultTargetFolder(env);
20
- dest = resolve(cds.root, dest);
47
+ let { force, out,
48
+ 'content-type' : contentType='csv',
49
+ records=1
50
+ } = cds.cli.options
51
+ if (typeof records === 'string') records = parseInt(records)
52
+ if (Number.isNaN(records) || records < 1) records = 1
21
53
 
22
- const nameFilter = asRegex(cds.cli.options['data:for'])
23
- const { force } = cds.cli.options
54
+ const [filterName, filterQueryStr] = (cds.cli.options['filter'] ?? cds.cli.options['data:for'] ?? '').split(':')
55
+ const nameFilter = asRegex(filterName)
56
+ const dataForParams = parseQueryStr(filterQueryStr)
24
57
 
25
- let csn = await cds.compile.to.csn(cds.env.roots) // normal CSN
58
+ const env = env4('production')
59
+ let dest = (typeof out === 'string') // target folder
60
+ ? out
61
+ : getDefaultTargetFolder(env)
62
+ dest = resolve(cds.root, dest)
26
63
 
64
+ let csn = await cds.load(cds.env.roots) // normal CSN
27
65
  // Skip of unused reuse entities like Language, Country, Currency
28
66
  csn = cds.minify(csn)
67
+ csn = cds.reflect(csn) // reflected model (adds additional helper functions)
29
68
 
30
- // Also include 'external' entities w/ cds.persistence.skip (similar to 'mocked' option of serve).
31
- // Could be too much sometimes, but don't want to bother users w/ a separate option for this.
32
- includeExternalEntities(csn)
69
+ const data = csn.all('entity')
70
+ .filter (e => e.name.match(nameFilter)) // --for prefix|regex
71
+ .reduce((all, e) => { all[e.name] = []; return all }, {})
33
72
 
34
- csn = cds.compile.for.sql(csn, { names:env.sql.names, messages:[] }) // CSN w/ persistence information
35
- csn = cds.reflect(csn); // reflected model (adds additional helper functions)
73
+ await asJson(data, csn, records)
36
74
 
37
- csn.all('entity')
38
- .filter (e => e.name.match(nameFilter)) // --for prefix|regex
39
- .filter (e => !e.query) // exclude entities with queries (projection on, select from ...)
40
- .filter (e => e.name !== 'DRAFT.DraftAdministrativeData' && !e.name.endsWith('.drafts')) // exclude draft stuff
41
- .forEach(e => processEntity(e, dest, csn, force));
42
- }
43
- }
75
+ if (contentType === 'csv') {
76
+ const headerOnly = !cds.cli.options['records'] // compat to old behavior which only creates headers
77
+ const queries = false // old behavior excluded queries
78
+ await asCsv(data, csn, Object.assign({ headerOnly, queries }, dataForParams))
79
+ }
44
80
 
45
- function includeExternalEntities(model) {
46
- for (let each in model.definitions) {
47
- const def = model.definitions[each]
48
- if (def['@cds.persistence.skip'] === true) {
49
- DEBUG?.('Including skipped entity '+each)
50
- delete def['@cds.persistence.skip']
81
+ // write files
82
+ for (const name of Object.keys(data)) {
83
+ writeFileFor(csn.definitions[name], data[name], csn, dest, force)
51
84
  }
52
85
  }
53
- return model
54
86
  }
87
+ module.exports.asJson = asJson
88
+ module.exports.asCsv = asCsv
55
89
 
56
90
  function asRegex(spec) {
57
91
  if (typeof spec === 'string') {
@@ -69,96 +103,92 @@ function asRegex(spec) {
69
103
  return /.*/
70
104
  }
71
105
 
72
- function processEntity (entity, dest, csn, force) {
73
- let dataFileName;
74
- const namespace = getNamespace(csn, entity.name);
106
+ function parseQueryStr(queryStr) {
107
+ const params = new URLSearchParams(queryStr) // e.g. key1&key2=false
108
+ const res = Object.fromEntries(params)
109
+ for (let [k, v] of Object.entries(res)) {
110
+ if (v.length === 0 || v === 'true') res[k] = true
111
+ else if (v === 'false') res[k] = false
112
+ }
113
+ return res
114
+ }
115
+
116
+ function writeFileFor (entity, data, csn, dest, force) {
117
+ let dataFileName
118
+ const namespace = getNamespace(csn, entity.name)
75
119
  if (!namespace || namespace == entity.name) {
76
- dataFileName = `${entity.name}.csv`;
120
+ dataFileName = `${entity.name}`
77
121
  }
78
122
  else {
79
- const entityName = entity.name.replace(namespace + '.', '');
80
- dataFileName = `${namespace}-${entityName}.csv`;
123
+ const entityName = entity.name.replace(namespace + '.', '')
124
+ dataFileName = `${namespace}-${entityName}`
81
125
  }
126
+ dataFileName += Array.isArray(data) ? '.json' : '.csv'
82
127
 
128
+ let dataFilePath = join(dest, dataFileName)
129
+ let fileExists = exists(join(dest, dataFileName))
83
130
  if (entity.name.endsWith('.texts')) {
84
131
  // handle '.texts' entities (for localized elements) differently:
85
132
  // if there is already file exist with '_texts' (old cds versions) - overwrite this one (when --force is used)
86
133
  // otherwise use the new '.texts' format
87
- const dataFileNameOldFormat = dataFileName.replace('.texts.csv','_texts.csv');
88
- const dataFilePathOldFormat = join(dest, dataFileNameOldFormat);
134
+ const dataFileNameOldFormat = dataFileName.replace('.texts.csv','_texts.csv')
135
+ const dataFilePathOldFormat = join(dest, dataFileNameOldFormat)
89
136
  if (exists(dataFilePathOldFormat)) {
90
- createDataFile(true, dataFilePathOldFormat, dest, force, entity);
91
- return;
137
+ dataFileName = dataFileNameOldFormat
138
+ dataFilePath = join(dest, dataFileName)
139
+ fileExists = true
92
140
  }
93
141
  }
94
142
 
95
- const dataFilePath = join(dest, dataFileName);
96
- createDataFile(exists(dataFilePath), dataFilePath, dest, force, entity);
97
- }
98
-
99
- function getDefaultTargetFolder (env) {
100
- const { db } = env.folders
101
- // csv files should be located in the 'db/data' folder unless a 'db/csv' folder already exists
102
- return join(db, exists(join(db, 'csv')) ? 'csv' : 'data')
103
- }
104
-
105
-
106
- function createDataFile (isFileExists, dataFilePath, dest, force, entity) {
107
- let relFilePath = dataFilePath;
143
+ let relFilePath = dataFilePath
108
144
  if (dataFilePath.indexOf(cds.root) === 0) {
109
145
  // use relative path in log (for readability), only when data files are added within the project
110
146
  // (potentially can be located anywhere using the --out parameter)
111
- relFilePath = relative(cds.root, dataFilePath);
147
+ relFilePath = relative(cds.root, dataFilePath)
112
148
  }
113
- if (isFileExists && !force) {
114
- console.log(`Skipping ${relFilePath}`);
149
+
150
+ // continue only if file not already exists, or '--force' option provided
151
+ if (fileExists && !force) {
152
+ console.log(`Skipping ${relFilePath}`)
153
+ return
115
154
  }
116
- else {
117
- // continue only if file not already exists, or '--force' option provided
118
- const dataFileContent = prepareDataFileContent(entity);
119
- if (dataFileContent && dataFileContent.length) {
120
- if (!exists(dest)) fs.mkdirSync(dest, {recursive: true})
121
- fs.writeFileSync(dataFilePath, dataFileContent);
122
- isFileExists ? console.log(`Overwriting `+relFilePath) : console.log(`Creating `+relFilePath)
123
- }
155
+
156
+ if (typeof data === 'object')
157
+ data = JSON.stringify(data, null, 2)
158
+ if (data.length) {
159
+ if (!exists(dest)) fs.mkdirSync(dest, {recursive: true})
160
+ fs.writeFileSync(dataFilePath, data)
161
+ fileExists ? console.log(`Overwriting `+relFilePath) : console.log(`Creating `+relFilePath)
124
162
  }
125
163
  }
126
164
 
127
- function prepareDataFileContent (entity) {
128
- const persistenceKeyNames = Object.keys(entity.keys||[])
129
- return Object.entries(entity.elements)
130
- .filter(([,element]) => !(element instanceof cds.Association)) // exclude associations+compositions
131
- .filter(([,element]) => !!element['@cds.persistence.name']) // exclude no-persistence elements, e.g. virtual ones
132
- .map (([key]) => key)
133
- .sort((k1, k2) => { // sort with keys first
134
- if (persistenceKeyNames.includes(k1) && !persistenceKeyNames.includes(k2)) return -1
135
- if (!persistenceKeyNames.includes(k1) && persistenceKeyNames.includes(k2)) return 1
136
- return 0 // preserve original order otherwise
137
- })
138
- .join(',') // using comma as csv separator by default
165
+ function getDefaultTargetFolder (env) {
166
+ const { db } = env.folders
167
+ // csv files should be located in the 'db/data' folder unless a 'db/csv' folder already exists
168
+ return join(db, exists(join(db, 'csv')) ? 'csv' : 'data')
139
169
  }
140
170
 
141
171
  // Logic is taken from cds-compile
142
172
  function getNamespace(csn, artifactName) {
143
- const parts = artifactName.split('.');
144
- let seen = parts[0];
145
- const art = csn.definitions[seen];
173
+ const parts = artifactName.split('.')
174
+ let seen = parts[0]
175
+ const art = csn.definitions[seen]
146
176
 
147
177
  // First step is not a namespace (we faked those in the CSN)
148
178
  // No subsequent step can be a namespace then
149
179
  if (art && art.kind !== 'namespace' && art.kind !== 'context')
150
- return null;
180
+ return null
151
181
 
152
182
 
153
183
  for (let i = 1; i < parts.length; i++) {
154
184
  // This was definitely a namespace so far
155
- const previousArtifactName = seen;
156
- seen = `${seen}.${parts[i]}`;
185
+ const previousArtifactName = seen
186
+ seen = `${seen}.${parts[i]}`
157
187
  // This might not be - if it isn't, return the result.
158
- const currentArtifact = csn.definitions[seen];
188
+ const currentArtifact = csn.definitions[seen]
159
189
  if (currentArtifact && currentArtifact.kind !== 'namespace' && currentArtifact.kind !== 'context')
160
- return previousArtifactName;
190
+ return previousArtifactName
161
191
  }
162
192
  // We came till here - so the full artifactName is a namespace
163
- return artifactName;
193
+ return artifactName
164
194
  }
@@ -7,7 +7,8 @@
7
7
  "[{{profile}}]": {
8
8
  {{/profile}}
9
9
  "messaging": {
10
- "kind": "enterprise-messaging"
10
+ "kind": "enterprise-messaging"{{#cloudevents}},
11
+ "format": "cloudevents"{{/cloudevents}}
11
12
  }
12
13
  {{#profile}}
13
14
  }
@@ -7,6 +7,16 @@ const { srv4, enterpriseMessaging } = require('../../registries/mta')
7
7
 
8
8
  module.exports = class EnterpriseMessagingTemplate extends require('../../plugin') {
9
9
 
10
+ options() {
11
+ return {
12
+ 'cloudevents': {
13
+ type: 'boolean',
14
+ short: 'c',
15
+ help: 'Use CloudEvents formatting',
16
+ }
17
+ }
18
+ }
19
+
10
20
  async canRun() {
11
21
  const { isJava } = readProject()
12
22
  if (isJava) throw `'cds add enterprise-messaging' is not available for Java yet`
@@ -19,9 +29,12 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
19
29
 
20
30
  async run() {
21
31
  const project = readProject()
22
- const { configFile } = project
23
- await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
24
- await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { with: project })
32
+ const { configFile, isNodejs } = project
33
+ if (isNodejs) {
34
+ project.cloudevents = cds.cli.options.cloudevents
35
+ await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
36
+ }
37
+ await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { project })
25
38
  }
26
39
 
27
40
  async combine() {
@@ -10,7 +10,8 @@
10
10
  "[{{profile}}]": {
11
11
  {{/profile}}
12
12
  "messaging": {
13
- "kind": "enterprise-messaging-shared"
13
+ "kind": "enterprise-messaging-shared"{{#cloudevents}},
14
+ "format": "cloudevents"{{/cloudevents}}
14
15
  }
15
16
  {{#profile}}
16
17
  }
@@ -6,6 +6,16 @@ const { srv4, enterpriseMessaging } = require('../../registries/mta')
6
6
 
7
7
  module.exports = class EnterpriseMessagingSharedTemplate extends require('../../plugin') {
8
8
 
9
+ options() {
10
+ return {
11
+ 'cloudevents': {
12
+ type: 'boolean',
13
+ short: 'c',
14
+ help: 'Use CloudEvents formatting',
15
+ }
16
+ }
17
+ }
18
+
9
19
  async canRun() {
10
20
  const { isJava } = readProject()
11
21
  if (isJava) throw `'cds add enterprise-messaging-shared' is not available for Java yet`
@@ -18,9 +28,12 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
18
28
 
19
29
  async run() {
20
30
  const project = readProject()
21
- const { configFile } = project
22
- project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
23
- await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
31
+ const { configFile, isNodejs } = project
32
+ if (isNodejs) {
33
+ project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
34
+ project.cloudevents = cds.cli.options.cloudevents
35
+ await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
36
+ }
24
37
  await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { project })
25
38
  }
26
39
 
@@ -4,4 +4,4 @@ name: content-deployment
4
4
  sources:
5
5
  - https://github.tools.sap/unified-runtime/content-deployment
6
6
  type: application
7
- version: 1.5.0
7
+ version: 1.6.0
@@ -3,6 +3,10 @@ apiVersion: batch/v1
3
3
  kind: Job
4
4
  metadata:
5
5
  labels: {{- include "content-deployment.internal.labels" . | nindent 4 }}
6
+ {{- if or .Values.annotations.job }}
7
+ annotations:
8
+ {{- tpl (toYaml .Values.annotations.job) $ | nindent 4 }}
9
+ {{- end }}
6
10
  name: {{ include "content-deployment.internal.jobName" . }}
7
11
  spec:
8
12
  completions: 1
@@ -14,6 +18,9 @@ spec:
14
18
  labels: {{- include "content-deployment.internal.labels" . | nindent 8 }}
15
19
  annotations:
16
20
  container.apparmor.security.beta.kubernetes.io/{{ include "content-deployment.internal.name" . }}: runtime/default
21
+ {{- if or .Values.annotations.job }}
22
+ {{- tpl (toYaml .Values.annotations.job) $ | nindent 8 }}
23
+ {{- end }}
17
24
  spec:
18
25
  {{- if (include "content-deployment.internal.imagePullSecretName" .) }}
19
26
  imagePullSecrets:
@@ -495,6 +495,23 @@
495
495
  ]
496
496
  }
497
497
  }
498
+ },
499
+ "annotations": {
500
+ "$id": "#/properties/annotations",
501
+ "title": "Additional annotations",
502
+ "type": "object",
503
+ "additionalProperties": false,
504
+ "properties": {
505
+ "job": {
506
+ "type": "object",
507
+ "title": "Annotations to add to the Job",
508
+ "patternProperties": {
509
+ ".*": {
510
+ "type": "string"
511
+ }
512
+ }
513
+ }
514
+ }
498
515
  }
499
516
  },
500
517
  "definitions": {
@@ -15,7 +15,7 @@ global:
15
15
  _internal:
16
16
  content-deployment:
17
17
  versions:
18
- 1.5.0: true
18
+ 1.6.0: true
19
19
  # Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.
20
20
  # nameOverride: name
21
21
 
@@ -93,3 +93,8 @@ ttlDaysAfterFinished: 14
93
93
  # serviceInstanceName: hana-manual
94
94
  # portal:
95
95
  # fromSecret: manual-secret # user-provided-service
96
+
97
+ ## Annotations to add to objects
98
+ annotations:
99
+ ## Annotations to add to the Job and underlying Pods
100
+ job: {}
@@ -4,4 +4,4 @@ name: service-instance
4
4
  sources:
5
5
  - https://github.tools.sap/unified-runtime/service-instance
6
6
  type: application
7
- version: 1.2.0
7
+ version: 1.3.0
@@ -3,6 +3,10 @@ apiVersion: services.cloud.sap.com/v1
3
3
  kind: ServiceInstance
4
4
  metadata:
5
5
  labels: {{- include "service-instance.internal.labels" . | nindent 4 }}
6
+ {{- if or .Values.annotations.serviceInstance }}
7
+ annotations:
8
+ {{- tpl (toYaml .Values.annotations.serviceInstance) $ | nindent 4 }}
9
+ {{- end }}
6
10
  name: {{ include "service-instance.internal.fullname" . }}
7
11
  spec:
8
12
  serviceOfferingName: {{ .Values.serviceOfferingName }}
@@ -80,6 +80,22 @@
80
80
  }
81
81
  }
82
82
  }
83
+ },
84
+ "annotations": {
85
+ "$id": "#/properties/annotations",
86
+ "title": "Additional annotations",
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "properties": {
90
+ "serviceInstance": {
91
+ "type": "object",
92
+ "patternProperties": {
93
+ ".*": {
94
+ "type": "string"
95
+ }
96
+ }
97
+ }
98
+ }
83
99
  }
84
100
  }
85
- }
101
+ }
@@ -35,9 +35,12 @@
35
35
  # - configMapKeyRef:
36
36
  # name: my-cm
37
37
  # key: cm-parameter
38
+
39
+ annotations:
40
+ serviceInstance: {}
38
41
  global:
39
42
  sap:
40
43
  _internal:
41
44
  service-instance:
42
45
  versions:
43
- 1.2.0: true
46
+ 1.3.0: true
@@ -21,6 +21,6 @@ srv:
21
21
  memory: {{#isJava}}1G{{/isJava}}{{^isJava}}500M{{/isJava}}
22
22
  health:
23
23
  liveness:
24
- path: /
24
+ path: {{#isJava}}/{{/isJava}}{{^isJava}}/health{{/isJava}}
25
25
  readiness:
26
- path: /
26
+ path: {{#isJava}}/{{/isJava}}{{^isJava}}/health{{/isJava}}
@@ -5,4 +5,4 @@ name: web-application
5
5
  sources:
6
6
  - https://github.tools.sap/unified-runtime/web-application
7
7
  type: application
8
- version: 1.11.0
8
+ version: 1.12.0
@@ -12,4 +12,8 @@ spec:
12
12
  port: {{ .Values.port }}
13
13
  rules:
14
14
  {{- toYaml .Values.expose.rules | nindent 6 }}
15
+ {{ if .Values.expose.corsPolicy }}
16
+ corsPolicy:
17
+ {{- toYaml .Values.expose.corsPolicy | nindent 6 }}
18
+ {{- end }}
15
19
  {{- end }}
@@ -21,6 +21,21 @@ spec:
21
21
  - protocol: TCP
22
22
  port: {{ $port }}
23
23
  {{- end }}
24
+ - from:
25
+ - podSelector:
26
+ matchLabels:
27
+ app.kubernetes.io/instance: ory
28
+ app.kubernetes.io/name: oathkeeper
29
+ namespaceSelector:
30
+ matchLabels:
31
+ kubernetes.io/metadata.name: kyma-system
32
+ ports:
33
+ - protocol: TCP
34
+ port: {{ .Values.port }}
35
+ {{- range $port := .Values.networkSecurity.additionalPorts }}
36
+ - protocol: TCP
37
+ port: {{ $port }}
38
+ {{- end }}
24
39
  {{- end }}
25
40
  {{- if .Values.prometheus.enabled }}
26
41
  - from:
@@ -605,6 +605,47 @@
605
605
  "$id": "#/properties/expose/properties/gateway",
606
606
  "type": "string"
607
607
  },
608
+ "corsPolicy": {
609
+ "$id": "#/properties/expose/properties/corsPolicy",
610
+ "type": "object",
611
+ "additionalProperties": false,
612
+ "properties": {
613
+ "allowHeaders": {
614
+ "type": "array",
615
+ "items": {
616
+ "type": "string"
617
+ }
618
+ },
619
+ "allowMethods": {
620
+ "type": "array",
621
+ "items": {
622
+ "type": "string"
623
+ }
624
+ },
625
+ "allowOrigins": {
626
+ "type": "array",
627
+ "items": {
628
+ "type": "object",
629
+ "propertyNames": {"enum": ["regex", "exact", "prefix"]},
630
+ "patternProperties": {
631
+ "": { "type": "string" }
632
+ }
633
+ }
634
+ },
635
+ "allowCredentials": {
636
+ "type": "boolean"
637
+ },
638
+ "exposeHeaders": {
639
+ "type": "array",
640
+ "items": {
641
+ "type": "string"
642
+ }
643
+ },
644
+ "maxAge": {
645
+ "type": "string"
646
+ }
647
+ }
648
+ },
608
649
  "rules": {
609
650
  "$id": "#/properties/expose/properties/rules",
610
651
  "type": "array",
@@ -15,7 +15,7 @@ global:
15
15
  _internal:
16
16
  web-application:
17
17
  versions:
18
- 1.11.0: true
18
+ 1.12.0: true
19
19
  ## Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.
20
20
  # nameOverride: name
21
21
 
@@ -158,6 +158,24 @@ expose:
158
158
  - DELETE
159
159
  - HEAD
160
160
  path: /.*
161
+ ## APIRule CORS policy configuration
162
+ ## https://kyma-project.io/#/api-gateway/user/custom-resources/apirule/04-10-apirule-custom-resource
163
+ # corsPolicy:
164
+ # allowHeaders:
165
+ # - foo
166
+ # - bar
167
+ # allowMethods:
168
+ # - GET
169
+ # - POST
170
+ # allowCredentials: true
171
+ # exposeHeaders:
172
+ # - foo
173
+ # - bar
174
+ # maxAge: 3s
175
+ # allowOrigins:
176
+ # - regex: foo
177
+ # - exact: bar
178
+ # - prefix: baz
161
179
  prometheus:
162
180
  # Add annotations to the Service for Prometheus Service Discovery
163
181
  enabled: false
@@ -31,10 +31,10 @@ module.exports = class HelmTemplate extends require('../../plugin') {
31
31
  }
32
32
 
33
33
  async combine() {
34
- const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter } = readProject()
34
+ const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka } = readProject()
35
35
  let hasContentDeployment = false
36
36
 
37
- if (!exists('chart/charts/service-instance') && (hasHtml5Repo || hasMultitenancy || hasDestination || hasEnterpriseMessaging || hasXsuaa || hasHana)) {
37
+ if (!exists('chart/charts/service-instance') && (hasHtml5Repo || hasMultitenancy || hasDestination || hasEnterpriseMessaging || hasXsuaa || hasHana || hasKafka)) {
38
38
  await copy(join(__dirname, 'files', 'service-instance')).to('chart/charts/service-instance')
39
39
  }
40
40
  if (hasApprouter) {
@@ -71,6 +71,9 @@ module.exports = class HelmTemplate extends require('../../plugin') {
71
71
  await this._mergeDependency('content-deployment', 'hana-deployer')
72
72
  }
73
73
  }
74
+ if (hasKafka) {
75
+ await this._mergeDependency('service-instance', 'kafka')
76
+ }
74
77
  if(!exists('chart/charts/content-deployment') && hasContentDeployment) {
75
78
  await copy(join(__dirname, 'files', 'content-deployment')).to('chart/charts/content-deployment')
76
79
  }
@@ -21,6 +21,6 @@ srv:
21
21
  memory: {{#isJava}}1G{{/isJava}}{{^isJava}}500M{{/isJava}}
22
22
  health:
23
23
  liveness:
24
- path: /
24
+ path: {{#isJava}}/{{/isJava}}{{^isJava}}/health{{/isJava}}
25
25
  readiness:
26
- path: /
26
+ path: {{#isJava}}/{{/isJava}}{{^isJava}}/health{{/isJava}}