@xfe-repo/web-app 1.0.10 → 1.0.11
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{{- define "template.namespace" -}}
|
|
2
|
-
{{ if
|
|
2
|
+
{{ if not (empty .Values.namespace) }}{{ .Values.namespace }}{{ else }}deployment-{{ .Values.envType }}{{ end }}
|
|
3
3
|
{{- end -}}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
+
{{- if .Values.virtualService.enabled }}
|
|
1
2
|
apiVersion: networking.istio.io/v1alpha3
|
|
2
3
|
kind: VirtualService
|
|
3
4
|
metadata:
|
|
4
|
-
name: {{
|
|
5
|
+
name: {{ .Values.app }}-vs
|
|
5
6
|
namespace: {{ include "template.namespace" . }}
|
|
6
7
|
spec:
|
|
7
8
|
hosts:
|
|
8
|
-
{{- $host := (get
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
{{- $host := (get .Values.virtualService.hosts .Values.envType) }}
|
|
10
|
+
{{- range $host }}
|
|
11
|
+
- "{{ . }}"
|
|
12
|
+
{{- end }}
|
|
12
13
|
gateways:
|
|
13
|
-
{{- $gateways :=
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
{{- $gateways := .Values.virtualService.gateways }}
|
|
15
|
+
{{- range $gateways }}
|
|
16
|
+
- "{{ . }}"
|
|
17
|
+
{{- end }}
|
|
17
18
|
http:
|
|
18
19
|
- match:
|
|
19
20
|
- uri:
|
|
20
21
|
prefix: /
|
|
21
22
|
route:
|
|
22
23
|
- destination:
|
|
23
|
-
host: {{
|
|
24
|
+
host: {{ .Values.app }}
|
|
24
25
|
port:
|
|
25
26
|
number: 80
|
|
26
27
|
corsPolicy:
|
|
@@ -28,4 +29,4 @@ spec:
|
|
|
28
29
|
- "*"
|
|
29
30
|
allowMethods:
|
|
30
31
|
- "*"
|
|
31
|
-
|
|
32
|
+
{{- end }}
|
package/deploy/helm/values.yaml
CHANGED
|
@@ -5,14 +5,17 @@ tagContent: '<<TAG_CONTENT>>'
|
|
|
5
5
|
commitSHA: '<<CI_COMMIT_SHA>>'
|
|
6
6
|
envType: '<<ENV_TYPE>>'
|
|
7
7
|
hostPrefix: '<<HOST_PREFIX>>'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
namespace: ''
|
|
9
|
+
virtualService:
|
|
10
|
+
enabled: false
|
|
11
|
+
hosts:
|
|
12
|
+
test:
|
|
13
|
+
- 'test.template.com'
|
|
14
|
+
stage:
|
|
15
|
+
- 'stage.template.com'
|
|
16
|
+
prod:
|
|
17
|
+
- 'template.com'
|
|
18
|
+
gateways:
|
|
19
|
+
- 'common-gateway-eshetang'
|
|
17
20
|
# 目标集群 默认发布到saas集群 可选值: saas, infra
|
|
18
21
|
targetK8s: 'saas'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/web-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"bin": {
|
|
5
5
|
"xfe-web": "./bin/index.js"
|
|
6
6
|
},
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"webpack-manifest-plugin": "^4.0.2",
|
|
74
74
|
"workbox-webpack-plugin": "^7.0.0",
|
|
75
75
|
"yaml": "^2.3.4",
|
|
76
|
-
"@xfe-repo/
|
|
77
|
-
"@xfe-repo/
|
|
76
|
+
"@xfe-repo/eslint-config": "0.0.2",
|
|
77
|
+
"@xfe-repo/typescript-config": "0.0.3"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/scripts/config.js
CHANGED
|
@@ -21,11 +21,15 @@ const configDeploy = () => {
|
|
|
21
21
|
const valuesYamlFile = fs.readFileSync(valuesYamlFilePath, 'utf8')
|
|
22
22
|
const valuesYaml = yaml.parse(valuesYamlFile)
|
|
23
23
|
|
|
24
|
-
if(!valuesYaml.
|
|
24
|
+
if(!valuesYaml.virtualService) valuesYaml.virtualService = {}
|
|
25
25
|
|
|
26
|
-
valuesYaml.hosts.
|
|
27
|
-
|
|
28
|
-
valuesYaml.
|
|
26
|
+
if(!valuesYaml.virtualService.hosts) valuesYaml.virtualService.hosts = { test: [], stage: [], prod: [] }
|
|
27
|
+
|
|
28
|
+
valuesYaml.virtualService.enabled = xfeConfig.deploy.virtualServiceEnabled || true
|
|
29
|
+
|
|
30
|
+
valuesYaml.virtualService.hosts.prod = xfeConfig.deploy.hostsProd || []
|
|
31
|
+
valuesYaml.virtualService.hosts.stage = xfeConfig.deploy.hostsStage || []
|
|
32
|
+
valuesYaml.virtualService.hosts.test = xfeConfig.deploy.hostsTest || []
|
|
29
33
|
|
|
30
34
|
// gateways 默认为 common-gateway-eshetang
|
|
31
35
|
valuesYaml.gateways = xfeConfig.deploy.gateways || ["common-gateway-eshetang"]
|
|
@@ -33,6 +37,9 @@ const configDeploy = () => {
|
|
|
33
37
|
// 修改目标集群
|
|
34
38
|
valuesYaml.targetK8s = xfeConfig.deploy.targetK8s || "saas"
|
|
35
39
|
|
|
40
|
+
// 修改目标命名空间
|
|
41
|
+
valuesYaml.namespace = xfeConfig.deploy.targetNamespace || ''
|
|
42
|
+
|
|
36
43
|
// 写入values.yaml
|
|
37
44
|
const valuesYamlStr = yaml.stringify(valuesYaml, { defaultStringType: 'QUOTE_SINGLE', defaultKeyType: 'PLAIN' })
|
|
38
45
|
fs.writeFileSync(valuesYamlFilePath, valuesYamlStr, 'utf8')
|