@sap/cds-dk 6.0.4 → 6.1.3

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 (104) hide show
  1. package/CHANGELOG.md +60 -1
  2. package/bin/add.js +29 -16
  3. package/bin/compile/index.js +7 -2
  4. package/bin/fix-redirects.js +4 -2
  5. package/bin/init.js +5 -0
  6. package/bin/login.js +20 -4
  7. package/bin/pull.js +58 -0
  8. package/bin/push.js +52 -0
  9. package/bin/subscribe.js +45 -0
  10. package/lib/bind/bindingUtil.js +1 -2
  11. package/lib/cds.js +2 -3
  12. package/lib/client/activate.js +17 -16
  13. package/lib/client/auth_manager.js +10 -5
  14. package/lib/client/base_command.js +4 -6
  15. package/lib/client/extend.js +3 -2
  16. package/lib/client/helper/cf_helper.js +1 -0
  17. package/lib/client/helper/errors.js +11 -0
  18. package/lib/client/helper/logging.js +3 -10
  19. package/lib/client/helper/url_helper.js +7 -3
  20. package/lib/client/index.js +1 -1
  21. package/lib/client/params.js +9 -6
  22. package/lib/client/pull.js +48 -0
  23. package/lib/client/push.js +45 -0
  24. package/lib/client/settings_manager.js +81 -27
  25. package/lib/compile/openapi/csdl2openapi.js +135 -163
  26. package/lib/compile/openapi/index.js +0 -1
  27. package/lib/import/common.js +9 -1
  28. package/lib/import/odata/metadataconverter/MetadataConverter.js +17 -4
  29. package/lib/import/odata/v2parser.js +50 -26
  30. package/lib/import/odata/v4parser.js +110 -29
  31. package/lib/import/openapi/importOpenAPI.js +3 -3
  32. package/lib/init/constants.js +9 -3
  33. package/lib/init/template/_merging/registry-mta.js +284 -0
  34. package/lib/init/template/approuter/files/xs-app.json.hbs +7 -7
  35. package/lib/init/template/approuter/index.js +22 -32
  36. package/lib/init/template/auditlog/index.js +7 -9
  37. package/lib/init/template/data/index.js +2 -4
  38. package/lib/init/template/extensibility/files/cds.package.json +7 -0
  39. package/lib/init/template/extensibility/files/cds.package.json.hbs +9 -0
  40. package/lib/init/template/extensibility/files/xs-security.json.hbs +26 -0
  41. package/lib/init/template/extensibility/index.js +48 -0
  42. package/lib/init/template/hana/files/java/cdsrc.json.hbs +1 -1
  43. package/lib/init/template/hana/files/java/profile.cdsrc.json.hbs +2 -2
  44. package/lib/init/template/hana/files/mta.yaml.hbs +10 -0
  45. package/lib/init/template/hana/files/nodejs/cds.package.json.hbs +1 -1
  46. package/lib/init/template/hana/files/nodejs/cds.profile.package.json.hbs +2 -2
  47. package/lib/init/template/hana/index.js +74 -61
  48. package/lib/init/template/kibana-logging/index.js +31 -37
  49. package/lib/init/template/lint/files/.eslint/rules/no-entity-moo.js +14 -14
  50. package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
  51. package/lib/init/template/mta/index.js +13 -7
  52. package/lib/init/template/mtx/index.js +2 -142
  53. package/lib/init/template/multitenancy/files/cds.package.json +7 -0
  54. package/lib/init/template/multitenancy/files/cds.package.json.hbs +9 -0
  55. package/lib/init/template/{mtx → multitenancy}/files/dependencies.package.json +1 -1
  56. package/lib/init/template/multitenancy/files/java/.cdsrc.json +19 -0
  57. package/lib/init/template/multitenancy/files/java/package.json +31 -0
  58. package/lib/init/template/{mtx → multitenancy}/files/mta.yaml.hbs +13 -6
  59. package/lib/init/template/multitenancy/files/xs-security.json.hbs +18 -0
  60. package/lib/init/template/multitenancy/index.js +109 -0
  61. package/lib/init/template/nodejs/files/package.json.hbs +4 -1
  62. package/lib/init/template/templateBase.js +2 -1
  63. package/lib/init/template/toggles/files/cds.package.json +7 -0
  64. package/lib/init/template/toggles/files/cds.package.json.hbs +9 -0
  65. package/lib/init/template/toggles/index.js +24 -0
  66. package/lib/init/template/xsuaa/files/mta.yaml.hbs +10 -0
  67. package/lib/init/template/xsuaa/index.js +44 -33
  68. package/lib/init/util/projectReader.js +12 -7
  69. package/lib/init/util/templateUtil.js +113 -111
  70. package/lib/k8s/ChartAdder.js +13 -3
  71. package/lib/k8s/ChartBuilder.js +6 -0
  72. package/lib/k8s/buildModel.js +1 -3
  73. package/lib/k8s/connectivity/index.js +5 -5
  74. package/lib/k8s/deployment/index.js +2 -4
  75. package/lib/k8s/deployment/subchart/Chart.yaml +1 -1
  76. package/lib/k8s/deployment/subchart/templates/_helpers.tpl +22 -11
  77. package/lib/k8s/deployment/subchart/templates/deployment.yaml +12 -5
  78. package/lib/k8s/deployment/subchart/templates/network-policy.yaml +3 -1
  79. package/lib/k8s/deployment/subchart/templates/pod-disruption-budget.yaml +1 -1
  80. package/lib/k8s/deployment/subchart/values.md +812 -0
  81. package/lib/k8s/deployment/subchart/values.schema.json +125 -30
  82. package/lib/k8s/deployment/subchart/values.yaml +7 -3
  83. package/lib/k8s/hana-deployer/index.js +10 -0
  84. package/lib/k8s/hana-deployer/templates/hana-deployer-job.yaml +8 -0
  85. package/lib/k8s/html5-apps-deployer/index.js +10 -0
  86. package/lib/k8s/html5-apps-deployer/templates/html5-apps-deployer-job.yaml +8 -0
  87. package/lib/k8s/index.js +2 -2
  88. package/lib/k8s/resources/helm/chart/schemas/values.root.schema.json +11 -0
  89. package/lib/k8s/resources/helm/chart/schemas/values.schema.json +479 -0
  90. package/lib/k8s/resources/helm/chart/templates/_deployment_helpers.tpl +1 -159
  91. package/lib/k8s/resources/helm/chart/templates/_helpers.tpl +0 -33
  92. package/lib/k8s/resources/helm/chart/templates/_sapcp_helpers.tpl +1 -1
  93. package/lib/lint/Linter.js +155 -158
  94. package/lib/lint/io.js +12 -5
  95. package/npm-shrinkwrap.json +214 -74
  96. package/package.json +5 -4
  97. package/lib/init/template/_merging/existences.js +0 -297
  98. package/lib/init/template/mtx/files/cds.package.json +0 -12
  99. package/lib/init/template/mtx/files/cds.package.json.hbs +0 -14
  100. package/lib/init/template/mtx/files/java/.cdsrc.json +0 -17
  101. package/lib/init/template/mtx/files/java/package.json +0 -43
  102. package/lib/init/template/mtx/files/java/server.js +0 -30
  103. package/lib/init/template/mtx/files/xs-security.json.hbs +0 -48
  104. package/lib/lint/.eslintrc.js +0 -3
@@ -50,12 +50,12 @@ module.exports = wrapFeature('connectivity', {
50
50
  }
51
51
  );
52
52
 
53
- mergeSemantics.existences.push({
53
+ mergeSemantics.additions.push({
54
54
  ref: `{name}-additional-volumes`,
55
- keyPath: [name, "additionalVolumes"],
56
- constraints: [{
57
- comparisonKeyPath: ["name"],
58
- value: "connectivity-secret"
55
+ in: `${name}.additionalVolumes`,
56
+ where: [{
57
+ property: 'name',
58
+ isEqualTo: 'connectivity-secret'
59
59
  }]
60
60
  });
61
61
  },
@@ -19,7 +19,7 @@ class Deployment {
19
19
 
20
20
  const language = this.language || model.language;
21
21
  const memory = language === 'Java' ? '1G' : '500M';
22
- const cpu = language === 'Java' ? '700m' : '100m';
22
+ const cpu = language === 'Java' ? '1000m' : '500m';
23
23
  const env = language === 'Java' ? {SPRING_PROFILES_ACTIVE: "cloud"} : undefined;
24
24
 
25
25
  return {
@@ -32,12 +32,11 @@ class Deployment {
32
32
  env,
33
33
  resources: {
34
34
  limits: {
35
- cpu,
36
35
  'ephemeral-storage': '1G',
37
36
  memory
38
37
  },
39
38
  requests: {
40
- cpu: '100m',
39
+ cpu,
41
40
  'ephemeral-storage': '1G',
42
41
  memory
43
42
  }
@@ -64,7 +63,6 @@ class Deployment {
64
63
 
65
64
  async addToChart(builder) {
66
65
  await builder.addSubchartFiles(webApplicationChartPath, 'web-application');
67
- await builder.addChartFile(Path.join(__dirname, 'subchart-override', 'templates', '_web_application_helpers.tpl'), {fileName: Path.join('charts', 'web-application', 'templates', '_web_application_helpers.tpl')});
68
66
  }
69
67
  }
70
68
 
@@ -1,6 +1,6 @@
1
1
  apiVersion: v2
2
2
  name: web-application
3
3
  description: A Helm chart for web app
4
-
4
+ kubeVersion: ">= 1.21"
5
5
  type: application
6
6
  version: 0.1.0
@@ -81,13 +81,20 @@ Define Host for the APIRule
81
81
  {{- end }}
82
82
  {{- end }}
83
83
 
84
+ {{/*
85
+ Define the application uri which will be used for the VCAP_APPLICATION env variable
86
+ */}}
87
+ {{- define "web-application.applicationUri" -}}
88
+ {{- include "web-application.fullname" . }}
89
+ {{- end }}
90
+
84
91
  {{/*
85
92
  Service Binding secret mounts
86
93
  */}}
87
94
  {{- define "web-application.serviceMounts" -}}
88
95
  {{- range $name, $params := .Values.bindings }}
89
96
  - mountPath: /bindings/{{ $name }}/
90
- name: "{{ $name }}-binding"
97
+ name: "{{ $name }}"
91
98
  readOnly: true
92
99
  {{- end }}
93
100
  {{- end }}
@@ -103,18 +110,9 @@ Service Binding secret volumes
103
110
  {{- else if $params.secretName }}
104
111
  {{- $secretName = $params.secretName }}
105
112
  {{- end }}
106
- - name: {{ $name }}-binding
113
+ - name: {{ $name }}
107
114
  secret:
108
115
  secretName: {{ $secretName }}
109
- items:
110
- - key: label
111
- path: metadata/label
112
- - key: plan
113
- path: metadata/plan
114
- - key: tags
115
- path: metadata/tags
116
- - key: credentials
117
- path: credentials
118
116
  {{- end }}
119
117
  {{- end }}
120
118
 
@@ -132,6 +130,19 @@ Name of the imagePullSecret
132
130
  {{- end }}
133
131
  {{- end }}
134
132
 
133
+ {{/*
134
+ Calculate the final image name
135
+ */}}
136
+ {{- define "web-application.imageName" -}}
137
+ {{- $tag := .Values.image.tag | default .Values.global.image.tag | default "latest" }}
138
+ {{- $registry := .Values.image.registry | default .Values.global.image.registry }}
139
+ {{- if $registry }}
140
+ {{- $registry | trimSuffix "/" }}/{{ .Values.image.repository }}:{{ $tag }}
141
+ {{- else }}
142
+ {{- .Values.image.repository }}:{{ $tag }}
143
+ {{- end }}
144
+ {{- end }}
145
+
135
146
  {{/*
136
147
  Create the name of a service instance.
137
148
  We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
@@ -18,7 +18,7 @@ spec:
18
18
  automountServiceAccountToken: false
19
19
  serviceAccountName: {{ .Values.serviceAccountName }}
20
20
  containers:
21
- - image: "{{ required ".Values.image.repository is required!" .Values.image.repository }}:{{ .Values.image.tag }}"
21
+ - image: {{ include "web-application.imageName" . }}
22
22
  name: {{ include "web-application.name" . }}
23
23
  ports:
24
24
  - name: http
@@ -30,10 +30,17 @@ spec:
30
30
  name: {{ $secretName }}
31
31
  {{- end }}
32
32
  env:
33
- {{- include "cap.web-application.env" . | indent 8 }}
34
33
  {{- range $k, $v := .Values.env }}
35
34
  - name: {{ $k }}
36
- value: {{ tpl ($v | toString) $ | quote }}
35
+ value: {{ $v | quote }}
36
+ {{- end }}
37
+ {{- if not .Values.env.APPLICATION_NAME }}
38
+ - name: APPLICATION_NAME
39
+ value: {{ include "web-application.fullname" . }}
40
+ {{- end }}
41
+ {{- if not .Values.env.APPLICATION_URI }}
42
+ - name: APPLICATION_URI
43
+ value: {{ include "web-application.applicationUri" . }}
37
44
  {{- end }}
38
45
  {{- if .Values.bindings }}
39
46
  - name: SERVICE_BINDING_ROOT
@@ -79,7 +86,7 @@ spec:
79
86
  - name: {{ $volume.name | quote }}
80
87
  {{- toYaml $volume.volumeMount | nindent 10 }}
81
88
  {{- end }}
82
- {{- include "cap.web-application.serviceMounts" . | nindent 8 }}
89
+ {{- include "web-application.serviceMounts" . | nindent 8 }}
83
90
  resources:
84
91
  {{- toYaml .Values.resources | nindent 10 }}
85
92
  securityContext:
@@ -103,7 +110,7 @@ spec:
103
110
  volumes:
104
111
  - emptyDir: {}
105
112
  name: tmp
106
- {{- include "cap.web-application.serviceVolumes" . | nindent 6 }}
113
+ {{- include "web-application.serviceVolumes" . | nindent 6 }}
107
114
  {{- range $volume := .Values.additionalVolumes }}
108
115
  -
109
116
  {{- omit $volume "volumeMount" | toYaml | nindent 8 }}
@@ -9,7 +9,9 @@ spec:
9
9
  - podSelector:
10
10
  matchLabels:
11
11
  app: istio-ingressgateway
12
- namespaceSelector: {}
12
+ namespaceSelector:
13
+ matchLabels:
14
+ name: istio-system
13
15
  podSelector:
14
16
  matchLabels: {{- include "web-application.selectorLabels" . | nindent 6 }}
15
17
  policyTypes:
@@ -1,5 +1,5 @@
1
1
  {{- if .Values.ha.enabled }}
2
- apiVersion: policy/v1beta1
2
+ apiVersion: policy/v1
3
3
  kind: PodDisruptionBudget
4
4
  metadata:
5
5
  name: {{ include "web-application.fullname" . }}