@sap/cds-dk 4.9.5 → 6.0.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 (144) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/bin/activate.js +4 -4
  3. package/bin/add.js +11 -5
  4. package/bin/bind.js +16 -28
  5. package/bin/build/all.js +2 -2
  6. package/bin/build/index.js +12 -19
  7. package/bin/cds.js +16 -17
  8. package/bin/compile/index.js +12 -3
  9. package/bin/deploy/index.js +14 -14
  10. package/bin/deploy/to-hana.js +4 -4
  11. package/bin/deploy/to-sqlite.js +1 -1
  12. package/bin/env.js +13 -4
  13. package/bin/eval.js +1 -1
  14. package/bin/fix-redirects.js +1 -1
  15. package/bin/import.js +44 -179
  16. package/bin/repl.js +1 -1
  17. package/bin/watch.js +10 -15
  18. package/lib/bind/BindingManager.js +87 -0
  19. package/lib/bind/bindingResolver.js +14 -85
  20. package/lib/bind/bindingUtil.js +18 -11
  21. package/lib/bind/cfKeyProvider.js +58 -29
  22. package/lib/bind/kubernetesCredentialsProvider.js +44 -21
  23. package/lib/bind/userCdsrcJsonStorageProvider.js +12 -18
  24. package/lib/cds.js +13 -0
  25. package/lib/client/base_command.js +3 -2
  26. package/lib/client/extend.js +6 -7
  27. package/lib/client/helper/fs_helper.js +7 -8
  28. package/lib/client/helper/string_helper.js +6 -1
  29. package/lib/client/settings_manager.js +38 -45
  30. package/lib/compile/index.js +9 -10
  31. package/lib/compile/openapi/csdl2openapi.js +151 -43
  32. package/lib/compile/openapi/index.js +2 -2
  33. package/lib/compile/to-xsuaa.js +3 -2
  34. package/lib/import/common.js +342 -27
  35. package/lib/import/importapi.js +81 -13
  36. package/lib/import/message.js +4 -4
  37. package/lib/import/odata/index.js +141 -0
  38. package/lib/import/{utils → odata/metadataconverter}/MetadataConverter.js +2 -2
  39. package/lib/import/{utils → odata/metadataconverter}/MetadataConverterFactory.js +1 -1
  40. package/lib/import/{utils → odata/util}/MultiMap.js +0 -0
  41. package/lib/import/{v2parser.js → odata/v2parser.js} +405 -468
  42. package/lib/import/{v4parser.js → odata/v4parser.js} +311 -322
  43. package/lib/import/{vocabularies → odata/vocabularies}/Org.OData.Aggregation.V1.json +0 -0
  44. package/lib/import/{vocabularies → odata/vocabularies}/Org.OData.Authorization.V1.json +0 -0
  45. package/lib/import/{vocabularies → odata/vocabularies}/Org.OData.Capabilities.V1.json +0 -0
  46. package/lib/import/{vocabularies → odata/vocabularies}/Org.OData.Core.V1.json +0 -0
  47. package/lib/import/{vocabularies → odata/vocabularies}/Org.OData.Measures.V1.json +0 -0
  48. package/lib/import/{vocabularies → odata/vocabularies}/Org.OData.Validation.V1.json +0 -0
  49. package/lib/import/openapi/importOpenAPI.js +521 -0
  50. package/lib/import/openapi/index.js +19 -0
  51. package/lib/import/openapi/utilities.js +38 -0
  52. package/lib/index.js +1 -1
  53. package/lib/init/constants.js +7 -2
  54. package/lib/init/index.js +10 -3
  55. package/lib/init/template/_merging/existences.js +79 -19
  56. package/lib/init/template/approuter/files/mta.yaml.hbs +25 -11
  57. package/lib/init/template/approuter/files/package.json +1 -1
  58. package/lib/init/template/approuter/files/xs-app.json.hbs +7 -0
  59. package/lib/init/template/approuter/index.js +61 -54
  60. package/lib/init/template/auditlog/index.js +2 -2
  61. package/lib/init/template/data/index.js +2 -2
  62. package/lib/init/template/hana/files/mta.yaml.hbs +17 -17
  63. package/lib/init/template/hana/index.js +8 -4
  64. package/lib/init/template/helm/index.js +39 -0
  65. package/lib/init/template/helm/update/index.js +28 -0
  66. package/lib/init/template/java/index.js +7 -9
  67. package/lib/init/template/kibana-logging/index.js +5 -6
  68. package/lib/init/template/mta/index.js +4 -4
  69. package/lib/init/template/mtx/files/java/package.json +9 -9
  70. package/lib/init/template/mtx/files/mta.yaml.hbs +0 -7
  71. package/lib/init/template/mtx/files/xs-security.json.hbs +11 -20
  72. package/lib/init/template/mtx/index.js +50 -57
  73. package/lib/init/template/nodejs/files/package.json.hbs +2 -2
  74. package/lib/init/template/notebook/index.js +2 -0
  75. package/lib/init/template/templateBase.js +6 -4
  76. package/lib/init/template/xsuaa/index.js +9 -5
  77. package/lib/init/util/fsUtil.js +25 -10
  78. package/lib/init/util/logger.js +1 -1
  79. package/lib/init/util/mvnArchetypeUtil.js +4 -10
  80. package/lib/init/util/projectReader.js +16 -8
  81. package/lib/init/util/templateUtil.js +30 -34
  82. package/lib/k8s/ChartAdder.js +65 -0
  83. package/lib/k8s/ChartBuilder.js +186 -0
  84. package/lib/k8s/Context.js +71 -0
  85. package/lib/k8s/ImageUtil.js +21 -0
  86. package/lib/k8s/Model.d.ts +53 -0
  87. package/lib/k8s/auditlog/index.js +29 -0
  88. package/lib/k8s/auditlog/templates/auditlog.yaml +1 -0
  89. package/lib/k8s/buildModel.js +70 -0
  90. package/lib/k8s/connectivity/index.js +74 -0
  91. package/lib/k8s/connectivity/templates/connectivity-binding.yaml +9 -0
  92. package/lib/k8s/connectivity/templates/connectivity-proxy-info.yaml +16 -0
  93. package/lib/k8s/connectivity/templates/connectivity.yaml +1 -0
  94. package/lib/k8s/deployment/index.js +81 -0
  95. package/lib/k8s/deployment/subchart/Chart.yaml +6 -0
  96. package/lib/k8s/deployment/subchart/templates/_helpers.tpl +156 -0
  97. package/lib/k8s/deployment/subchart/templates/api-rule.yaml +24 -0
  98. package/lib/k8s/deployment/subchart/templates/deployment.yaml +110 -0
  99. package/lib/k8s/deployment/subchart/templates/network-policy.yaml +16 -0
  100. package/lib/k8s/deployment/subchart/templates/pod-disruption-budget.yaml +11 -0
  101. package/lib/k8s/deployment/subchart/templates/secret.yaml +10 -0
  102. package/lib/k8s/deployment/subchart/templates/service-binding.yaml +27 -0
  103. package/lib/k8s/deployment/subchart/templates/service.yaml +11 -0
  104. package/lib/k8s/deployment/subchart/values-lint.yaml +8 -0
  105. package/lib/k8s/deployment/subchart/values.schema.json +449 -0
  106. package/lib/k8s/deployment/subchart/values.yaml +76 -0
  107. package/lib/k8s/deployment/subchart-override/templates/_web_application_helpers.tpl +81 -0
  108. package/lib/k8s/destinations/index.js +40 -0
  109. package/lib/k8s/destinations/lib.js +16 -0
  110. package/lib/k8s/destinations/templates/destinations.yaml +1 -0
  111. package/lib/k8s/docker/push.js +8 -0
  112. package/lib/k8s/event-mesh/index.js +53 -0
  113. package/lib/k8s/event-mesh/lib.js +9 -0
  114. package/lib/k8s/event-mesh/templates/event-mesh.yaml +1 -0
  115. package/lib/k8s/hana-deployer/index.js +38 -0
  116. package/lib/k8s/hana-deployer/templates/hana-deployer-job.yaml +41 -0
  117. package/lib/k8s/helm/Release.js +80 -0
  118. package/lib/k8s/html5-apps-deployer/index.js +43 -0
  119. package/lib/k8s/html5-apps-deployer/templates/_html5_deployment_helpers.tpl +16 -0
  120. package/lib/k8s/html5-apps-deployer/templates/html5-apps-deployer-job.yaml +53 -0
  121. package/lib/k8s/html5-apps-repo-host/index.js +26 -0
  122. package/lib/k8s/html5-apps-repo-host/lib.js +16 -0
  123. package/lib/k8s/html5-apps-repo-host/templates/html5-apps-repo-host.yaml +1 -0
  124. package/lib/k8s/index.js +153 -0
  125. package/lib/k8s/modules.js +36 -0
  126. package/lib/k8s/multitenancy/index.js +24 -0
  127. package/lib/k8s/multitenancy/lib.js +25 -0
  128. package/lib/k8s/multitenancy/templates/saas-registry.yaml +19 -0
  129. package/lib/k8s/readProject.js +14 -0
  130. package/lib/k8s/resources/helm/chart/templates/NOTES.txt +11 -0
  131. package/lib/k8s/resources/helm/chart/templates/_deployment_helpers.tpl +221 -0
  132. package/lib/k8s/resources/helm/chart/templates/_helpers.tpl +167 -0
  133. package/lib/k8s/resources/helm/chart/templates/_sapcp_helpers.tpl +103 -0
  134. package/lib/k8s/util.js +186 -0
  135. package/lib/k8s/wrapFeature.js +55 -0
  136. package/lib/k8s/xsuaa/index.js +64 -0
  137. package/lib/k8s/xsuaa/lib.js +14 -0
  138. package/lib/k8s/xsuaa/templates/xsuaa.yaml +1 -0
  139. package/lib/util/exec.js +1 -1
  140. package/lib/util/write.js +1 -1
  141. package/lib/watch/node-watch.js +43 -14
  142. package/npm-shrinkwrap.json +1272 -2792
  143. package/package.json +5 -5
  144. package/lib/import/index.js +0 -235
@@ -0,0 +1,74 @@
1
+ const wrapFeature = require('../wrapFeature');
2
+
3
+ module.exports = wrapFeature('connectivity', {
4
+ async extendChartDeployment(context, name, deployment, mergeSemantics) {
5
+ const model = await context.get('model');
6
+ const prefix = model.app.name;
7
+
8
+ deployment.additionalVolumes = deployment.additionalVolumes || [];
9
+ deployment.additionalVolumes.push(
10
+ {
11
+ name: "connectivity-secret",
12
+ volumeMount: {
13
+ mountPath: "/bindings/connectivity",
14
+ readOnly: true
15
+ },
16
+ projected: {
17
+ sources: [
18
+ {
19
+ secret: {
20
+ name: `${prefix}-connectivity-binding`,
21
+ optional: false
22
+ }
23
+ },
24
+ {
25
+ secret: {
26
+ name: `${prefix}-connectivity-binding`,
27
+ optional: false,
28
+ items: [
29
+ {
30
+ key: "token_service_url",
31
+ path: "url"
32
+ }
33
+ ]
34
+ }
35
+ },
36
+ {
37
+ configMap: {
38
+ name: `${prefix}-connectivity-proxy-info`,
39
+ optional: false
40
+ }
41
+ }
42
+ ]
43
+ }
44
+ }
45
+ );
46
+
47
+ mergeSemantics.existences.push({
48
+ ref: `{name}-additional-volumes`,
49
+ keyPath: [name, "additionalVolumes"],
50
+ constraints: [{
51
+ comparisonKeyPath: ["name"],
52
+ value: "connectivity-secret"
53
+ }]
54
+ });
55
+ },
56
+
57
+ async getChartCapabilities(context) {
58
+ const model = await context.get('model');
59
+ const prefix = model.app.name;
60
+
61
+ return {
62
+ connectivity: {
63
+ serviceOfferingName: 'connectivity',
64
+ servicePlanName: 'connectivity_proxy',
65
+ secretName: `${prefix}-connectivity-binding`,
66
+ configMapName: `${prefix}-connectivity-proxy-info`
67
+ }
68
+ }
69
+ },
70
+
71
+ async addToChart(builder) {
72
+ await builder.addAllTemplates(__dirname);
73
+ }
74
+ });
@@ -0,0 +1,9 @@
1
+ {{- include "cap.sapcp.bindings" (merge
2
+ (dict "bindings"
3
+ (dict "binding"
4
+ (dict "serviceInstanceName" "connectivity")
5
+ )
6
+ "root" .
7
+ "name" "connectivity"
8
+ ) . )
9
+ }}
@@ -0,0 +1,16 @@
1
+ {{- $ := merge (dict "name" "connectivity-proxy-info") . }}
2
+ apiVersion: v1
3
+ kind: ConfigMap
4
+ metadata:
5
+ name: {{ .Release.Name }}-connectivity-proxy-info
6
+ namespace: {{ .Release.Namespace }}
7
+ labels: {{- include "cap.labels" $ | nindent 4 }}
8
+ data:
9
+ .metadata: >-
10
+ {"credentialProperties":[{"name":"subaccount_id","format":"text"},{"name":"subaccount_subdomain","format":"text"},{"name":"token_service_domain","format":"text"},{"name":"token_service_url","format":"text"},{"name":"token_service_url_pattern","format":"text"},{"name":"token_service_url_pattern_tenant_key","format":"text"},{"name":"clientid","format":"text"},{"name":"credential-type","format":"text"},{"name":"xsappname","format":"text"},{"name":"clientsecret","format":"text"},{"name":"connectivity_service","format":"json"},{"name":"onpremise_proxy_host","format":"text"},{"name":"onpremise_proxy_http_port","format":"text"},{"name":"onpremise_proxy_host","format":"text"},{"name":"url","format":"text"}],"metaDataProperties":[{"name":"instance_name","format":"text"},{"name":"instance_guid","format":"text"},{"name":"plan","format":"text"},{"name":"label","format":"text"},{"name":"type","format":"text"},{"name":"tags","format":"json"}]}
11
+ onpremise_proxy_host: connectivity-proxy.kyma-system.svc.cluster.local
12
+ onpremise_proxy_http_port: "20003"
13
+ onpremise_proxy_ldap_port: "20001"
14
+ onpremise_proxy_port: "20003"
15
+ onpremise_proxy_rfc_port: "20001"
16
+ onpremise_socks5_proxy_port: "20004"
@@ -0,0 +1 @@
1
+ {{- include "cap.service-instance" . }}
@@ -0,0 +1,81 @@
1
+ const fs = require('fs').promises;
2
+ const Path = require('path');
3
+ const { yaml } = require('../modules');
4
+
5
+ class Deployment {
6
+ constructor({context, name, language}) {
7
+ this.context = context;
8
+ this.name = name;
9
+ this.language = language;
10
+ }
11
+
12
+ async getChartDeployments(context) {
13
+ const model = await context.get('model');
14
+
15
+ let bindings = {};
16
+ await context.forEach('getServiceBindings',
17
+ async plugin => bindings = {...bindings, ...await plugin.getServiceBindings(context)}
18
+ );
19
+
20
+ const language = this.language || model.language;
21
+ const memory = language === 'Java' ? '1G' : '500M';
22
+ const cpu = language === 'Java' ? '700m' : '100m';
23
+ const env = language === 'Java' ? {SPRING_PROFILES_ACTIVE: "cloud"} : undefined;
24
+
25
+ return {
26
+ [this.name]: {
27
+ bindings,
28
+ image: {
29
+ repository: '<your-container-registry>/'+model.app.name+'-'+this.name,
30
+ tag: 'latest'
31
+ },
32
+ env,
33
+ resources: {
34
+ limits: {
35
+ cpu,
36
+ 'ephemeral-storage': '1G',
37
+ memory
38
+ },
39
+ requests: {
40
+ cpu: '100m',
41
+ 'ephemeral-storage': '1G',
42
+ memory
43
+ }
44
+ },
45
+ health_check: {
46
+ liveness: {
47
+ path: '/'
48
+ },
49
+ readiness: {
50
+ path: '/'
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ async getChartDependencies() {
58
+ return [{
59
+ name: 'web-application',
60
+ alias: this.name,
61
+ version: await webApplicationChartVersion()
62
+ }]
63
+ }
64
+
65
+ async addToChart(builder) {
66
+ 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
+ }
69
+ }
70
+
71
+ const webApplicationChartPath = process.env.WEB_APPLICATION_CHART || Path.join(__dirname, 'subchart');
72
+
73
+ async function webApplicationChartVersion() {
74
+ const chartFilePath = Path.join(webApplicationChartPath, 'Chart.yaml');
75
+ const chartFile = await fs.readFile(chartFilePath, 'utf-8');
76
+ return yaml.parse(chartFile).version;
77
+ }
78
+
79
+ module.exports = function (context) {
80
+ return new Deployment({context, name: 'srv'});
81
+ }
@@ -0,0 +1,6 @@
1
+ apiVersion: v2
2
+ name: web-application
3
+ description: A Helm chart for web app
4
+
5
+ type: application
6
+ version: 0.1.0
@@ -0,0 +1,156 @@
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
+ {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16
+ {{- else }}
17
+ {{- $name := default .Chart.Name .Values.nameOverride }}
18
+ {{- if contains $name .Release.Name }}
19
+ {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20
+ {{- else }}
21
+ {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22
+ {{- end }}
23
+ {{- end }}
24
+ {{- end }}
25
+
26
+ {{/*
27
+ */}}
28
+ {{- define "web-application.bindingName" -}}
29
+ {{- printf "%s-%s" (include "web-application.fullname" .root ) .name }}
30
+ {{- end }}
31
+
32
+ {{/*
33
+ Create chart name and version as used by the chart label.
34
+ */}}
35
+ {{- define "web-application.chart" -}}
36
+ {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
37
+ {{- end }}
38
+
39
+ {{/*
40
+ Common labels
41
+ */}}
42
+ {{- define "web-application.labels" -}}
43
+ helm.sh/revision: {{ .Release.Revision | quote }}
44
+ helm.sh/chart: {{ include "web-application.chart" . }}
45
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
46
+ {{ include "web-application.selectorLabels" . }}
47
+ {{- if .Chart.AppVersion }}
48
+ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
49
+ {{- end }}
50
+ {{- end }}
51
+
52
+ {{/*
53
+ Selector labels
54
+ */}}
55
+ {{- define "web-application.selectorLabels" -}}
56
+ app.kubernetes.io/name: {{ include "web-application.name" . }}
57
+ app.kubernetes.io/instance: {{ .Release.Name }}
58
+ {{- if .Values.global}}
59
+ {{- if .Values.global.component }}
60
+ app.kubernetes.io/component:{{ .Values.global.component }}
61
+ {{- end }}
62
+ {{- if .Values.global.partOf }}
63
+ app.kubernetes.io/partOf: {{ .Values.global.partOf }}
64
+ {{- end }}
65
+ {{- end }}
66
+ {{- end }}
67
+
68
+ {{/*
69
+ Define Host for the APIRule
70
+ */}}
71
+ {{- define "web-application.exposeHost" -}}
72
+ {{- if .Values.expose.host }}
73
+ {{- .Values.expose.host }}
74
+ {{- else }}
75
+ {{- $name := (include "web-application.fullname" .) }}
76
+ {{- if hasPrefix $name .Release.Namespace }}
77
+ {{- .Release.Namespace }}
78
+ {{- else }}
79
+ {{- printf "%s-%s" $name .Release.Namespace | trunc 63 | trimSuffix "-" }}
80
+ {{- end }}
81
+ {{- end }}
82
+ {{- end }}
83
+
84
+ {{/*
85
+ Service Binding secret mounts
86
+ */}}
87
+ {{- define "web-application.serviceMounts" -}}
88
+ {{- range $name, $params := .Values.bindings }}
89
+ - mountPath: /bindings/{{ $name }}/
90
+ name: "{{ $name }}-binding"
91
+ readOnly: true
92
+ {{- end }}
93
+ {{- end }}
94
+
95
+ {{/*
96
+ Service Binding secret volumes
97
+ */}}
98
+ {{- define "web-application.serviceVolumes" -}}
99
+ {{- range $name, $params := .Values.bindings }}
100
+ {{- $secretName := (include "web-application.bindingName" (dict "root" $ "name" $name)) }}
101
+ {{- if $params.fromSecret }}
102
+ {{- $secretName = $params.fromSecret}}
103
+ {{- else if $params.secretName }}
104
+ {{- $secretName = $params.secretName }}
105
+ {{- end }}
106
+ - name: {{ $name }}-binding
107
+ secret:
108
+ 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
+ {{- end }}
119
+ {{- end }}
120
+
121
+ {{/*
122
+ Name of the imagePullSecret
123
+ */}}
124
+ {{- define "web-application.imagePullSecretName" -}}
125
+ {{ $ips := (dict "local" .Values.imagePullSecret "global" .Values.global.imagePullSecret) }}
126
+ {{- if $ips.local.name }}
127
+ {{- $ips.local.name }}
128
+ {{- else if $ips.global.name }}
129
+ {{- $ips.global.name }}
130
+ {{- else if or $ips.local.dockerconfigjson $ips.global.dockerconfigjson }}
131
+ {{- include "web-application.fullname" . }}
132
+ {{- end }}
133
+ {{- end }}
134
+
135
+ {{/*
136
+ Create the name of a service instance.
137
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
138
+ If release name contains chart name it will be used as service insatnce name.
139
+ */}}
140
+ {{- define "web-application.serviceInstanceName" -}}
141
+ {{- if .binding.serviceInstanceFullname }}
142
+ {{- if gt (len .binding.serviceInstanceFullname) 63 }}
143
+ {{- fail (printf "name exceeds 63 characters: '%s'" .binding.serviceInstanceFullname) }}
144
+ {{- end }}
145
+ {{- .binding.serviceInstanceFullname }}
146
+ {{- else }}
147
+ {{- $name := .binding.serviceInstanceName }}
148
+ {{- if not (hasPrefix .release $name)}}
149
+ {{- $name = printf "%s-%s" .release $name }}
150
+ {{- end }}
151
+ {{- if gt (len $name) 63 }}
152
+ {{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
153
+ {{- end }}
154
+ {{- $name }}
155
+ {{- end }}
156
+ {{- end }}
@@ -0,0 +1,24 @@
1
+ {{ if .Values.expose.enabled}}
2
+ apiVersion: gateway.kyma-project.io/v1alpha1
3
+ kind: APIRule
4
+ metadata:
5
+ name: {{ include "web-application.fullname" . }}
6
+ labels: {{- include "web-application.labels" . | nindent 4 }}
7
+ spec:
8
+ gateway: kyma-gateway.kyma-system.svc.cluster.local
9
+ rules:
10
+ - accessStrategies:
11
+ - handler: allow
12
+ methods:
13
+ - GET
14
+ - POST
15
+ - PUT
16
+ - PATCH
17
+ - DELETE
18
+ - HEAD
19
+ path: /.*
20
+ service:
21
+ host: {{ include "web-application.exposeHost" . }}
22
+ name: {{ include "web-application.fullname" . }}
23
+ port: {{ .Values.port }}
24
+ {{ end }}
@@ -0,0 +1,110 @@
1
+ apiVersion: apps/v1
2
+ kind: Deployment
3
+ metadata:
4
+ labels: {{- include "web-application.labels" . | nindent 4 }}
5
+ name: {{ include "web-application.fullname" . }}
6
+ spec:
7
+ replicas: {{ .Values.replicaCount }}
8
+ selector:
9
+ matchLabels: {{- include "web-application.selectorLabels" . | nindent 6 }}
10
+ template:
11
+ metadata:
12
+ labels: {{- include "web-application.selectorLabels" . | nindent 8 }}
13
+ spec:
14
+ {{- if (include "web-application.imagePullSecretName" .) }}
15
+ imagePullSecrets:
16
+ - name: {{ include "web-application.imagePullSecretName" . }}
17
+ {{- end }}
18
+ automountServiceAccountToken: false
19
+ serviceAccountName: {{ .Values.serviceAccountName }}
20
+ containers:
21
+ - image: "{{ required ".Values.image.repository is required!" .Values.image.repository }}:{{ .Values.image.tag }}"
22
+ name: {{ include "web-application.name" . }}
23
+ ports:
24
+ - name: http
25
+ containerPort: {{ .Values.port }}
26
+ protocol: TCP
27
+ envFrom:
28
+ {{- range $secretName := .Values.envSecretNames }}
29
+ - secretRef:
30
+ name: {{ $secretName }}
31
+ {{- end }}
32
+ env:
33
+ {{- include "cap.web-application.env" . | indent 8 }}
34
+ {{- range $k, $v := .Values.env }}
35
+ - name: {{ $k }}
36
+ value: {{ tpl ($v | toString) $ | quote }}
37
+ {{- end }}
38
+ {{- if .Values.bindings }}
39
+ - name: SERVICE_BINDING_ROOT
40
+ value: /bindings
41
+ {{- end }}
42
+ - name: PORT
43
+ value: {{ .Values.port | quote }}
44
+ - name: TMPDIR
45
+ value: /tmp
46
+ livenessProbe:
47
+ {{- if .Values.health_check.liveness.path }}
48
+ httpGet:
49
+ path: {{ .Values.health_check.liveness.path }}
50
+ port: http
51
+ {{- else }}
52
+ tcpSocket:
53
+ port: {{ .Values.port }}
54
+ {{- end }}
55
+ readinessProbe:
56
+ {{- if .Values.health_check.readiness.path }}
57
+ httpGet:
58
+ path: {{ .Values.health_check.readiness.path }}
59
+ port: http
60
+ {{- else }}
61
+ tcpSocket:
62
+ port: {{ .Values.port }}
63
+ {{- end }}
64
+ startupProbe:
65
+ {{- if .Values.health_check.liveness.path }}
66
+ httpGet:
67
+ path: {{ .Values.health_check.liveness.path }}
68
+ port: http
69
+ {{- else }}
70
+ tcpSocket:
71
+ port: {{ .Values.port }}
72
+ {{- end }}
73
+ failureThreshold: {{ div (add1 .Values.startupTimeout) 2 }}
74
+ periodSeconds: 2
75
+ volumeMounts:
76
+ - name: tmp
77
+ mountPath: /tmp
78
+ {{- range $volume := .Values.additionalVolumes }}
79
+ - name: {{ $volume.name | quote }}
80
+ {{- toYaml $volume.volumeMount | nindent 10 }}
81
+ {{- end }}
82
+ {{- include "cap.web-application.serviceMounts" . | nindent 8 }}
83
+ resources:
84
+ {{- toYaml .Values.resources | nindent 10 }}
85
+ securityContext:
86
+ allowPrivilegeEscalation: false
87
+ capabilities:
88
+ drop:
89
+ - ALL
90
+ privileged: false
91
+ readOnlyRootFilesystem: false
92
+ restartPolicy: Always
93
+ securityContext:
94
+ runAsNonRoot: true
95
+ {{- if .Values.ha.enabled }}
96
+ topologySpreadConstraints:
97
+ - labelSelector:
98
+ matchLabels: {{- include "web-application.selectorLabels" . | nindent 12 }}
99
+ maxSkew: 1
100
+ topologyKey: kubernetes.io/hostname
101
+ whenUnsatisfiable: DoNotSchedule
102
+ {{- end }}
103
+ volumes:
104
+ - emptyDir: {}
105
+ name: tmp
106
+ {{- include "cap.web-application.serviceVolumes" . | nindent 6 }}
107
+ {{- range $volume := .Values.additionalVolumes }}
108
+ -
109
+ {{- omit $volume "volumeMount" | toYaml | nindent 8 }}
110
+ {{- end }}
@@ -0,0 +1,16 @@
1
+ apiVersion: networking.k8s.io/v1
2
+ kind: NetworkPolicy
3
+ metadata:
4
+ name: {{ include "web-application.fullname" . }}
5
+ labels: {{- include "web-application.labels" . | nindent 4 }}
6
+ spec:
7
+ ingress:
8
+ - from:
9
+ - podSelector:
10
+ matchLabels:
11
+ app: istio-ingressgateway
12
+ namespaceSelector: {}
13
+ podSelector:
14
+ matchLabels: {{- include "web-application.selectorLabels" . | nindent 6 }}
15
+ policyTypes:
16
+ - Ingress
@@ -0,0 +1,11 @@
1
+ {{- if .Values.ha.enabled }}
2
+ apiVersion: policy/v1beta1
3
+ kind: PodDisruptionBudget
4
+ metadata:
5
+ name: {{ include "web-application.fullname" . }}
6
+ labels: {{- include "web-application.labels" . | nindent 4 }}
7
+ spec:
8
+ maxUnavailable: 10%
9
+ selector:
10
+ matchLabels: {{- include "web-application.selectorLabels" . | nindent 6 }}
11
+ {{- end }}
@@ -0,0 +1,10 @@
1
+ {{ if or .Values.imagePullSecret.dockerconfigjson .Values.global.imagePullSecret.dockerconfigjson }}
2
+ apiVersion: v1
3
+ kind: Secret
4
+ type: kubernetes.io/dockerconfigjson
5
+ metadata:
6
+ name: {{ include "web-application.imagePullSecretName" . }}
7
+ labels: {{- include "web-application.labels" . | nindent 4 }}
8
+ data:
9
+ .dockerconfigjson: {{ default .Values.global.imagePullSecret.dockerconfigjson .Values.imagePullSecret.dockerconfigjson }}
10
+ {{- end -}}
@@ -0,0 +1,27 @@
1
+ {{- range $name, $params := .Values.bindings }}
2
+ {{- if not $params.fromSecret }}
3
+ ---
4
+ apiVersion: services.cloud.sap.com/v1
5
+ kind: ServiceBinding
6
+ metadata:
7
+ name: {{ include "web-application.bindingName" (dict "root" $ "name" $name) }}
8
+ labels: {{- include "web-application.labels" $ | nindent 4 }}
9
+ spec:
10
+ serviceInstanceName: {{include "web-application.serviceInstanceName" (dict "binding" $params "release" $.Release.Name) }}
11
+ {{- if $params.externalName }}
12
+ externalName: {{ $params.externalName }}
13
+ {{- end }}
14
+ {{- if $params.secretName }}
15
+ secretName: {{ $params.secretName }}
16
+ {{- end }}
17
+ {{- if $params.parameters }}
18
+ parameters: {{ $params.parameters | toYaml | nindent 4 }}
19
+ {{- end }}
20
+ {{- if $params.parametersFrom }}
21
+ parametersFrom: {{ $params.parametersFrom | toYaml | nindent 4 }}
22
+ {{- end }}
23
+ {{- if $params.credentialsRotationPolicy }}
24
+ credentialsRotationPolicy: {{ $params.credentialsRotationPolicy | toYaml | nindent 4 }}
25
+ {{- end }}
26
+ {{- end }}
27
+ {{- end }}
@@ -0,0 +1,11 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: {{ include "web-application.fullname" . }}
5
+ labels: {{- include "web-application.labels" . | nindent 4 }}
6
+ spec:
7
+ ports:
8
+ - port: {{ .Values.port }}
9
+ targetPort: {{ .Values.port }}
10
+ protocol: TCP
11
+ selector: {{- include "web-application.selectorLabels" . | nindent 4 }}
@@ -0,0 +1,8 @@
1
+ image:
2
+ repository: default
3
+ resources:
4
+ requests:
5
+ cpu: 250m
6
+ memory: 1G
7
+ limits:
8
+ memory: 1G