@sap/cds-dk 7.9.5 → 8.0.2

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 (283) hide show
  1. package/CHANGELOG.md +2116 -0
  2. package/bin/add.js +18 -52
  3. package/bin/bind.js +2 -2
  4. package/bin/build.js +29 -4
  5. package/bin/cds.js +23 -11
  6. package/bin/compile/index.js +7 -6
  7. package/bin/completion/index.js +70 -46
  8. package/bin/completion/scripts/cds-bash.sh +4 -1
  9. package/bin/completion/scripts/cds-fish.fish +13 -0
  10. package/bin/completion/scripts/cds-ps.ps1 +2 -1
  11. package/bin/completion/scripts/cds-zsh.sh +2 -1
  12. package/bin/deploy/index.js +6 -5
  13. package/bin/deploy/to-sqlite.js +2 -2
  14. package/bin/extend.js +19 -50
  15. package/bin/help.js +2 -2
  16. package/bin/init.js +10 -77
  17. package/bin/login.js +13 -5
  18. package/bin/migrate.js +1 -1
  19. package/bin/pull.js +11 -0
  20. package/bin/repl.js +3 -0
  21. package/bin/test.js +5 -0
  22. package/bin/version.js +7 -7
  23. package/bin/watch.js +1 -10
  24. package/lib/bind/KubernetesApiAccessor.js +10 -9
  25. package/lib/build/buildTaskEngine.js +11 -7
  26. package/lib/build/buildTaskFactory.js +15 -43
  27. package/lib/build/buildTaskProviderFactory.js +16 -44
  28. package/lib/build/constants.js +3 -3
  29. package/lib/build/index.js +2 -2
  30. package/lib/build/{buildPlugin.js → plugin.js} +65 -46
  31. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/Chart.yaml +1 -1
  32. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.yaml +1 -1
  33. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/Chart.yaml +1 -1
  34. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/_helpers.tpl +7 -0
  35. package/lib/build/plugins/helm/files/subcharts/service-instance/templates/servicebinding.yaml +32 -0
  36. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/serviceinstance.yaml +3 -0
  37. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.schema.json +63 -0
  38. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.yaml +23 -1
  39. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/Chart.yaml +1 -1
  40. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/deployment.yaml +2 -0
  41. package/lib/build/plugins/helm/files/subcharts/web-application/templates/hpa.yaml +22 -0
  42. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/pod-disruption-budget.yaml +1 -0
  43. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.schema.json +49 -0
  44. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.yaml +8 -2
  45. package/lib/{init/template/helm/files/chart → build/plugins/helm/files}/templates/_deployment_helpers.tpl +5 -0
  46. package/lib/build/plugins/helm/files/templates/_helpers.tpl +13 -0
  47. package/lib/build/plugins/helm/index.js +81 -0
  48. package/lib/build/plugins.js +12 -15
  49. package/lib/build/provider/featureToggleBuildPlugin.js +7 -39
  50. package/lib/build/provider/hana/2migration.js +168 -124
  51. package/lib/build/provider/hana/index.js +20 -25
  52. package/lib/build/provider/hana/template/package.json +4 -3
  53. package/lib/build/provider/internalBuildPlugin.js +32 -97
  54. package/lib/build/provider/internalBuildTaskProvider.js +10 -46
  55. package/lib/build/provider/java/index.js +2 -3
  56. package/lib/build/provider/mtx/index.js +5 -4
  57. package/lib/build/provider/mtx-extension/index.js +5 -2
  58. package/lib/build/provider/mtx-sidecar/index.js +2 -2
  59. package/lib/build/util.js +83 -12
  60. package/lib/compile/to-mermaid.js +108 -0
  61. package/lib/compile/to_asyncapi.js +7 -0
  62. package/lib/compile/to_openapi.js +7 -0
  63. package/lib/deploy/to-hana/hana.js +37 -34
  64. package/lib/deploy/to-hana/hdiDeployUtil.js +8 -6
  65. package/lib/env/schemas/cds-rc.js +1 -1
  66. package/lib/import/common.js +2 -2
  67. package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -4
  68. package/lib/import/odata/v2parser.js +83 -197
  69. package/lib/import/odata/v4parser.js +1 -38
  70. package/lib/import/openapi/importOpenAPI.js +164 -42
  71. package/lib/index.js +10 -12
  72. package/lib/init/bas.js +91 -0
  73. package/lib/init/constants.js +16 -10
  74. package/lib/init/index.js +72 -150
  75. package/lib/init/merge.js +12 -20
  76. package/lib/init/mvn.js +103 -150
  77. package/lib/init/plugin.js +11 -7
  78. package/lib/init/projectReader.js +53 -19
  79. package/lib/init/registries/mta.js +51 -6
  80. package/lib/init/template/application-logging/files/package.json.hbs +7 -0
  81. package/lib/init/template/application-logging/index.js +13 -1
  82. package/lib/init/template/approuter/files/containerize.yaml.hbs +10 -0
  83. package/lib/init/template/approuter/files/mta.yaml.hbs +1 -2
  84. package/lib/init/template/approuter/files/values.yaml.hbs +19 -4
  85. package/lib/init/template/approuter/files/xs-app.json.hbs +12 -3
  86. package/lib/init/template/approuter/index.js +29 -25
  87. package/lib/init/template/attachments/files/mta.yaml.hbs +14 -0
  88. package/lib/init/template/attachments/files/package.json.hbs +5 -0
  89. package/lib/init/template/attachments/files/values.yaml +7 -0
  90. package/lib/init/template/attachments/index.js +53 -0
  91. package/lib/init/template/audit-logging/files/mta.yaml.hbs +14 -0
  92. package/lib/init/template/audit-logging/files/package.json.hbs +7 -0
  93. package/lib/init/template/audit-logging/index.js +66 -0
  94. package/lib/init/template/cf-manifest/index.js +4 -0
  95. package/lib/init/template/completion/completionSetup.js +54 -33
  96. package/lib/init/template/completion/index.js +7 -1
  97. package/lib/init/template/connectivity/index.js +4 -4
  98. package/lib/init/template/containerize/files/containerize.yaml.hbs +26 -0
  99. package/lib/init/template/containerize/index.js +24 -0
  100. package/lib/init/template/data/index.js +4 -0
  101. package/lib/init/template/destination/files/mta.yaml.hbs +25 -1
  102. package/lib/init/template/destination/index.js +12 -2
  103. package/lib/init/template/enterprise-messaging/index.js +6 -3
  104. package/lib/init/template/enterprise-messaging-shared/index.js +5 -1
  105. package/lib/init/template/extensibility/files/package.json.hbs +1 -1
  106. package/lib/init/template/extensibility/files/xs-security.json.hbs +2 -8
  107. package/lib/init/template/extensibility/index.js +3 -1
  108. package/lib/init/template/file-based-messaging/index.js +4 -0
  109. package/lib/init/template/h2/index.js +4 -0
  110. package/lib/init/template/hana/files/containerize.yaml.hbs +10 -0
  111. package/lib/init/template/hana/files/db/package.json +3 -2
  112. package/lib/init/template/hana/files/package.json.hbs +4 -7
  113. package/lib/init/template/hana/files/values.yaml.hbs +1 -2
  114. package/lib/init/template/hana/index.js +15 -7
  115. package/lib/init/template/helm/files/Chart.yaml.hbs +2 -3
  116. package/lib/init/template/helm/files/values.schema.json +2173 -0
  117. package/lib/init/template/helm/files/values.yaml.hbs +11 -6
  118. package/lib/init/template/helm/index.js +77 -18
  119. package/lib/init/template/helm-unified-runtime/index.js +19 -56
  120. package/lib/init/template/html5-repo/files/app-package.json.hbs +11 -7
  121. package/lib/init/template/html5-repo/files/manifest.json +13 -0
  122. package/lib/init/template/html5-repo/files/mta.yaml.hbs +41 -8
  123. package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +21 -0
  124. package/lib/init/template/html5-repo/files/ui5.yaml.hbs +2 -29
  125. package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -2
  126. package/lib/init/template/html5-repo/files/xs-app.json.hbs +21 -8
  127. package/lib/init/template/html5-repo/index.js +33 -30
  128. package/lib/init/template/http/index.js +36 -12
  129. package/lib/init/template/java/index.js +18 -12
  130. package/lib/init/template/kafka/index.js +4 -0
  131. package/lib/init/template/lint/index.js +7 -2
  132. package/lib/init/template/liquibase/index.js +4 -0
  133. package/lib/init/template/local-messaging/index.js +4 -0
  134. package/lib/init/template/malware-scanner/files/mta.yaml.hbs +14 -0
  135. package/lib/init/template/malware-scanner/files/package.json.hbs +17 -0
  136. package/lib/init/template/malware-scanner/files/values.yaml +7 -0
  137. package/lib/init/template/malware-scanner/index.js +47 -0
  138. package/lib/init/template/mta/files/mta.yaml.hbs +3 -3
  139. package/lib/init/template/mta/files/package.json +1 -1
  140. package/lib/init/template/mta/index.js +4 -0
  141. package/lib/init/template/mtx/index.js +4 -0
  142. package/lib/init/template/multitenancy/files/containerize.yaml.hbs +10 -0
  143. package/lib/init/template/multitenancy/files/mta.yaml.hbs +0 -1
  144. package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
  145. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +6 -5
  146. package/lib/init/template/multitenancy/files/values.yaml.hbs +14 -24
  147. package/lib/init/template/multitenancy/index.js +50 -28
  148. package/lib/init/template/nodejs/files/eslint.config.mjs +2 -0
  149. package/lib/init/template/nodejs/files/package.json.hbs +2 -3
  150. package/lib/init/template/nodejs/index.js +4 -0
  151. package/lib/init/template/notifications/files/mta.yaml.hbs +2 -2
  152. package/lib/init/template/notifications/index.js +4 -0
  153. package/lib/init/template/pipeline/files/.pipeline/config.yml +1 -1
  154. package/lib/init/template/pipeline/files/Jenkinsfile +1 -1
  155. package/lib/init/template/pipeline/index.js +4 -0
  156. package/lib/init/template/portal/files/mta.yaml.hbs +52 -0
  157. package/lib/init/template/portal/files/package.json.hbs +11 -0
  158. package/lib/init/template/portal/files/package.sidecar.json +7 -0
  159. package/lib/init/template/portal/files/portal-site/CommonDataModel.json.hbs +97 -0
  160. package/lib/init/template/portal/files/portal-site/i18n/catalog.properties +1 -0
  161. package/lib/init/template/portal/files/portal-site/i18n/catalog_de.properties +1 -0
  162. package/lib/init/template/portal/files/portal-site/i18n/group.properties +1 -0
  163. package/lib/init/template/portal/files/portal-site/i18n/group_de.properties +1 -0
  164. package/lib/init/template/portal/index.js +84 -0
  165. package/lib/init/template/postgres/index.js +5 -1
  166. package/lib/init/template/redis-messaging/index.js +4 -0
  167. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -0
  168. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -0
  169. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +13 -1
  170. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +2 -2
  171. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -0
  172. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +4 -0
  173. package/lib/init/template/sample/files/app/browse/webapp/manifest.json +3 -3
  174. package/lib/init/template/sample/files/app/index.html +1 -1
  175. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -5
  176. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -6
  177. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -5
  178. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -16
  179. package/lib/init/template/sample/files/nodejs/cat-service.js +2 -2
  180. package/lib/init/template/sample/files/package.json.hbs +3 -0
  181. package/lib/init/template/sample/index.js +16 -9
  182. package/lib/init/template/sqlite/index.js +4 -0
  183. package/lib/init/template/tiny-sample/files/nodejs/db/data/my.bookshop-Books.csv +3 -3
  184. package/lib/init/template/tiny-sample/files/nodejs/srv/cat-service.cds.hbs +1 -1
  185. package/lib/init/template/tiny-sample/index.js +4 -0
  186. package/lib/init/template/toggles/files/package.json.hbs +1 -1
  187. package/lib/init/template/toggles/index.js +4 -0
  188. package/lib/init/template/typer/index.js +4 -0
  189. package/lib/init/template/typescript/files/package.json +12 -0
  190. package/lib/init/template/typescript/files/tsconfig.json +13 -0
  191. package/lib/init/template/typescript/index.js +39 -0
  192. package/lib/init/template/workzone/index.js +5 -0
  193. package/lib/init/template/workzone-standard/files/manifest.json.hbs +6 -0
  194. package/lib/init/template/workzone-standard/index.js +30 -0
  195. package/lib/init/template/xsuaa/files/package.json.hbs +1 -1
  196. package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -2
  197. package/lib/init/template/xsuaa/index.js +11 -7
  198. package/lib/init/validate.js +27 -0
  199. package/lib/lint/generators.js +1 -1
  200. package/lib/lint/io.js +25 -7
  201. package/lib/mtx/auth_manager.js +64 -30
  202. package/lib/mtx/download_legacy.js +2 -2
  203. package/lib/mtx/index.js +0 -4
  204. package/lib/mtx/params.js +32 -38
  205. package/lib/mtx/pull.js +151 -43
  206. package/lib/mtx/push.js +3 -3
  207. package/lib/mtx/settings_manager.js +75 -35
  208. package/lib/mtx/tenant_action.js +1 -1
  209. package/lib/mtx/util/cf.js +1 -1
  210. package/lib/mtx/util/fs.js +26 -1
  211. package/lib/mtx/util/logging.js +7 -3
  212. package/lib/util/command.js +0 -2
  213. package/lib/util/fs.js +2 -3
  214. package/lib/util/question.js +28 -0
  215. package/lib/util/term.js +5 -3
  216. package/npm-shrinkwrap.json +226 -1087
  217. package/package.json +13 -8
  218. package/bin/activate.js +0 -77
  219. package/lib/compile/asyncapi/channels.js +0 -22
  220. package/lib/compile/asyncapi/components/messageTraits/index.js +0 -89
  221. package/lib/compile/asyncapi/components/messages/index.js +0 -173
  222. package/lib/compile/asyncapi/components/schemas/annotations.js +0 -33
  223. package/lib/compile/asyncapi/components/schemas/array.js +0 -8
  224. package/lib/compile/asyncapi/components/schemas/cache.js +0 -14
  225. package/lib/compile/asyncapi/components/schemas/definition.js +0 -187
  226. package/lib/compile/asyncapi/components/schemas/enum.js +0 -16
  227. package/lib/compile/asyncapi/components/schemas/examples.js +0 -10
  228. package/lib/compile/asyncapi/components/schemas/index.js +0 -14
  229. package/lib/compile/asyncapi/components/schemas/localized.js +0 -29
  230. package/lib/compile/asyncapi/components/schemas/primitiveElement.js +0 -41
  231. package/lib/compile/asyncapi/components/schemas/ref.js +0 -45
  232. package/lib/compile/asyncapi/components/schemas/utils.js +0 -108
  233. package/lib/compile/asyncapi/index.js +0 -247
  234. package/lib/compile/asyncapi/message.js +0 -13
  235. package/lib/compile/asyncapi/utils.js +0 -27
  236. package/lib/compile/openapi/csdl2openapi.js +0 -2448
  237. package/lib/compile/openapi/index.js +0 -68
  238. package/lib/init/template/helm/files/chart/templates/NOTES.txt +0 -14
  239. package/lib/init/template/helm/files/chart/templates/_helpers.tpl +0 -28
  240. package/lib/init/template/helm/files/chart/values.root.schema.json +0 -61
  241. package/lib/init/template/helm/files/chart/values.schema.json +0 -366
  242. package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +0 -10
  243. package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +0 -90
  244. package/lib/init/template/helm-unified-runtime/files/templates/_helpers.tpl +0 -28
  245. package/lib/init/template/helm-unified-runtime/files/values.root.schema.json +0 -61
  246. package/lib/init/template/helm-unified-runtime/files/values.schema.json +0 -366
  247. package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +0 -26
  248. package/lib/init/template/helm-unified-runtime/package.json +0 -4
  249. package/lib/init/template/multitenancy/files/mtxs-configmap-java-approuter.yaml +0 -20
  250. package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +0 -18
  251. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs-approuter.yaml +0 -12
  252. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +0 -12
  253. package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +0 -9
  254. package/lib/init/template/nodejs/files/eslint.config.js +0 -13
  255. package/lib/init/template/notebook/index.js +0 -11
  256. package/lib/init/template/samples/index.js +0 -9
  257. package/lib/mtx/activate.js +0 -238
  258. package/lib/mtx/extend.js +0 -173
  259. package/lib/util/exec.d.ts +0 -54
  260. package/lib/util/exec.js +0 -211
  261. /package/lib/{init/template/approuter/files → build/plugins/helm/files/plugins/approuter}/approuter-configmap.yaml +0 -0
  262. /package/lib/{init/template/connectivity/files → build/plugins/helm/files/plugins/connectivity}/connectivity-proxy-info.yaml +0 -0
  263. /package/lib/{init/template/html5-repo/files → build/plugins/helm/files/plugins/html5-repo}/html5-apps-deployer-configmap.yaml +0 -0
  264. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/_helpers.tpl +0 -0
  265. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/job.yaml +0 -0
  266. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/secret.yaml +0 -0
  267. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-account.yaml +0 -0
  268. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-binding.yaml +0 -0
  269. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.schema.json +0 -0
  270. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/NOTES.txt +0 -0
  271. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_api.tpl +0 -0
  272. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_helpers.tpl +0 -0
  273. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/api-rule.yaml +0 -0
  274. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/network-policy.yaml +0 -0
  275. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/rbac.yaml +0 -0
  276. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/secret.yaml +0 -0
  277. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-account.yaml +0 -0
  278. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-binding.yaml +0 -0
  279. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service.yaml +0 -0
  280. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/virtual-service.yaml +0 -0
  281. /package/lib/{init/template/helm-unified-runtime → build/plugins/helm}/files/templates/NOTES.txt +0 -0
  282. /package/lib/init/template/{nodejs/files → java}/.cdsrc.json +0 -0
  283. /package/lib/init/template/tiny-sample/files/nodejs/db/{data-model.cds → schema.cds} +0 -0
@@ -288,6 +288,11 @@
288
288
  "maxUnavailable": {
289
289
  "type": "string",
290
290
  "default": "10%"
291
+ },
292
+ "unhealthyPodEvictionPolicy": {
293
+ "type": "string",
294
+ "default": "AlwaysAllow",
295
+ "enum": ["AlwaysAllow", "IfHealthyBudget"]
291
296
  }
292
297
  }
293
298
  },
@@ -567,6 +572,9 @@
567
572
  ],
568
573
  "additionalProperties": false,
569
574
  "type": "object"
575
+ },
576
+ "prefix": {
577
+ "type": "string"
570
578
  }
571
579
  },
572
580
  "required": [
@@ -587,6 +595,9 @@
587
595
  ],
588
596
  "additionalProperties": false,
589
597
  "type": "object"
598
+ },
599
+ "prefix": {
600
+ "type": "string"
590
601
  }
591
602
  },
592
603
  "required": [
@@ -957,6 +968,9 @@
957
968
  ],
958
969
  "additionalProperties": false,
959
970
  "type": "object"
971
+ },
972
+ "prefix": {
973
+ "type": "string"
960
974
  }
961
975
  },
962
976
  "required": [
@@ -977,6 +991,9 @@
977
991
  ],
978
992
  "additionalProperties": false,
979
993
  "type": "object"
994
+ },
995
+ "prefix": {
996
+ "type": "string"
980
997
  }
981
998
  },
982
999
  "required": [
@@ -1260,6 +1277,38 @@
1260
1277
  }
1261
1278
  }
1262
1279
  }
1280
+ },
1281
+ "hpa": {
1282
+ "$id": "#/properties/hpa",
1283
+ "title": "Enable autoscaling",
1284
+ "type": "object",
1285
+ "additionalProperties": false,
1286
+ "properties": {
1287
+ "enabled": {
1288
+ "type": "boolean",
1289
+ "title": "Add Horizontal App Autoscaler resource.",
1290
+ "default": false
1291
+ },
1292
+ "minReplicas": {
1293
+ "type": "number",
1294
+ "title": "Lower limit for the number of replicas to which the autoscaler can scale up.",
1295
+ "default": 1
1296
+ },
1297
+ "maxReplicas": {
1298
+ "type": "number",
1299
+ "title": "Upper limit for the number of replicas to which the autoscaler can scale up.",
1300
+ "default": 3
1301
+ },
1302
+ "behavior": {
1303
+ "type": "object"
1304
+ },
1305
+ "metrics": {
1306
+ "type": "array",
1307
+ "items": {
1308
+ "type": "object"
1309
+ }
1310
+ }
1311
+ }
1263
1312
  }
1264
1313
  },
1265
1314
  "definitions": {
@@ -15,7 +15,7 @@ global:
15
15
  _internal:
16
16
  web-application:
17
17
  versions:
18
- 1.13.1: true
18
+ 1.16.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
 
@@ -76,9 +76,11 @@ additionalVolumes: []
76
76
 
77
77
  # Availability related configuration
78
78
  availability:
79
- # The max disruption to the pods, see https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ for details
79
+ # The max disruption to the pods, see https://kubernetes.io/docs/tasks/run-application/configure-pdb/ for details
80
80
  podDisruptionBudget:
81
81
  maxUnavailable: 10%
82
+ # See https://kubernetes.io/blog/2023/01/06/unhealthy-pod-eviction-policy-for-pdbs/
83
+ unhealthyPodEvictionPolicy: AlwaysAllow
82
84
  # How pods ought to spread across topology domains., see https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ for details
83
85
  topologySpreadConstraints:
84
86
  - topologyKey: topology.kubernetes.io/zone
@@ -291,3 +293,7 @@ annotations:
291
293
  # envFrom:
292
294
  # - configMapRef:
293
295
  # name: my-configmap1
296
+ hpa:
297
+ enabled: false
298
+ minReplicas: 1
299
+ maxReplicas: 3
@@ -73,6 +73,11 @@ Backend Destinations
73
73
  {{- $urlKey = "URL" -}}
74
74
  {{- end -}}
75
75
  {{- range $destinationName, $destination := $root.Values.backendDestinations -}}
76
+ {{- if $destination.external }}
77
+ {{- $_ := unset $destination "external" -}}
78
+ {{- $destinations = (append $destinations $destination) -}}
79
+ {{- continue -}}
80
+ {{- end -}}
76
81
  {{- $destination := merge (dict "name" $destinationName) $destination -}}
77
82
  {{- $deployment := (get $root.Values $destination.service) -}}
78
83
  {{- $srv := merge (dict "name" $destination.service "destination" $destination "deployment" $deployment) $root -}}
@@ -0,0 +1,13 @@
1
+ {{/*
2
+ Labels for a component
3
+ */}}
4
+ {{- define "cap.labels" -}}
5
+ helm.sh/revision: {{ .Release.Revision | quote }}
6
+ helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
7
+ app.kubernetes.io/name: {{ .name }}
8
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
9
+ app.kubernetes.io/instance: {{ .Release.Name }}
10
+ {{- if .Chart.AppVersion }}
11
+ app.kubernetes.io/version: {{ .Chart.AppVersion }}
12
+ {{- end }}
13
+ {{- end -}}
@@ -0,0 +1,81 @@
1
+ const cds = require('../../../cds')
2
+ const { exists, path, readFileSync, yaml } = cds.utils
3
+ const { Plugin, BuildError } = require('../../../build')
4
+ const { join } = path
5
+ const { readProject } = require('../../../init/projectReader')
6
+
7
+ module.exports = class HelmBuildPlugin extends Plugin {
8
+ static taskDefaults = { src: "." }
9
+
10
+ static hasTask() {
11
+ if (exists('chart/Chart.yaml')) {
12
+ const chartFile = readFileSync(join(cds.root, 'chart', 'Chart.yaml'), 'utf8')
13
+ const chartYaml = yaml.parseDocument(chartFile).toJS()
14
+ return chartYaml.annotations?.["app.kubernetes.io/managed-by"] === 'cds-dk/helm'
15
+ }
16
+ return false
17
+ }
18
+
19
+ init() {
20
+ if (this.task.src !== cds.root) {
21
+ throw new BuildError("Invalid value for property 'src', it must have value '.'")
22
+ }
23
+
24
+ // different from the default build output structure
25
+ this.task.dest = join(cds.root, cds.env.build.target !== '.' ? cds.env.build.target : 'gen', 'chart')
26
+ }
27
+
28
+ async build() {
29
+ if(!HelmBuildPlugin.hasTask()) {
30
+ this.pushMessage("Helm Chart not found. Execute `cds add helm` to add the helm chart.", Plugin.WARNING)
31
+ return
32
+ }
33
+
34
+ const { hasApprouter, hasConnectivity, hasHtml5Repo } = readProject()
35
+
36
+ const chartFile = readFileSync(join(cds.root, 'chart', 'Chart.yaml'), 'utf8')
37
+ const chartYaml = yaml.parseDocument(chartFile).toJS()
38
+ const isInternal = chartYaml.dependencies?.find(dep => dep.name === 'web-application')?.repository !== undefined
39
+
40
+ if (!isInternal) {
41
+ // copy web appplication helm chart
42
+ await this.copy(join(__dirname, 'files', 'subcharts', 'web-application')).to('charts/web-application')
43
+
44
+ // copy service instance helm chart
45
+ if (this._hasSubchart('service-instance')) {
46
+ await this.copy(join(__dirname, 'files', 'subcharts', 'service-instance')).to('charts/service-instance')
47
+ }
48
+
49
+ // copy content deployment helm chart
50
+ if (this._hasSubchart('content-deployment')) {
51
+ await this.copy(join(__dirname, 'files', 'subcharts', 'content-deployment')).to('charts/content-deployment')
52
+ }
53
+ }
54
+
55
+ // copy templates
56
+ await this.copy(join(__dirname, 'files', 'templates')).to('templates')
57
+
58
+ const pluginResourcePath = join(__dirname, 'files', 'plugins')
59
+
60
+ if (hasApprouter) {
61
+ await this.copy(join(pluginResourcePath, 'approuter/approuter-configmap.yaml')).to('templates/approuter-configmap.yaml')
62
+ }
63
+
64
+ if (hasConnectivity) {
65
+ await this.copy(join(pluginResourcePath, 'connectivity/connectivity-proxy-info.yaml')).to('templates/connectivity-proxy-info.yaml')
66
+ }
67
+
68
+
69
+ if (hasHtml5Repo) {
70
+ await this.copy(join(pluginResourcePath, 'html5-repo/html5-apps-deployer-configmap.yaml')).to('templates/html5-apps-deployer-configmap.yaml')
71
+ }
72
+
73
+ // copy chart folder to gen/chart
74
+ await this.copy(join(cds.root, 'chart')).to(".")
75
+ }
76
+
77
+ _hasSubchart(subchart) {
78
+ const chart = exists('chart/Chart.yaml') ? readFileSync(join(cds.root, 'chart/Chart.yaml'), 'utf8') : ''
79
+ return chart.includes(subchart)
80
+ }
81
+ }
@@ -1,35 +1,32 @@
1
1
  const cds = require('../cds')
2
+ const Plugin = require('./plugin')
2
3
  const DEBUG = cds.debug('cli|build')
3
4
 
4
5
  module.exports = new (class Plugins {
5
6
  constructor() {
6
7
  this._plugins = new Map()
8
+ this._registerDefaults()
7
9
  }
8
10
  get plugins() {
9
11
  return this._plugins
10
12
  }
11
13
  register(id, plugin) {
12
14
  if (!id || !plugin) {
13
- throw Error("Invalid parameter")
14
- }
15
- if (plugin.impl) {
16
- // REVISIT: remove compat mode - latest cds-dk@8
17
- const taskDefaults = plugin.taskDefaults
18
- plugin = this._loadPlugin(id, plugin.impl)
19
- plugin.taskDefaults = taskDefaults
15
+ throw new Error(`Invalid parameter passed, build plugin id: ${id}`)
20
16
  }
21
17
  if (this._plugins.has(id)) {
22
- throw Error(`Build plugin ${id} already registered`)
18
+ throw new Error(`CDS build plugin ${id} already registered`)
19
+ }
20
+ if(!(plugin.prototype instanceof Plugin)) {
21
+ // with cds-dk version 7 the following registration format was supported:
22
+ // cds.build.register("cov2ap", { impl: "@cap-js-community/odata-v2-adapter/src/build.js", taskDefaults: { src: "srv" } })
23
+ throw `The cds build plugin '${id}' is not compatible with this @sap/cds-dk version. Update the npm package '${plugin.impl || id}' to the latest version.`
23
24
  }
24
25
  DEBUG?.(`Registering build plugin ${id}`)
25
26
  this._plugins.set(id, plugin)
26
27
  }
27
- _loadPlugin(id, impl) {
28
- try {
29
- // project-local module is preferred - otherwise from our own dependencies
30
- return require(require.resolve(impl, { paths: [cds.root, __dirname] }))
31
- } catch (e) {
32
- throw new Error(`Custom build plugin implementation '${impl}' for '${id}' cannot be loaded:\n` + e)
33
- }
28
+
29
+ _registerDefaults() {
30
+ this.register('helm', require('./plugins/helm'))
34
31
  }
35
32
  })
@@ -2,7 +2,7 @@ const path = require('path')
2
2
  const cds = require('../../cds')
3
3
  const { DEFAULT_CSN_FILE_NAME, OUTPUT_MODE, OUTPUT_MODE_RESULT } = require('../constants')
4
4
  const InternalBuildPlugin = require('./internalBuildPlugin')
5
- const { getI18nDefaultFolder } = require('../util')
5
+ const { getI18nDefaultFolder, filterFeaturePaths } = require('../util')
6
6
 
7
7
  class FeatureToggleBuildPlugin extends InternalBuildPlugin {
8
8
  init() {
@@ -16,12 +16,8 @@ class FeatureToggleBuildPlugin extends InternalBuildPlugin {
16
16
  }
17
17
  }
18
18
 
19
- get ftsName() {
20
- return path.dirname(cds.env.features.folders || 'fts/*')
21
- }
22
-
23
19
  async compileAll(csn, destBase, destFts) {
24
- const sources = await this._resolveSourcePaths(csn)
20
+ const sources = filterFeaturePaths(csn, this.task.options.model || this.task.src)
25
21
  const dictionary = { base: null, features: null }
26
22
 
27
23
  if (sources.features) {
@@ -47,6 +43,7 @@ class FeatureToggleBuildPlugin extends InternalBuildPlugin {
47
43
 
48
44
  async collectAllLanguageBundles(dictionary, paths, destBase, destFts) {
49
45
  const i18nFolder = getI18nDefaultFolder()
46
+ const ftsName = path.dirname(cds.env.features.folders || 'fts/*')
50
47
  // create language bundle for base model
51
48
  const i18n = await this.collectLanguageBundles(dictionary.base, path.join(destBase, i18nFolder))
52
49
  if (i18n && this.hasBuildOption(OUTPUT_MODE, OUTPUT_MODE_RESULT)) {
@@ -58,52 +55,23 @@ class FeatureToggleBuildPlugin extends InternalBuildPlugin {
58
55
  for (const ftName in dictionary.features) {
59
56
  // attach the sources information for i18n location reference
60
57
  dictionary.features[ftName]['$sources'] = paths.features[ftName]
61
- await this.collectLanguageBundles(dictionary.features[ftName], path.join(destFts, this.ftsName, ftName, i18nFolder))
58
+ await this.collectLanguageBundles(dictionary.features[ftName], path.join(destFts, ftsName, ftName, i18nFolder))
62
59
  }
63
60
  }
64
61
  }
65
62
 
66
- async _resolveSourcePaths(csn) {
67
- const regex = new RegExp(this.ftsName + '[/|\\\\](?<ftName>[^/|\\\\]*)')
68
- let paths = { base: [] }
69
-
70
- // add ROOT source file paths for the base model
71
- paths.base = this._resolveModel().reduce((acc, file) => {
72
- const match = file.match(regex)
73
- if (!match) {
74
- acc.push(file)
75
- }
76
- return acc
77
- }, [])
78
-
79
- // add source file paths for the features
80
- paths.features = csn['$sources'].reduce((acc, file) => {
81
- const match = file.match(regex)
82
- if (match) {
83
- const { ftName } = match.groups
84
- //feature
85
- if (!acc[ftName]) {
86
- acc[ftName] = []
87
- }
88
- acc[ftName].push(file)
89
- }
90
- return acc
91
- }, {})
92
-
93
- return paths
94
- }
95
-
96
63
  async _compileFeatures(ftsPaths, destBase, destFts, baseCsn) {
97
64
  if (!ftsPaths) {
98
65
  return
99
66
  }
100
67
  const features = {}
101
68
  const options = { ...this.options(), flavor: 'parsed' }
69
+ const ftsName = path.dirname(cds.env.features.folders || 'fts/*')
102
70
 
103
71
  // create feature models
104
72
  for (const ftName in ftsPaths) {
105
73
  const ftCsn = await cds.load(ftsPaths[ftName], options)
106
- const ftPath = path.join(destFts, this.ftsName, ftName)
74
+ const ftPath = path.join(destFts, ftsName, ftName)
107
75
 
108
76
  // replace require paths by base model path to ensure precedence of feature annotations
109
77
  // see https://pages.github.tools.sap/cap/docs/cds/compiler-messages#anno-duplicate-unrelated-layer
@@ -119,7 +87,7 @@ class FeatureToggleBuildPlugin extends InternalBuildPlugin {
119
87
  _validateFeature(ftCsn, baseCsn) {
120
88
  // features must not have other dependencies than base model dependencies - cross feature dependencies are not supported
121
89
  // assuming only core compiler options are relevant for validation scenario
122
- cds.compiler.compileSources({ [ftCsn.requires[0]]: baseCsn, 'feature.csn': ftCsn }, { ...super.options(), ...cds.env.cdsc ?? {}})
90
+ cds.compiler.compileSources({ [ftCsn.requires[0]]: baseCsn, 'feature.csn': ftCsn }, { ...super.options(), ...cds.env.cdsc ?? {} })
123
91
  }
124
92
  }
125
93