@sap/cds-dk 6.0.2 → 6.1.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 (105) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/bin/add.js +29 -16
  3. package/bin/cds.js +7 -3
  4. package/bin/compile/index.js +6 -1
  5. package/bin/deploy/index.js +7 -1
  6. package/bin/fix-redirects.js +4 -2
  7. package/bin/init.js +5 -0
  8. package/bin/login.js +8 -2
  9. package/bin/pull.js +58 -0
  10. package/bin/push.js +52 -0
  11. package/bin/subscribe.js +45 -0
  12. package/lib/bind/bindingResolver.js +1 -2
  13. package/lib/bind/bindingUtil.js +1 -2
  14. package/lib/bind/cfKeyProvider.js +3 -3
  15. package/lib/client/activate.js +1 -1
  16. package/lib/client/auth_manager.js +7 -3
  17. package/lib/client/extend.js +1 -1
  18. package/lib/client/helper/cf_helper.js +1 -0
  19. package/lib/client/helper/url_helper.js +7 -3
  20. package/lib/client/index.js +1 -1
  21. package/lib/client/params.js +4 -2
  22. package/lib/client/pull.js +51 -0
  23. package/lib/client/push.js +49 -0
  24. package/lib/client/settings_manager.js +74 -21
  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 +0 -1
  30. package/lib/import/odata/v4parser.js +103 -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 +290 -0
  34. package/lib/init/template/approuter/index.js +22 -32
  35. package/lib/init/template/auditlog/index.js +7 -9
  36. package/lib/init/template/extensibility/files/cds.package.json +7 -0
  37. package/lib/init/template/extensibility/files/cds.package.json.hbs +9 -0
  38. package/lib/init/template/extensibility/files/xs-security.json.hbs +26 -0
  39. package/lib/init/template/extensibility/index.js +48 -0
  40. package/lib/init/template/hana/files/java/cdsrc.json.hbs +1 -1
  41. package/lib/init/template/hana/files/java/profile.cdsrc.json.hbs +2 -2
  42. package/lib/init/template/hana/files/mta.yaml.hbs +10 -0
  43. package/lib/init/template/hana/files/nodejs/cds.package.json.hbs +1 -1
  44. package/lib/init/template/hana/files/nodejs/cds.profile.package.json.hbs +2 -2
  45. package/lib/init/template/hana/index.js +76 -63
  46. package/lib/init/template/kibana-logging/index.js +31 -37
  47. package/lib/init/template/lint/files/.eslint/rules/no-entity-moo.js +14 -14
  48. package/lib/init/template/lint/index.js +1 -1
  49. package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
  50. package/lib/init/template/mta/index.js +13 -7
  51. package/lib/init/template/mtx/index.js +2 -142
  52. package/lib/init/template/multitenancy/files/cds.package.json +7 -0
  53. package/lib/init/template/multitenancy/files/cds.package.json.hbs +9 -0
  54. package/lib/init/template/{mtx → multitenancy}/files/dependencies.package.json +1 -1
  55. package/lib/init/template/multitenancy/files/java/.cdsrc.json +19 -0
  56. package/lib/init/template/multitenancy/files/java/package.json +31 -0
  57. package/lib/init/template/{mtx → multitenancy}/files/mta.yaml.hbs +13 -6
  58. package/lib/init/template/multitenancy/files/xs-security.json.hbs +18 -0
  59. package/lib/init/template/multitenancy/index.js +109 -0
  60. package/lib/init/template/nodejs/files/package.json.hbs +3 -0
  61. package/lib/init/template/templateBase.js +4 -3
  62. package/lib/init/template/toggles/files/cds.package.json +7 -0
  63. package/lib/init/template/toggles/files/cds.package.json.hbs +9 -0
  64. package/lib/init/template/toggles/index.js +24 -0
  65. package/lib/init/template/xsuaa/files/mta.yaml.hbs +10 -0
  66. package/lib/init/template/xsuaa/index.js +44 -33
  67. package/lib/init/util/projectReader.js +13 -8
  68. package/lib/init/util/templateUtil.js +112 -110
  69. package/lib/k8s/ChartAdder.js +11 -3
  70. package/lib/k8s/ChartBuilder.js +6 -0
  71. package/lib/k8s/buildModel.js +1 -3
  72. package/lib/k8s/connectivity/index.js +11 -5
  73. package/lib/k8s/connectivity/templates/connectivity-proxy-info.yaml +7 -3
  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/templates/_deployment_helpers.tpl +1 -159
  89. package/lib/k8s/resources/helm/chart/templates/_helpers.tpl +0 -33
  90. package/lib/k8s/resources/helm/chart/templates/_sapcp_helpers.tpl +1 -1
  91. package/lib/k8s/resources/helm/chart/values.schema.json +449 -0
  92. package/lib/k8s/xsuaa/lib.js +10 -7
  93. package/lib/lint/Linter.js +155 -158
  94. package/lib/lint/generators.js +1 -1
  95. package/lib/lint/io.js +13 -5
  96. package/npm-shrinkwrap.json +1053 -136
  97. package/package.json +5 -4
  98. package/lib/init/template/_merging/existences.js +0 -297
  99. package/lib/init/template/mtx/files/cds.package.json +0 -12
  100. package/lib/init/template/mtx/files/cds.package.json.hbs +0 -14
  101. package/lib/init/template/mtx/files/java/.cdsrc.json +0 -17
  102. package/lib/init/template/mtx/files/java/package.json +0 -43
  103. package/lib/init/template/mtx/files/java/server.js +0 -30
  104. package/lib/init/template/mtx/files/xs-security.json.hbs +0 -48
  105. package/lib/lint/.eslintrc.js +0 -3
@@ -1,14 +1,5 @@
1
1
  {{/*
2
- Generate VCAP_APPLICATION
3
- */}}
4
- {{- define "cap.vcapApplication" -}}
5
- {{- $deploymentHost := include "cap.deploymentHost" . -}}
6
- {{- $VCAP_APPLICATION := dict "application_uris" (list (print $deploymentHost "." .Values.global.domain)) }}
7
- {{- $VCAP_APPLICATION | toJson }}
8
- {{- end -}}
9
-
10
- {{/*
11
- Add custom env variables
2
+ Add custom env variables
12
3
  */}}
13
4
  {{- define "cap.env" -}}
14
5
  {{- if . -}}
@@ -19,155 +10,6 @@ Add custom env variables
19
10
  {{- end -}}
20
11
  {{- end -}}
21
12
 
22
- {{- define "cap.bindingsVolumes" -}}
23
- {{- if $.Values.newBindings -}}
24
- {{- include "cap.newBindingsVolumes" $ }}
25
- {{- else -}}
26
- {{- include "cap.oldBindingsVolumes" $ }}
27
- {{- end -}}
28
- {{- end -}}
29
-
30
- {{/*
31
- Old Service Bindings: volumes
32
- */}}
33
- {{- define "cap.oldBindingsVolumes" -}}
34
- {{- $ := . -}}
35
- {{ range $bindingName, $binding := .deployment.bindings -}}
36
- {{- $secret := include "cap.bindingSecretName" (dict "Release" $.Release "name" $.name "bindingName" $bindingName "binding" $binding) }}
37
- - name: {{ $bindingName }}-secret
38
- secret:
39
- secretName: {{ $secret | quote }}
40
- {{- if and (eq $bindingName "db") $.deployment.multitenancy }}
41
- # the "plan" property must not be in the secret for the service manager
42
- # it would be used as plan for HANA
43
- items:
44
- - key: clientid
45
- path: clientid
46
- - key: clientsecret
47
- path: clientsecret
48
- - key: sm_url
49
- path: sm_url
50
- - key: url
51
- path: url
52
- - key: xsappname
53
- path: xsappname
54
- {{- end -}}
55
- {{- if eq $.deployment.language "Node" }}
56
- - name: {{ $bindingName }}-metadata
57
- secret:
58
- secretName: {{ $secret | quote }}
59
- optional: true
60
- items:
61
- - key: label
62
- path: label
63
- - key: plan
64
- path: plan
65
- - key: tags
66
- path: tags
67
- {{- end -}}
68
- {{- end -}}
69
- {{- end -}}
70
-
71
- {{/*
72
- New Service Bindings: volumes
73
- */}}
74
- {{- define "cap.newBindingsVolumes" -}}
75
- {{- $ := . -}}
76
- {{ range $bindingName, $binding := .deployment.bindings -}}
77
- {{- $secret := include "cap.bindingSecretName" (dict "Release" $.Release "name" $.name "bindingName" $bindingName "binding" $binding) }}
78
- - name: {{ $bindingName }}-secret
79
- secret:
80
- secretName: {{ $secret | quote }}
81
- {{- end -}}
82
- {{- end -}}
83
-
84
-
85
- {{- define "cap.bindingsEnv" -}}
86
- {{- if $.Values.newBindings -}}
87
- {{- include "cap.newBindingsEnv" $ }}
88
- {{- else -}}
89
- {{- include "cap.oldBindingsEnv" $ }}
90
- {{- end -}}
91
- {{- end -}}
92
-
93
- {{/*
94
- Old Service Bindings: env vars
95
- */}}
96
- {{- define "cap.oldBindingsEnv" }}
97
- {{- $ := . }}
98
- {{- if eq .deployment.language "Java" }}
99
- {{- range $key, $binding := .deployment.bindings }}
100
- {{- $cleanKey := $key | upper | replace "-" "" | replace "_" "" | replace "." "" }}
101
- {{- $prefix := print "CDS_ENVIRONMENT_K8S_SERVICEBINDINGS_" $cleanKey }}
102
- {{- $secret := default (print $.Release.Name "-" $.name "-" $key) $binding.secret }}
103
- - name: {{ $prefix }}_SERVICE
104
- valueFrom:
105
- secretKeyRef:
106
- name: {{ $secret | quote }}
107
- key: label
108
- - name: {{ $prefix }}_PLAN
109
- valueFrom:
110
- secretKeyRef:
111
- name: {{ $secret | quote }}
112
- key: plan
113
- optional: true
114
- - name: {{ $prefix }}_SECRETSPATH
115
- value: /etc/secrets/cds/requires/{{ $key }}/credentials
116
- {{- end }}
117
- {{- else }}
118
- {{- /* Read credentials from file system */ -}}
119
- - name: CDS_CONFIG
120
- value: /etc/secrets/cds
121
- {{ end }}
122
- {{- end }}
123
-
124
- {{/*
125
- New Service Bindings: env vars
126
- */}}
127
- {{- define "cap.newBindingsEnv" }}
128
- - name: SERVICE_BINDING_ROOT
129
- value: /bindings
130
- {{- end }}
131
-
132
-
133
- {{- define "cap.bindingsVolumeMounts" -}}
134
- {{- if $.Values.newBindings -}}
135
- {{- include "cap.newBindingsVolumeMounts" $ }}
136
- {{- else -}}
137
- {{- include "cap.oldBindingsVolumeMounts" $ }}
138
- {{- end -}}
139
- {{- end -}}
140
-
141
- {{/*
142
- Old Service Bindings: volume mounts
143
- */}}
144
- {{- define "cap.oldBindingsVolumeMounts" }}
145
- {{- $ := . -}}
146
- {{- range $key, $binding := .deployment.bindings }}
147
- - name: {{ $key }}-secret
148
- mountPath: /etc/secrets/cds/requires/{{ $key }}/credentials
149
- readOnly: true
150
- {{- if eq $.deployment.language "Node" }}
151
- - name: {{ $key }}-metadata
152
- mountPath: /etc/secrets/cds/requires/{{ $key }}/vcap
153
- readOnly: true
154
- {{- end }}
155
- {{- end }}
156
- {{- end }}
157
-
158
- {{/*
159
- New Service Bindings: volume mounts
160
- */}}
161
- {{- define "cap.newBindingsVolumeMounts" }}
162
- {{- $ := . -}}
163
- {{- range $key, $binding := .deployment.bindings }}
164
- - name: {{ $key }}-secret
165
- mountPath: /bindings/{{ $key }}
166
- readOnly: true
167
- {{- end }}
168
- {{- end }}
169
-
170
-
171
13
  {{/*
172
14
  Get list of deployment names
173
15
  */}}
@@ -45,14 +45,6 @@ app.kubernetes.io/instance: {{ .Release.Name }}
45
45
  {{/*
46
46
  Image
47
47
  */}}
48
- {{- define "cap.image.srv" -}}
49
- {{- if .Values.srv.image.tag -}}
50
- {{ .Values.srv.image.repository }}:{{ .Values.srv.image.tag }}
51
- {{- else -}}
52
- {{ .Values.srv.image.repository }}
53
- {{- end -}}
54
- {{- end -}}
55
-
56
48
  {{- define "cap.image" -}}
57
49
  {{- if .image.tag -}}
58
50
  {{ .image.repository }}:{{ .image.tag }}
@@ -64,14 +56,6 @@ Image
64
56
  {{/*
65
57
  Image Pull Policy
66
58
  */}}
67
- {{- define "cap.imagePullPolicy.srv" -}}
68
- {{- if and (.Values.srv.image.tag) (ne .Values.srv.image.tag "latest") -}}
69
- IfNotPresent
70
- {{- else -}}
71
- Always
72
- {{- end -}}
73
- {{- end -}}
74
-
75
59
  {{- define "cap.imagePullPolicy" -}}
76
60
  {{- if and (.image.tag) (ne .image.tag "latest") -}}
77
61
  IfNotPresent
@@ -90,23 +74,6 @@ imagePullSecrets:
90
74
  {{- end -}}
91
75
  {{- end -}}
92
76
 
93
-
94
- {{/*
95
- Binding
96
- */}}
97
- {{- define "cap.binding" -}}
98
- apiVersion: services.cloud.sap.com/v1alpha1
99
- kind: ServiceBinding
100
- metadata:
101
- name: {{ include "cap.bindingSecretName" $ | quote }}
102
- namespace: {{ $.Release.Namespace }}
103
- labels: {{- include "cap.labels" $ | nindent 4 }}
104
- spec:
105
- serviceInstanceName: {{ $.Release.Name }}-{{ $.binding.service }}
106
- externalName: {{ include "cap.bindingSecretName" $ | quote }}
107
- secretName: {{ include "cap.bindingSecretName" $ | quote }}
108
- {{- end -}}
109
-
110
77
  {{/*
111
78
  Service Instance NEW
112
79
  ternary dict ($.Files.Get $.service.config | fromJson)
@@ -6,7 +6,7 @@ SAPCP Service Bindings: volume mounts
6
6
  {{- $ := . -}}
7
7
  {{- range $key, $binding := .bindings }}
8
8
  - name: {{ $key | replace "_" "-" }}-secret
9
- mountPath: /etc/secrets/sapcp/{{ $key | replace "_" "-" }}/{{ $key }}
9
+ mountPath: /bindings/{{ $key }}
10
10
  readOnly: true
11
11
  {{- end }}
12
12
  {{- end }}