@sap/cds-dk 7.3.0 → 7.3.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 (88) hide show
  1. package/bin/add.js +3 -1
  2. package/bin/build.js +2 -1
  3. package/bin/cds.js +1 -1
  4. package/bin/compile/index.js +11 -0
  5. package/bin/extend.js +5 -1
  6. package/bin/init.js +31 -37
  7. package/bin/repl.js +23 -43
  8. package/bin/watch.js +5 -9
  9. package/lib/bind/bindingResolver.js +2 -1
  10. package/lib/bind/index.js +1 -1
  11. package/lib/build/buildPlugin.js +18 -3
  12. package/lib/build/buildTaskEngine.js +2 -1
  13. package/lib/build/buildTaskFactory.js +33 -9
  14. package/lib/build/buildTaskProvider.js +1 -1
  15. package/lib/build/buildTaskProviderFactory.js +15 -61
  16. package/lib/build/constants.js +2 -0
  17. package/lib/build/index.js +5 -2
  18. package/lib/build/plugins.js +35 -0
  19. package/lib/build/provider/edmxBuildPlugin.js +9 -1
  20. package/lib/build/provider/featureToggleBuildPlugin.js +2 -3
  21. package/lib/build/provider/internalBuildPlugin.js +4 -0
  22. package/lib/build/provider/internalBuildTaskProvider.js +1 -1
  23. package/lib/build/provider/java/index.js +12 -6
  24. package/lib/build/provider/nodejs/index.js +3 -2
  25. package/lib/build/util.js +5 -0
  26. package/lib/client/base_command.js +8 -18
  27. package/lib/client/download_legacy.js +2 -10
  28. package/lib/client/params.js +6 -4
  29. package/lib/client/settings_manager.js +38 -35
  30. package/lib/compile/openapi/csdl2openapi.js +1 -1
  31. package/lib/deploy/to-hana/hana.js +53 -35
  32. package/lib/index.js +7 -1
  33. package/lib/init/constants.js +4 -2
  34. package/lib/init/template/_merging/registry-mta.js +12 -0
  35. package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +1 -1
  36. package/lib/init/template/enterprise-messaging/index.js +1 -1
  37. package/lib/init/template/enterprise-messaging-shared/files/event-mesh.json.hbs +1 -1
  38. package/lib/init/template/enterprise-messaging-shared/index.js +19 -5
  39. package/lib/init/template/helm/index.js +1 -1
  40. package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +4 -4
  41. package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +4 -2
  42. package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +4 -3
  43. package/lib/init/template/helm/subcharts/content-deployment/values.schema.json +9 -83
  44. package/lib/init/template/helm/subcharts/content-deployment/values.yaml +54 -15
  45. package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +4 -4
  46. package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +1 -1
  47. package/lib/init/template/helm/subcharts/service-instance/values.schema.json +0 -17
  48. package/lib/init/template/helm/subcharts/service-instance/values.yaml +28 -0
  49. package/lib/init/template/helm/subcharts/web-application/Chart.yaml +5 -5
  50. package/lib/init/template/helm/subcharts/web-application/templates/_api.tpl +60 -0
  51. package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +34 -73
  52. package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +4 -4
  53. package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +96 -17
  54. package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +19 -3
  55. package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +3 -3
  56. package/lib/init/template/helm/subcharts/web-application/templates/rbac.yaml +26 -0
  57. package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +1 -1
  58. package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +1 -1
  59. package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +1 -1
  60. package/lib/init/template/helm/subcharts/web-application/templates/service.yaml +21 -3
  61. package/lib/init/template/helm/subcharts/web-application/templates/virtual-service.yaml +36 -0
  62. package/lib/init/template/helm/subcharts/web-application/values.schema.json +535 -142
  63. package/lib/init/template/helm/subcharts/web-application/values.yaml +168 -44
  64. package/lib/init/template/local-messaging/files/package.json.hbs +15 -0
  65. package/lib/init/template/local-messaging/index.js +25 -0
  66. package/lib/init/template/mta/index.js +2 -2
  67. package/lib/init/template/nodejs/files/.gitignore.hbs +3 -0
  68. package/lib/init/template/nodejs/files/.vscode/launch.json +0 -3
  69. package/lib/init/template/notifications/files/mta.yaml.hbs +17 -0
  70. package/lib/init/template/notifications/files/package.json.hbs +5 -0
  71. package/lib/init/template/notifications/index.js +43 -0
  72. package/lib/init/template/typer/files/package.json +1 -1
  73. package/lib/init/util/projectReader.js +1 -0
  74. package/lib/util/pruneAxiosErrors.js +4 -1
  75. package/lib/util/term.js +1 -2
  76. package/lib/watch/livereload-server.js +38 -2
  77. package/lib/watch/node-watch.js +3 -2
  78. package/npm-shrinkwrap.json +438 -2205
  79. package/package.json +2 -2
  80. package/lib/init/template/helm/subcharts/content-deployment/templating.md +0 -37
  81. package/lib/init/template/helm/subcharts/content-deployment/values-lint.yaml +0 -5
  82. package/lib/init/template/helm/subcharts/content-deployment/values.md +0 -1011
  83. package/lib/init/template/helm/subcharts/service-instance/templating.md +0 -18
  84. package/lib/init/template/helm/subcharts/service-instance/values-lint.yaml +0 -2
  85. package/lib/init/template/helm/subcharts/service-instance/values.md +0 -186
  86. package/lib/init/template/helm/subcharts/web-application/templating.md +0 -51
  87. package/lib/init/template/helm/subcharts/web-application/values-lint.yaml +0 -8
  88. package/lib/init/template/helm/subcharts/web-application/values.md +0 -1363
@@ -1,7 +1,7 @@
1
1
  apiVersion: v2
2
- name: service-instance
3
2
  description: A Helm chart for creating service instances on btp-service-operator
4
- type: application
5
- version: 0.1.0
3
+ name: service-instance
6
4
  sources:
7
- - "https://github.tools.sap/unified-runtime/service-instance"
5
+ - https://github.tools.sap/unified-runtime/service-instance
6
+ type: application
7
+ version: 1.1.1
@@ -16,7 +16,7 @@ spec:
16
16
  {{- if or .Values.parameters .Values.jsonParameters }}
17
17
  {{- $parameters := .Values.parameters | default (dict) }}
18
18
  {{- $jsonParameters := .Values.jsonParameters | default "{}" }}
19
- parameters: {{- $jsonParameters | fromJson | merge $parameters | toYaml | nindent 4 }}
19
+ parameters: {{- tpl ($jsonParameters | fromJson | merge $parameters | toYaml) $ | nindent 4 }}
20
20
  {{- end }}
21
21
  {{- if .Values.parametersFrom }}
22
22
  parametersFrom: {{ tpl (.Values.parametersFrom | toYaml) $ | nindent 4}}
@@ -11,45 +11,35 @@
11
11
  "global": {
12
12
  "$id": "#/properties/global",
13
13
  "type": "object",
14
- "title": "Helm global values",
15
- "description": "For more information, see https://helm.sh/docs/chart_template_guide/subcharts_and_globals/#global-chart-values",
16
14
  "x-ignore-untested": true
17
15
  },
18
16
  "nameOverride": {
19
17
  "$id": "#/properties/nameOverride",
20
- "title": "Chart name override",
21
- "description": "Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.",
22
18
  "type": "string",
23
19
  "pattern": "[0-9a-z][0-9a-z-.]*"
24
20
  },
25
21
  "fullnameOverride": {
26
22
  "$id": "#/properties/fullnameOverride",
27
- "title": "Override for the `.fullname` helper function.",
28
- "description": "Will be used as an override for the `.fullname` helper function (i.e. `.Release.Name-.Chart.Name`).",
29
23
  "type": "string",
30
24
  "pattern": "[0-9a-z][0-9a-z-.]*"
31
25
  },
32
26
  "serviceOfferingName": {
33
27
  "$id": "#/properties/serviceOfferingName",
34
- "description": "The name of the SAP BTP service offering.",
35
28
  "type": "string",
36
29
  "pattern": "[0-9a-z][0-9a-z-.]*"
37
30
  },
38
31
  "servicePlanName": {
39
32
  "$id": "#/properties/servicePlanName",
40
- "description": "The plan to use for the service instance.",
41
33
  "type": "string",
42
34
  "pattern": "[0-9a-z][0-9a-z-.]*"
43
35
  },
44
36
  "externalName": {
45
37
  "$id": "#/properties/externalName",
46
- "description": "The name for the service instance in SAP BTP.",
47
38
  "type": "string",
48
39
  "pattern": "[0-9a-z][0-9a-z-.]*"
49
40
  },
50
41
  "customTags": {
51
42
  "$id": "#/properties/customTags",
52
- "description": "List of custom tags describing the ServiceInstance, will be copied to `ServiceBinding` secret in the key called `tags`.",
53
43
  "type": "array",
54
44
  "uniqueItems": true,
55
45
  "items": {
@@ -58,27 +48,22 @@
58
48
  },
59
49
  "parameters": {
60
50
  "$id": "#/properties/parameters",
61
- "description": "Some services support the provisioning of additional configuration parameters. For the list of supported parameters, check the documentation of the particular service offering.",
62
51
  "type": "object"
63
52
  },
64
53
  "jsonParameters": {
65
54
  "$id": "#/properties/jsonParameters",
66
- "description": "Some services support the provisioning of additional configuration parameters. For the list of supported parameters, check the documentation of the particular service offering.",
67
55
  "type": "string"
68
56
  },
69
57
  "parametersFrom": {
70
58
  "$id": "#/properties/parametersFrom",
71
- "description": "List of sources to populate parameters.",
72
59
  "type": "array",
73
60
  "uniqueItems": true,
74
61
  "items": {
75
62
  "type": "object",
76
- "description": "Kubernetes Secret as a parameters source.",
77
63
  "additionalProperties": false,
78
64
  "properties": {
79
65
  "secretKeyRef": {
80
66
  "type": "object",
81
- "description": "Kubernetes Secret as a parameters source.",
82
67
  "additionalProperties": false,
83
68
  "required": [
84
69
  "name",
@@ -86,11 +71,9 @@
86
71
  ],
87
72
  "properties": {
88
73
  "name": {
89
- "description": "Name of a Secret.",
90
74
  "type": "string"
91
75
  },
92
76
  "key": {
93
- "description": "Key in that Secret, which contains a string that represents the json to include in the set of parameters to be sent to the broker.",
94
77
  "type": "string"
95
78
  }
96
79
  }
@@ -1,15 +1,43 @@
1
+ # Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.
2
+ # nameOverride: foo
3
+
4
+ # Will be used as an override for the `.fullname` helper function (i.e. `.Release.Name-.Chart.Name`).
5
+ # fullnameOverride: foo
6
+
7
+ # The name of the SAP BTP service offering.
1
8
  # serviceOfferingName: feature-flags
9
+
10
+ # The plan to use for the service instance.
2
11
  # servicePlanName: plan-name
12
+
13
+ # The name for the service instance in SAP BTP.
3
14
  # externalName: feature-flags-test
15
+
16
+ # List of custom tags describing the ServiceInstance, will be copied to `ServiceBinding` secret in the key called `tags`.
4
17
  # customTags:
5
18
  # - foo
6
19
  # - bar
20
+
21
+ # Some services support the provisioning of additional configuration parameters. For the list of supported parameters, check the documentation of the particular service offering.
7
22
  # parameters:
8
23
  # key: val
24
+
25
+ # Some services support the provisioning of additional configuration parameters. For the list of supported parameters, check the documentation of the particular service offering.
26
+ # jsonParameters: {}
27
+
28
+ # Kubernetes Secret as a parameters source.
9
29
  # parametersFrom:
30
+ # https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#define-container-environment-variables-using-secret-data
10
31
  # - secretKeyRef:
11
32
  # name: my-secret
12
33
  # key: secret-parameter
34
+ # https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#define-container-environment-variables-using-configmap-data
13
35
  # - configMapKeyRef:
14
36
  # name: my-cm
15
37
  # key: cm-parameter
38
+ global:
39
+ sap:
40
+ _internal:
41
+ service-instance:
42
+ versions:
43
+ 1.1.1: true
@@ -1,8 +1,8 @@
1
1
  apiVersion: v2
2
- name: web-application
3
2
  description: A Helm chart for web app
4
- kubeVersion: ">= 1.21"
5
- type: application
6
- version: 0.1.0
3
+ kubeVersion: '>= 1.21'
4
+ name: web-application
7
5
  sources:
8
- - "https://github.tools.sap/unified-runtime/web-application"
6
+ - https://github.tools.sap/unified-runtime/web-application
7
+ type: application
8
+ version: 1.8.0
@@ -0,0 +1,60 @@
1
+ {{/*
2
+ Expand the name of the chart.
3
+ */}}
4
+ {{- define "web-application.name" -}}
5
+ {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6
+ {{- end }}
7
+
8
+ {{/*
9
+ Create a default fully qualified app name.
10
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11
+ If release name contains chart name it will be used as a full name.
12
+ */}}
13
+ {{- define "web-application.fullname" -}}
14
+ {{- if .Values.fullnameOverride }}
15
+ {{- if gt (len .Values.fullnameOverride) 63 }}
16
+ {{- fail (printf "name exceeds 63 characters: '%s'" .Values.fullnameOverride) }}
17
+ {{- end }}
18
+ {{- .Values.fullnameOverride }}
19
+ {{- else }}
20
+ {{- $name := default .Chart.Name .Values.nameOverride }}
21
+ {{- if not (eq .Release.Name $name)}}
22
+ {{- $name = printf "%s-%s" .Release.Name $name }}
23
+ {{- end }}
24
+ {{- if gt (len $name) 63 }}
25
+ {{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
26
+ {{- end }}
27
+ {{- $name }}
28
+ {{- end }}
29
+ {{- end }}
30
+
31
+ {{/*
32
+ Common labels
33
+ */}}
34
+ {{- define "web-application.labels" -}}
35
+ helm.sh/revision: {{ .Release.Revision | quote }}
36
+ helm.sh/chart: {{ include "web-application.internal.chart" . }}
37
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
38
+ {{ include "web-application.selectorLabels" . }}
39
+ {{- if .Chart.AppVersion }}
40
+ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41
+ {{- end }}
42
+ {{- end }}
43
+
44
+ {{/*
45
+ Selector labels
46
+ */}}
47
+ {{- define "web-application.selectorLabels" -}}
48
+ app.kubernetes.io/name: {{ include "web-application.name" . }}
49
+ app.kubernetes.io/instance: {{ .Release.Name }}
50
+ {{- if .Values.global}}
51
+ {{- if .Values.global.component }}
52
+ app.kubernetes.io/component:{{ .Values.global.component }}
53
+ {{- end }}
54
+ {{- if .Values.global.partOf }}
55
+ app.kubernetes.io/partOf: {{ .Values.global.partOf }}
56
+ {{- end }}
57
+ {{- end }}
58
+ {{- end }}
59
+
60
+
@@ -1,37 +1,9 @@
1
- {{/*
2
- Expand the name of the chart.
3
- */}}
4
- {{- define "web-application.internal.name" -}}
5
- {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6
- {{- end }}
7
1
 
8
- {{/*
9
- Create a default fully qualified app name.
10
- We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11
- If release name contains chart name it will be used as a full name.
12
- */}}
13
- {{- define "web-application.internal.fullname" -}}
14
- {{- if .Values.fullnameOverride }}
15
- {{- if gt (len .Values.fullnameOverride) 63 }}
16
- {{- fail (printf "name exceeds 63 characters: '%s'" .Values.fullnameOverride) }}
17
- {{- end }}
18
- {{- .Values.fullnameOverride }}
19
- {{- else }}
20
- {{- $name := default .Chart.Name .Values.nameOverride }}
21
- {{- if not (eq .Release.Name $name)}}
22
- {{- $name = printf "%s-%s" .Release.Name $name }}
23
- {{- end }}
24
- {{- if gt (len $name) 63 }}
25
- {{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
26
- {{- end }}
27
- {{- $name }}
28
- {{- end }}
29
- {{- end }}
30
2
 
31
3
  {{/*
32
4
  */}}
33
5
  {{- define "web-application.internal.bindingName" -}}
34
- {{- printf "%s-%s" (include "web-application.internal.fullname" .root ) .name }}
6
+ {{- printf "%s-%s" (include "web-application.fullname" .root ) .name }}
35
7
  {{- end }}
36
8
 
37
9
  {{/*
@@ -41,35 +13,6 @@ Create chart name and version as used by the chart label.
41
13
  {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
42
14
  {{- end }}
43
15
 
44
- {{/*
45
- Common labels
46
- */}}
47
- {{- define "web-application.internal.labels" -}}
48
- helm.sh/revision: {{ .Release.Revision | quote }}
49
- helm.sh/chart: {{ include "web-application.internal.chart" . }}
50
- app.kubernetes.io/managed-by: {{ .Release.Service }}
51
- {{ include "web-application.internal.selectorLabels" . }}
52
- {{- if .Chart.AppVersion }}
53
- app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
54
- {{- end }}
55
- {{- end }}
56
-
57
- {{/*
58
- Selector labels
59
- */}}
60
- {{- define "web-application.internal.selectorLabels" -}}
61
- app.kubernetes.io/name: {{ include "web-application.internal.name" . }}
62
- app.kubernetes.io/instance: {{ .Release.Name }}
63
- {{- if .Values.global}}
64
- {{- if .Values.global.component }}
65
- app.kubernetes.io/component:{{ .Values.global.component }}
66
- {{- end }}
67
- {{- if .Values.global.partOf }}
68
- app.kubernetes.io/partOf: {{ .Values.global.partOf }}
69
- {{- end }}
70
- {{- end }}
71
- {{- end }}
72
-
73
16
  {{/*
74
17
  Define Host for the APIRule
75
18
  */}}
@@ -77,7 +20,7 @@ Define Host for the APIRule
77
20
  {{- if .Values.expose.host }}
78
21
  {{- tpl .Values.expose.host . }}
79
22
  {{- else }}
80
- {{- $name := (include "web-application.internal.fullname" .) }}
23
+ {{- $name := (include "web-application.fullname" .) }}
81
24
  {{- if hasPrefix $name .Release.Namespace }}
82
25
  {{- .Release.Namespace }}
83
26
  {{- else }}
@@ -87,10 +30,29 @@ Define Host for the APIRule
87
30
  {{- end }}
88
31
 
89
32
  {{/*
90
- Define the application uri which will be used for the VCAP_APPLICATION env variable
33
+ Returns the TENANT_HOST_PATTERN if defined
34
+ */}}
35
+ {{- define "web-application.internal.TENANT_HOST_PATTERN" -}}
36
+ {{- if .Values.env }}
37
+ {{- if (kindIs "map" .Values.env) }}
38
+ {{- if (hasKey .Values.env "TENANT_HOST_PATTERN") }}
39
+ {{- .Values.env.TENANT_HOST_PATTERN }}
40
+ {{- end }}
41
+ {{- else }}
42
+ {{- range $i, $item := .Values.env }}
43
+ {{- if eq $item.name "TENANT_HOST_PATTERN"}}
44
+ {{- $item.value }}
45
+ {{- end }}
46
+ {{- end }}
47
+ {{- end }}
48
+ {{- end }}
49
+ {{- end }}
50
+
51
+ {{/*
52
+ Define the application uri to be used for the VCAP_APPLICATION env variable
91
53
  */}}
92
54
  {{- define "web-application.internal.applicationUri" -}}
93
- {{- include "web-application.internal.fullname" . }}
55
+ {{- include "web-application.fullname" . }}
94
56
  {{- end }}
95
57
 
96
58
  {{/*
@@ -133,7 +95,9 @@ Name of the imagePullSecret
133
95
  {{- else if $ips.global.name }}
134
96
  {{- $ips.global.name }}
135
97
  {{- else if or $ips.local.dockerconfigjson $ips.global.dockerconfigjson }}
136
- {{- include "web-application.internal.fullname" . }}
98
+ {{- include "web-application.fullname" . }}
99
+ {{- else }}
100
+ {{- "image-pull-secret" }}
137
101
  {{- end }}
138
102
  {{- end }}
139
103
 
@@ -141,12 +105,12 @@ Name of the imagePullSecret
141
105
  Calculate the final image name
142
106
  */}}
143
107
  {{- define "web-application.internal.imageName" -}}
144
- {{- $tag := .Values.image.tag | default .Values.global.image.tag | default "latest" }}
145
- {{- $registry := .Values.image.registry | default .Values.global.image.registry }}
108
+ {{- $tag := .image.tag | default .context.Values.global.image.tag | default "latest" }}
109
+ {{- $registry := .image.registry | default .context.Values.global.image.registry }}
146
110
  {{- if $registry }}
147
- {{- $registry | trimSuffix "/" }}/{{ .Values.image.repository }}:{{ $tag }}
111
+ {{- $registry | trimSuffix "/" | trimPrefix "https://" }}/{{ .image.repository | trimSuffix "/" }}:{{ $tag }}
148
112
  {{- else }}
149
- {{- .Values.image.repository }}:{{ $tag }}
113
+ {{- .image.repository | trimSuffix "/" | trimPrefix "https://" }}:{{ $tag }}
150
114
  {{- end }}
151
115
  {{- end }}
152
116
 
@@ -177,18 +141,15 @@ If release name contains chart name it will be used as service instance name.
177
141
  {{- define "web-application.internal.processEnv" -}}
178
142
  {{- $result := dict }}
179
143
  {{- $variables := list }}
180
- {{- range $k, $v := .Values.env }}
144
+ {{- range $k, $v := .env }}
181
145
  {{- $variable := dict }}
182
146
  {{/*
183
147
  We support two versions to provide environment variables: as an array and as a map
184
-
185
148
  env:
186
149
  - name: TEST
187
150
  value: X
188
-
189
151
  env:
190
152
  TEST: X
191
-
192
153
  Transform the map case into the array case:
193
154
  */}}
194
155
  {{- if (not (kindIs "map" $v)) }}
@@ -216,15 +177,15 @@ If release name contains chart name it will be used as service instance name.
216
177
  {{- $variables = append $variables $variable}}
217
178
  {{- end }}
218
179
  {{- $_ := set $result "vars" $variables }}
219
- {{- (fromYaml (tpl (toYaml $result) $)) | mustToJson }}
180
+ {{- (fromYaml (tpl (toYaml $result) .context)) | mustToJson }}
220
181
  {{- end }}
221
182
 
222
183
  {{- define "web-application.internal.processEnvFrom" -}}
223
184
  {{- $result := dict }}
224
185
  {{- $variables := list }}
225
- {{- range $envFrom := .Values.envFrom }}
186
+ {{- range $envFrom := .envFrom }}
226
187
  {{- $variables = append $variables $envFrom }}
227
188
  {{- end }}
228
189
  {{- $_ := set $result "vars" $variables }}
229
- {{- (fromYaml (tpl (toYaml $result) $)) | mustToJson }}
190
+ {{- (fromYaml (tpl (toYaml $result) .context)) | mustToJson }}
230
191
  {{- end }}
@@ -2,13 +2,13 @@
2
2
  apiVersion: gateway.kyma-project.io/v1beta1
3
3
  kind: APIRule
4
4
  metadata:
5
- name: {{ include "web-application.internal.fullname" . }}
6
- labels: {{- include "web-application.internal.labels" . | nindent 4 }}
5
+ name: {{ include "web-application.fullname" . }}
6
+ labels: {{- include "web-application.labels" . | nindent 4 }}
7
7
  spec:
8
- gateway: {{ .Values.expose.gateway }}
8
+ gateway: {{tpl .Values.expose.gateway $ }}
9
9
  host: {{ include "web-application.internal.exposeHost" . }}
10
10
  service:
11
- name: {{ include "web-application.internal.fullname" . }}
11
+ name: {{ include "web-application.fullname" . }}
12
12
  port: {{ .Values.port }}
13
13
  rules:
14
14
  {{- toYaml .Values.expose.rules | nindent 6 }}
@@ -1,33 +1,46 @@
1
1
  apiVersion: apps/v1
2
2
  kind: Deployment
3
3
  metadata:
4
- labels: {{- include "web-application.internal.labels" . | nindent 4 }}
5
- name: {{ include "web-application.internal.fullname" . }}
4
+ name: {{ include "web-application.fullname" . }}
5
+ labels: {{- include "web-application.labels" . | nindent 4 }}
6
+ {{- if or .Values.annotations.deployment }}
7
+ annotations:
8
+ {{- tpl (toYaml .Values.annotations.deployment) $ | nindent 4 }}
9
+ {{- end }}
6
10
  spec:
7
11
  replicas: {{ .Values.replicaCount }}
8
12
  selector:
9
- matchLabels: {{- include "web-application.internal.selectorLabels" . | nindent 6 }}
13
+ matchLabels: {{- include "web-application.selectorLabels" . | nindent 6 }}
10
14
  template:
11
15
  metadata:
12
- labels: {{- include "web-application.internal.selectorLabels" . | nindent 8 }}
16
+ labels: {{- include "web-application.selectorLabels" . | nindent 8 }}
17
+ {{- if .Values.istio }}
18
+ sidecar.istio.io/inject: {{ .Values.istio.enabled | quote }}
19
+ {{ end }}
13
20
  annotations:
14
- container.apparmor.security.beta.kubernetes.io/{{ include "web-application.internal.name" . }}: runtime/default
21
+ container.apparmor.security.beta.kubernetes.io/{{ include "web-application.name" . }}: runtime/default
22
+ {{- if or .Values.annotations.deployment }}
23
+ {{- tpl (toYaml .Values.annotations.deployment) $ | nindent 8 }}
24
+ {{- end }}
15
25
  spec:
16
26
  {{- if (include "web-application.internal.imagePullSecretName" .) }}
17
27
  imagePullSecrets:
18
28
  - name: {{ include "web-application.internal.imagePullSecretName" . }}
19
29
  {{- end }}
20
- automountServiceAccountToken: false
21
- serviceAccountName: {{ tpl (.Values.serviceAccountName | default (include "web-application.internal.fullname" .)) $ }}
30
+ automountServiceAccountToken: {{ ternary false true (empty (or .Values.rbac.rules .Values.rbac.role .Values.rbac.clusterRole)) }}
31
+ serviceAccountName: {{ tpl (.Values.serviceAccountName | default (include "web-application.fullname" .)) $ }}
22
32
  containers:
23
- - image: {{ include "web-application.internal.imageName" . }}
24
- name: {{ include "web-application.internal.name" . }}
33
+ - image: {{ include "web-application.internal.imageName" (dict "image" .Values.image "context" $) }}
34
+ {{- if ( or .Values.global.imagePullPolicy .Values.imagePullPolicy ) }}
35
+ imagePullPolicy: {{ .Values.imagePullPolicy | default .Values.global.imagePullPolicy }}
36
+ {{- end }}
37
+ name: {{ include "web-application.name" . }}
25
38
  ports:
26
39
  - name: http
27
40
  containerPort: {{ .Values.port }}
28
41
  protocol: TCP
29
42
  envFrom:
30
- {{- $envFromVars := (include "web-application.internal.processEnvFrom" . | fromJson) }}
43
+ {{- $envFromVars := (include "web-application.internal.processEnvFrom" (dict "envFrom" .Values.envFrom "context" $) | fromJson) }}
31
44
  {{- if not (eq (len $envFromVars.vars) 0) }}
32
45
  {{- $envFromVars.vars | toYaml | nindent 8}}
33
46
  {{- end }}
@@ -38,18 +51,26 @@ spec:
38
51
  value: {{ .Values.port | quote }}
39
52
  - name: TMPDIR
40
53
  value: /tmp
41
- {{- $envVars := (include "web-application.internal.processEnv" $ | fromJson) }}
42
- {{- if not (eq (len $envVars.vars) 0) }}
43
- {{- $envVars.vars | toYaml | nindent 8}}
54
+ {{- if .Values.otlp.traces.enabled }}
55
+ - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
56
+ value: {{ .Values.otlp.traces.endpoint }}
57
+ {{- end }}
58
+ {{- if .Values.otlp.metrics.enabled }}
59
+ - name: OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
60
+ value: {{ .Values.otlp.metrics.endpoint }}
44
61
  {{- end }}
62
+ {{- $envVars := (include "web-application.internal.processEnv" (dict "env" .Values.env "context" $) | fromJson) }}
45
63
  {{- if not $envVars.appName}}
46
64
  - name: APPLICATION_NAME
47
- value: {{ include "web-application.internal.fullname" . }}
65
+ value: {{ include "web-application.fullname" . }}
48
66
  {{- end }}
49
67
  {{- if not $envVars.appURI}}
50
68
  - name: APPLICATION_URI
51
69
  value: {{ include "web-application.internal.applicationUri" . }}
52
70
  {{- end }}
71
+ {{- if not (eq (len $envVars.vars) 0) }}
72
+ {{- $envVars.vars | toYaml | nindent 8}}
73
+ {{- end }}
53
74
  livenessProbe:
54
75
  {{- if .Values.health.liveness.path }}
55
76
  httpGet:
@@ -97,17 +118,75 @@ spec:
97
118
  drop:
98
119
  - ALL
99
120
  privileged: false
121
+ runAsNonRoot: true
122
+ {{- if .Values.runAsUser }}
123
+ runAsUser: {{ .Values.runAsUser }}
124
+ {{- end }}
100
125
  readOnlyRootFilesystem: {{ .Values.readOnlyRootFilesystem | default false }}
101
126
  seccompProfile:
102
127
  type: RuntimeDefault
128
+ {{- range $key, $sidecar := .Values.sidecars }}
129
+ - image: {{ include "web-application.internal.imageName" (dict "image" $sidecar.image "context" $) }}
130
+ {{- if ( or $.Values.global.imagePullPolicy $sidecar.imagePullPolicy ) }}
131
+ imagePullPolicy: {{ $sidecar.imagePullPolicy | default $.Values.global.imagePullPolicy }}
132
+ {{- end }}
133
+ name: {{ $key }}
134
+ envFrom:
135
+ {{- $envFromVars := (include "web-application.internal.processEnvFrom" (dict "envFrom" $sidecar.envFrom "context" $) | fromJson) }}
136
+ {{- if not (eq (len $envFromVars.vars) 0) }}
137
+ {{- $envFromVars.vars | toYaml | nindent 8}}
138
+ {{- end }}
139
+ env:
140
+ - name: SERVICE_BINDING_ROOT
141
+ value: /bindings
142
+ - name: TMPDIR
143
+ value: /tmp
144
+ {{- if $.Values.otlp.traces.enabled }}
145
+ - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
146
+ value: {{ $.Values.otlp.traces.endpoint }}
147
+ {{- end }}
148
+ {{- if $.Values.otlp.metrics.enabled }}
149
+ - name: OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
150
+ value: {{ $.Values.otlp.metrics.endpoint }}
151
+ {{- end }}
152
+ {{- $envVars := (include "web-application.internal.processEnv" (dict "env" $sidecar.env "context" $) | fromJson) }}
153
+ {{- if not (eq (len $envVars.vars) 0) }}
154
+ {{- $envVars.vars | toYaml | nindent 8}}
155
+ {{- end }}
156
+ volumeMounts:
157
+ - name: tmp
158
+ mountPath: /tmp
159
+ - name: bindings-root
160
+ mountPath: /bindings
161
+ {{- range $volume := $.Values.additionalVolumes }}
162
+ - name: {{ $volume.name | quote }}
163
+ {{- toYaml $volume.volumeMount | nindent 10 }}
164
+ {{- end }}
165
+ {{- include "web-application.internal.serviceMounts" $ | nindent 8 }}
166
+ {{- if $sidecar.resources }}
167
+ resources:
168
+ {{- toYaml $sidecar.resources | nindent 10 }}
169
+ {{- end }}
170
+ securityContext:
171
+ allowPrivilegeEscalation: false
172
+ capabilities:
173
+ drop:
174
+ - ALL
175
+ privileged: false
176
+ runAsNonRoot: true
177
+ {{- if $sidecar.runAsUser }}
178
+ runAsUser: {{ $sidecar.runAsUser }}
179
+ {{- end }}
180
+ readOnlyRootFilesystem: {{ $.Values.readOnlyRootFilesystem | default false }}
181
+ seccompProfile:
182
+ type: RuntimeDefault
183
+ {{- end }}
103
184
  restartPolicy: Always
104
185
  terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
105
- securityContext:
106
- runAsNonRoot: true
107
186
  topologySpreadConstraints:
108
187
  {{- range $constraint := .Values.availability.topologySpreadConstraints }}
109
188
  - labelSelector:
110
- matchLabels: {{- include "web-application.internal.selectorLabels" $ | nindent 12 }}
189
+ matchLabels: {{- include "web-application.selectorLabels" $ | nindent 12 }}
111
190
  maxSkew: {{ $constraint.maxSkew }}
112
191
  topologyKey: {{ $constraint.topologyKey }}
113
192
  whenUnsatisfiable: {{ $constraint.whenUnsatisfiable }}
@@ -2,8 +2,8 @@
2
2
  kind: NetworkPolicy
3
3
  apiVersion: networking.k8s.io/v1
4
4
  metadata:
5
- name: {{ include "web-application.internal.fullname" . }}
6
- labels: {{- include "web-application.internal.labels" . | nindent 4 }}
5
+ name: {{ include "web-application.fullname" . }}
6
+ labels: {{- include "web-application.labels" . | nindent 4 }}
7
7
  spec:
8
8
  ingress:
9
9
  {{- if .Values.expose.enabled }}
@@ -22,6 +22,22 @@ spec:
22
22
  port: {{ $port }}
23
23
  {{- end }}
24
24
  {{- end }}
25
+ {{- if .Values.prometheus.enabled }}
26
+ - from:
27
+ - namespaceSelector:
28
+ matchLabels:
29
+ kubernetes.io/metadata.name: kyma-system
30
+ ports:
31
+ - protocol: TCP
32
+ port: {{ .Values.prometheus.port | default .Values.port }}
33
+ - from:
34
+ - namespaceSelector:
35
+ matchLabels:
36
+ kubernetes.io/metadata.name: kyma-system
37
+ ports:
38
+ - protocol: TCP
39
+ port: 15090
40
+ {{- end }}
25
41
  {{- if .Values.networkSecurity.allowNamespaceInternal }}
26
42
  - from:
27
43
  - podSelector: {}
@@ -58,5 +74,5 @@ spec:
58
74
  policyTypes:
59
75
  - Ingress
60
76
  podSelector:
61
- matchLabels: {{- include "web-application.internal.selectorLabels" . | nindent 6 }}
77
+ matchLabels: {{- include "web-application.selectorLabels" . | nindent 6 }}
62
78
  {{- end }}
@@ -1,9 +1,9 @@
1
1
  apiVersion: policy/v1
2
2
  kind: PodDisruptionBudget
3
3
  metadata:
4
- name: {{ include "web-application.internal.fullname" . }}
5
- labels: {{- include "web-application.internal.labels" . | nindent 4 }}
4
+ name: {{ include "web-application.fullname" . }}
5
+ labels: {{- include "web-application.labels" . | nindent 4 }}
6
6
  spec:
7
7
  maxUnavailable: {{ .Values.availability.podDisruptionBudget.maxUnavailable }}
8
8
  selector:
9
- matchLabels: {{- include "web-application.internal.selectorLabels" . | nindent 6 }}
9
+ matchLabels: {{- include "web-application.selectorLabels" . | nindent 6 }}