@sap/cds-dk 6.5.2 → 6.6.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.
- package/CHANGELOG.md +40 -0
- package/bin/activate.js +7 -0
- package/bin/add.js +1 -2
- package/bin/build/all.js +14 -9
- package/bin/cds.js +11 -8
- package/bin/compile/index.js +13 -3
- package/bin/env.js +16 -25
- package/bin/extend.js +8 -0
- package/bin/init.js +0 -3
- package/bin/login.js +3 -7
- package/bin/logout.js +2 -7
- package/bin/watch.js +4 -5
- package/lib/client/activate.js +1 -1
- package/lib/client/helper/errors.js +4 -1
- package/lib/client/params.js +4 -3
- package/lib/client/pull.js +31 -5
- package/lib/client/push.js +3 -3
- package/lib/client/settings_manager.js +6 -6
- package/lib/client/subscription.js +1 -1
- package/lib/compile/asyncapi/channels.js +22 -0
- package/lib/compile/asyncapi/components/messageTraits/index.js +89 -0
- package/lib/compile/asyncapi/components/messages/index.js +150 -0
- package/lib/compile/asyncapi/components/schemas/annotations.js +13 -0
- package/lib/compile/asyncapi/components/schemas/array.js +8 -0
- package/lib/compile/asyncapi/components/schemas/cache.js +14 -0
- package/lib/compile/asyncapi/components/schemas/definition.js +187 -0
- package/lib/compile/asyncapi/components/schemas/enum.js +16 -0
- package/lib/compile/asyncapi/components/schemas/examples.js +10 -0
- package/lib/compile/asyncapi/components/schemas/index.js +14 -0
- package/lib/compile/asyncapi/components/schemas/localized.js +29 -0
- package/lib/compile/asyncapi/components/schemas/primitiveElement.js +41 -0
- package/lib/compile/asyncapi/components/schemas/ref.js +45 -0
- package/lib/compile/asyncapi/components/schemas/utils.js +108 -0
- package/lib/compile/asyncapi/index.js +226 -0
- package/lib/compile/asyncapi/message.js +13 -0
- package/lib/compile/asyncapi/utils.js +27 -0
- package/lib/compile/index.js +1 -0
- package/lib/compile/openapi/csdl2openapi.js +42 -18
- package/lib/import/message.js +4 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +8 -3
- package/lib/import/odata/v2parser.js +131 -50
- package/lib/import/odata/v4parser.js +292 -112
- package/lib/import/openapi/importOpenAPI.js +14 -14
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +11 -21
- package/lib/init/template/_merging/registry-mta.js +15 -26
- package/lib/init/template/approuter/files/package.json +2 -2
- package/lib/init/template/approuter/index.js +6 -12
- package/lib/init/template/auditlog/files/auditlog.yaml +4 -1
- package/lib/init/template/auditlog/index.js +23 -8
- package/lib/init/template/cf-manifest/index.js +4 -14
- package/lib/init/template/connectivity/files/connectivity-proxy-info.yaml +2 -6
- package/lib/init/template/connectivity/files/values.yaml.hbs +5 -8
- package/lib/init/template/connectivity/index.js +2 -9
- package/lib/init/template/data/index.js +0 -4
- package/lib/init/template/destinations/files/destination.yaml +4 -1
- package/lib/init/template/destinations/index.js +25 -10
- package/lib/init/template/enterprise-messaging/files/event-mesh.yaml +4 -1
- package/lib/init/template/enterprise-messaging/files/values.yaml +1 -2
- package/lib/init/template/enterprise-messaging/index.js +28 -20
- package/lib/init/template/extensibility/index.js +23 -31
- package/lib/init/template/hana/files/hana.yaml +4 -1
- package/lib/init/template/hana/index.js +44 -24
- package/lib/init/template/helm/chart/templates/_helpers.tpl +12 -0
- package/lib/init/template/helm/chart/values.root.schema.json +40 -0
- package/lib/init/template/helm/chart/values.schema.json +32 -69
- package/lib/init/template/helm/index.js +26 -16
- package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +13 -26
- package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +2 -0
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/templating.md +37 -0
- package/lib/init/template/helm/subcharts/content-deployment/values.md +182 -185
- package/lib/init/template/helm/subcharts/content-deployment/values.schema.json +18 -22
- package/lib/init/template/helm/subcharts/content-deployment/values.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +5 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +65 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +23 -0
- package/lib/init/template/helm/subcharts/service-instance/templating.md +18 -0
- package/lib/init/template/helm/subcharts/service-instance/values-lint.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/values.md +186 -0
- package/lib/init/template/helm/subcharts/service-instance/values.schema.json +102 -0
- package/lib/init/template/helm/subcharts/service-instance/values.yaml +15 -0
- package/lib/init/template/html5-repo/files/html5-apps-deployer-configmap.yaml +2 -2
- package/lib/init/template/html5-repo/files/html5-apps-repo-host.yaml +4 -1
- package/lib/init/template/html5-repo/index.js +30 -21
- package/lib/init/template/java/index.js +3 -6
- package/lib/init/template/kibana-logging/index.js +7 -10
- package/lib/init/template/lint/index.js +2 -3
- package/lib/init/template/mta/files/mta.yaml.hbs +4 -2
- package/lib/init/template/mta/index.js +7 -11
- package/lib/init/template/mtx/index.js +0 -5
- package/lib/init/template/multitenancy/files/java/package.json +16 -7
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +11 -3
- package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +9 -0
- package/lib/init/template/multitenancy/files/saas-registry.yaml +4 -17
- package/lib/init/template/multitenancy/files/service-manager.yaml +4 -1
- package/lib/init/template/multitenancy/files/values.yaml.hbs +15 -3
- package/lib/init/template/multitenancy/index.js +56 -31
- package/lib/init/template/nodejs/index.js +4 -7
- package/lib/init/template/notebook/index.js +1 -3
- package/lib/init/template/pipeline/index.js +2 -5
- package/lib/init/template/samples/index.js +6 -11
- package/lib/init/template/templateBase.js +10 -17
- package/lib/init/template/toggles/index.js +2 -6
- package/lib/init/template/xsuaa/files/values.yaml.hbs +0 -1
- package/lib/init/template/xsuaa/files/xsuaa.yaml +4 -1
- package/lib/init/template/xsuaa/index.js +27 -23
- package/lib/init/types.d.ts +0 -81
- package/lib/init/util/merge.js +23 -25
- package/lib/init/util/mvnArchetypeUtil.js +34 -2
- package/lib/init/util/projectReader.js +27 -24
- package/lib/lint/Linter.js +31 -13
- package/lib/watch/livereload-server.js +29 -17
- package/lib/watch/node-watch.js +51 -49
- package/npm-shrinkwrap.json +548 -467
- package/package.json +4 -4
- package/readme.md +5 -0
- package/lib/init/template/connectivity/files/connectivity-binding.yaml +0 -9
- package/lib/init/template/connectivity/files/connectivity.yaml +0 -1
- package/lib/init/template/multitenancy/files/xsuaa.yaml +0 -1
- /package/lib/init/template/hana/files/{chart.yaml → hana-deployer.yaml} +0 -0
- /package/lib/init/template/html5-repo/files/{chart.yaml → html5-apps-deployer.yaml} +0 -0
- /package/lib/init/template/multitenancy/files/{chart.yaml → sidecar.yaml} +0 -0
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
const { join } = require('path');
|
|
2
2
|
const { exists, rimraf } = require('../../../cds').utils;
|
|
3
|
-
const
|
|
3
|
+
const { readProject } = require('../../util/projectReader');
|
|
4
4
|
const { mergeYAML } = require('../../util/merge')
|
|
5
5
|
const { parseMd5File, writeMd5File, copyAndTrack } = require('../../util/md5Tracking')
|
|
6
6
|
//const { yaml } = require('@sap/cds-foss')
|
|
7
7
|
|
|
8
8
|
module.exports = class HelmTemplate extends require('../templateBase') {
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.newTrackingData = {};
|
|
9
|
+
constructor(generator, oldTrackingData = undefined, newTrackingData = {}) {
|
|
10
|
+
super(generator)
|
|
11
|
+
this.oldTrackingData = oldTrackingData;
|
|
12
|
+
this.newTrackingData = newTrackingData;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
static hasFacet(_,
|
|
15
|
+
static hasFacet(_, options) {
|
|
17
16
|
// REVISIT: this works, but could be semantically nicer with a 'shouldRunDependentMerging' or the like
|
|
18
17
|
if (options?.add.has('mta') && !options?.add.has('helm')) return false
|
|
19
|
-
return exists(join(
|
|
18
|
+
return exists(join('chart', 'values.yaml'))
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
async canRun() {
|
|
@@ -27,15 +26,26 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
27
26
|
return true;
|
|
28
27
|
}
|
|
29
28
|
|
|
29
|
+
async addSubChart(subchart) {
|
|
30
|
+
const subchartPath = join(this.projectPath, 'chart', 'charts', subchart);
|
|
31
|
+
if(!exists(subchartPath)) {
|
|
32
|
+
await copyAndTrack(
|
|
33
|
+
join(__dirname, 'subcharts', subchart),
|
|
34
|
+
subchartPath,
|
|
35
|
+
this
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
30
44
|
async run() {
|
|
31
|
-
const projectDescriptor = await
|
|
45
|
+
const projectDescriptor = await readProject(this.options)
|
|
32
46
|
this.oldTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'));
|
|
33
47
|
|
|
34
|
-
await
|
|
35
|
-
join(__dirname, 'subcharts', 'web-application'),
|
|
36
|
-
join(this.projectPath, 'chart', 'charts', 'web-application'),
|
|
37
|
-
this
|
|
38
|
-
)
|
|
48
|
+
await this.addSubChart('web-application');
|
|
39
49
|
await copyAndTrack(
|
|
40
50
|
join(__dirname, 'chart'),
|
|
41
51
|
join(this.projectPath, 'chart'),
|
|
@@ -62,8 +72,8 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
62
72
|
const dependentFacets = ['hana', 'xsuaa', 'auditlog', 'enterprise-messaging', 'destinations' , 'multitenancy', 'extensibility', 'approuter']
|
|
63
73
|
for (const facet of dependentFacets) {
|
|
64
74
|
const Template = require('../'+facet)
|
|
65
|
-
const template = new Template(this.
|
|
66
|
-
if (Template.hasFacet(await this.getEnv(), this.
|
|
75
|
+
const template = new Template(this.generator)
|
|
76
|
+
if (Template.hasFacet(await this.getEnv(), this.options)) await template.runDependentMerging(this)
|
|
67
77
|
}
|
|
68
78
|
}
|
|
69
79
|
};
|
|
@@ -97,7 +97,7 @@ Service Binding secret volumes
|
|
|
97
97
|
{{- end }}
|
|
98
98
|
- name: {{ $name }}-binding
|
|
99
99
|
secret:
|
|
100
|
-
secretName: {{ $secretName }}
|
|
100
|
+
secretName: {{ tpl $secretName $ }}
|
|
101
101
|
{{- end }}
|
|
102
102
|
{{- end }}
|
|
103
103
|
|
|
@@ -131,30 +131,31 @@ Calculate the final image name
|
|
|
131
131
|
{{/*
|
|
132
132
|
Create the name of a service instance.
|
|
133
133
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
134
|
-
If release name contains chart name it will be used as service
|
|
134
|
+
If release name contains chart name it will be used as service instance name.
|
|
135
135
|
*/}}
|
|
136
136
|
{{- define "content-deployment.serviceInstanceName" -}}
|
|
137
|
-
|
|
137
|
+
{{- $name := "" }}
|
|
138
|
+
{{- if .binding.serviceInstanceFullname }}
|
|
138
139
|
{{- if gt (len .binding.serviceInstanceFullname) 63 }}
|
|
139
140
|
{{- fail (printf "name exceeds 63 characters: '%s'" .binding.serviceInstanceFullname) }}
|
|
140
141
|
{{- end }}
|
|
141
|
-
{{- .binding.serviceInstanceFullname }}
|
|
142
|
+
{{- $name = .binding.serviceInstanceFullname }}
|
|
142
143
|
{{- else }}
|
|
143
|
-
{{- $name
|
|
144
|
-
{{- if not (hasPrefix .
|
|
145
|
-
{{- $name = printf "%s-%s" .
|
|
144
|
+
{{- $name = .binding.serviceInstanceName }}
|
|
145
|
+
{{- if not (hasPrefix .root.Release.Name $name)}}
|
|
146
|
+
{{- $name = printf "%s-%s" .root.Release.Name $name }}
|
|
146
147
|
{{- end }}
|
|
147
148
|
{{- if gt (len $name) 63 }}
|
|
148
149
|
{{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
|
|
149
150
|
{{- end }}
|
|
150
|
-
{{- $name }}
|
|
151
151
|
{{- end }}
|
|
152
|
+
{{- tpl $name .root }}
|
|
152
153
|
{{- end }}
|
|
153
154
|
|
|
154
155
|
{{- define "content-deployment.processEnv" -}}
|
|
155
156
|
{{- $result := dict }}
|
|
156
157
|
{{- $variables := list }}
|
|
157
|
-
{{- range $k, $v := . }}
|
|
158
|
+
{{- range $k, $v := .Values.env }}
|
|
158
159
|
{{- $variable := dict }}
|
|
159
160
|
{{- if (kindIs "string" $k) }}
|
|
160
161
|
{{- $_ := set $variable "name" $k -}}
|
|
@@ -174,11 +175,10 @@ If release name contains chart name it will be used as service insatnce name.
|
|
|
174
175
|
{{- $variables = append $variables $variable}}
|
|
175
176
|
{{- end }}
|
|
176
177
|
{{- $_ := set $result "vars" $variables }}
|
|
177
|
-
{{- $result | mustToJson }}
|
|
178
|
+
{{- (fromYaml (tpl (toYaml $result) $)) | mustToJson }}
|
|
178
179
|
{{- end }}
|
|
179
180
|
|
|
180
|
-
{{- define "
|
|
181
|
-
{{- $ := . -}}
|
|
181
|
+
{{- define "content-deployment.processEnvFrom" -}}
|
|
182
182
|
{{- $result := dict }}
|
|
183
183
|
{{- $variables := list }}
|
|
184
184
|
{{- range $secretName := .Values.envSecretNames }}
|
|
@@ -187,21 +187,8 @@ If release name contains chart name it will be used as service insatnce name.
|
|
|
187
187
|
{{- $variables = append $variables (dict "secretRef" $variable)}}
|
|
188
188
|
{{- end }}
|
|
189
189
|
{{- range $envFrom := .Values.envFrom }}
|
|
190
|
-
{{- if hasKey $envFrom "configMapRef" }}
|
|
191
|
-
{{- if and (hasKey $envFrom.configMapRef "tpl") ($envFrom.configMapRef.tpl) }}
|
|
192
|
-
{{- $name := (tpl $envFrom.configMapRef.name $) }}
|
|
193
|
-
{{- $_ := set $envFrom.configMapRef "name" $name }}
|
|
194
|
-
{{- end }}
|
|
195
|
-
{{- $_ := unset $envFrom.configMapRef "tpl" }}
|
|
196
|
-
{{- else }}
|
|
197
|
-
{{- if and (hasKey $envFrom.secretRef "tpl") ($envFrom.secretRef.tpl) }}
|
|
198
|
-
{{- $name := (tpl $envFrom.secretRef.name $) }}
|
|
199
|
-
{{- $_ := set $envFrom.secretRef "name" $name }}
|
|
200
|
-
{{- end }}
|
|
201
|
-
{{- $_ := unset $envFrom.secretRef "tpl" }}
|
|
202
|
-
{{- end }}
|
|
203
190
|
{{- $variables = append $variables $envFrom }}
|
|
204
191
|
{{- end }}
|
|
205
192
|
{{- $_ := set $result "vars" $variables }}
|
|
206
|
-
{{- $result | mustToJson }}
|
|
193
|
+
{{- (fromYaml (tpl (toYaml $result) $)) | mustToJson }}
|
|
207
194
|
{{- end }}
|
|
@@ -21,7 +21,7 @@ spec:
|
|
|
21
21
|
- name: {{ include "content-deployment.imagePullSecretName" . }}
|
|
22
22
|
{{- end }}
|
|
23
23
|
automountServiceAccountToken: false
|
|
24
|
-
serviceAccountName: {{ include "content-deployment.fullname" . }}
|
|
24
|
+
serviceAccountName: {{ tpl (.Values.serviceAccountName | default (include "content-deployment.fullname" .)) $ }}
|
|
25
25
|
containers:
|
|
26
26
|
- image: {{ include "content-deployment.imageName" . }}
|
|
27
27
|
name: {{ include "content-deployment.name" . }}
|
|
@@ -34,12 +34,12 @@ spec:
|
|
|
34
34
|
value: /tmp
|
|
35
35
|
- name: SERVICE_BINDING_ROOT
|
|
36
36
|
value: /bindings
|
|
37
|
-
{{- $envVars := (include "content-deployment.processEnv"
|
|
37
|
+
{{- $envVars := (include "content-deployment.processEnv" $ | fromJson) }}
|
|
38
38
|
{{- if not (eq (len $envVars.vars) 0) }}
|
|
39
39
|
{{- $envVars.vars | toYaml | nindent 8}}
|
|
40
40
|
{{- end }}
|
|
41
41
|
envFrom:
|
|
42
|
-
{{- $envFromVars := (include "
|
|
42
|
+
{{- $envFromVars := (include "content-deployment.processEnvFrom" . | fromJson) }}
|
|
43
43
|
{{- if not (eq (len $envFromVars.vars) 0) }}
|
|
44
44
|
{{- $envFromVars.vars | toYaml | nindent 8}}
|
|
45
45
|
{{- end }}
|
|
@@ -7,19 +7,19 @@ metadata:
|
|
|
7
7
|
name: {{ include "content-deployment.bindingName" (dict "root" $ "name" $name) }}
|
|
8
8
|
labels: {{- include "content-deployment.labels" $ | nindent 4 }}
|
|
9
9
|
spec:
|
|
10
|
-
serviceInstanceName: {{include "content-deployment.serviceInstanceName" (dict "binding" $params "
|
|
10
|
+
serviceInstanceName: {{include "content-deployment.serviceInstanceName" (dict "binding" $params "root" $) }}
|
|
11
11
|
secretKey: credentials
|
|
12
12
|
{{- if $params.externalName }}
|
|
13
13
|
externalName: {{ $params.externalName }}
|
|
14
14
|
{{- end }}
|
|
15
15
|
{{- if $params.secretName }}
|
|
16
|
-
secretName: {{ $params.secretName }}
|
|
16
|
+
secretName: {{ tpl $params.secretName $ }}
|
|
17
17
|
{{- end }}
|
|
18
18
|
{{- if $params.parameters }}
|
|
19
19
|
parameters: {{ $params.parameters | toYaml | nindent 4 }}
|
|
20
20
|
{{- end }}
|
|
21
21
|
{{- if $params.parametersFrom }}
|
|
22
|
-
parametersFrom: {{ $params.parametersFrom | toYaml | nindent 4 }}
|
|
22
|
+
parametersFrom: {{ tpl ($params.parametersFrom | toYaml) $ | nindent 4 }}
|
|
23
23
|
{{- end }}
|
|
24
24
|
{{- if $params.credentialsRotationPolicy }}
|
|
25
25
|
credentialsRotationPolicy: {{ $params.credentialsRotationPolicy | toYaml | nindent 4 }}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Templating Values
|
|
2
|
+
|
|
3
|
+
This functionality is enabled only for some of the templates provided by this helm chart. The feature itself comes with some performance costs that you should keep in mind. More details on this feature can be found in the official [documentation](https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function).
|
|
4
|
+
|
|
5
|
+
The following values can be used in the template:
|
|
6
|
+
|
|
7
|
+
1. [Global values](https://helm.sh/docs/chart_template_guide/subcharts_and_globals/)
|
|
8
|
+
2. Values passed to the chart directly
|
|
9
|
+
3. [Built-in objects](https://helm.sh/docs/chart_template_guide/builtin_objects/)
|
|
10
|
+
|
|
11
|
+
Here's a full list of values with examples, where you can use templates:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
serviceAccountName: my-service-account-{{ .Release.Name }}
|
|
15
|
+
env:
|
|
16
|
+
- name: key1
|
|
17
|
+
value: value1-{{ .Release.Name }}
|
|
18
|
+
- name: key2
|
|
19
|
+
configMapKeyRef:
|
|
20
|
+
name: my-configmap-{{ .Release.Name }}
|
|
21
|
+
key: my-key
|
|
22
|
+
envFrom:
|
|
23
|
+
- configMapRef:
|
|
24
|
+
name: my-configmap1-{{ .Release.Name }}
|
|
25
|
+
- secretRef:
|
|
26
|
+
name: my-secret-ref1-{{ .Release.Name }}
|
|
27
|
+
bindings:
|
|
28
|
+
hana:
|
|
29
|
+
serviceInstanceName: hana-{{ .Release.Name }}
|
|
30
|
+
secretName: hana-secret-{{ .Release.Name }}
|
|
31
|
+
parametersFrom:
|
|
32
|
+
- secretKeyRef:
|
|
33
|
+
key: my-key
|
|
34
|
+
name: test-RELEASE-NAME
|
|
35
|
+
serviceManager:
|
|
36
|
+
fromSecret: manual-secret-{{ .Release.Name }}
|
|
37
|
+
```
|