Skip to content

Commit

Permalink
perf: 前后端域名统一 TencentBlueKing#744
Browse files Browse the repository at this point in the history
前端与Web API统一使用主站域名
  • Loading branch information
jsonwan committed Mar 16, 2023
1 parent 3e2a090 commit 0a5c8db
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 5 deletions.
4 changes: 2 additions & 2 deletions support-files/kubernetes/charts/bk-job/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ bitnami/rabbitmq
| `job.encrypt.password` | 加密DB密码/凭证的对称密钥 | `encrypt_password` |
| `job.migration.iamModel.enabled` | 是否开启权限模型migration | `true` |
| `job.migration.mysqlSchema.enabled` | 是否开启Mysql数据库结构migration | `true` |
| `job.web.domain` | 前端主站域名 | `job.example.com` |
| `job.web.apiDomain` | 暴露给前端的API地址 | `api.job.example.com` |
| `job.web.domain` | 主站域名(前端与Web API使用) | `job.example.com` |
| `job.web.apiDomain` | 暴露给其他上层系统(ESB、ApiGW)的API地址 | `api.job.example.com` |
| `job.ingress.https.enabled` | 是否启用HTTPS | `false` |
| `job.ingress.https.certBase64` | 开启HTTPS时使用的证书base64编码 | `` |
| `job.ingress.https.keyBase64` | 开启HTTPS时使用的证书私钥base64编码 | `` |
Expand Down
15 changes: 15 additions & 0 deletions support-files/kubernetes/charts/bk-job/VALUES_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ fileWorkerConfig:
port: 19810
```

## 0.2.7
1.增加对外暴露API的Ingress配置
```shell script
## 对外暴露API的Ingress配置
apiConfig:
ingress:
# 对外暴露API的Ingress是否启用,默认启用
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
# 请求包大小限制
nginx.ingress.kubernetes.io/proxy-body-size: "10240m"
```

## 0.2.2-rc.7
1.增加文档中心与问题反馈URL配置项
```shell script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ Return the Job Web URL
Return the Job Web API URL
*/}}
{{- define "job.web.api.url" -}}
{{ printf "%s://%s" (include "job.web.scheme" .) .Values.job.web.apiDomain }}
{{ printf "%s://%s" (include "job.web.scheme" .) .Values.job.web.domain }}
{{- end -}}

{{/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.apiConfig.ingress.enabled -}}
apiVersion: {{ template "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ include "common.names.fullname" . }}-api
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: job-api
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
namespace: {{ .Release.Namespace }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.apiConfig.ingress.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.apiConfig.ingress.annotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.ingressClassName (include "common.ingress.supportsIngressClassname" .) }}
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
{{- end }}
rules:
{{- if .Values.job.web.domain }}
- host: {{ .Values.job.web.domain }}
http:
paths:
- path: "/api/.*"
pathType: ImplementationSpecific
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-gateway" (include "common.names.fullname" .)) "servicePort" .Values.gatewayConfig.service.port.http "context" $) | nindent 14 }}
- path: "/job-.*"
pathType: ImplementationSpecific
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-gateway" (include "common.names.fullname" .)) "servicePort" .Values.gatewayConfig.service.port.http "context" $) | nindent 14 }}
- path: "/user/.*"
pathType: ImplementationSpecific
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-gateway" (include "common.names.fullname" .)) "servicePort" .Values.gatewayConfig.service.port.http "context" $) | nindent 14 }}
- path: "/logout"
pathType: ImplementationSpecific
backend: {{- include "common.ingress.backend" (dict "serviceName" (printf "%s-gateway" (include "common.names.fullname" .)) "servicePort" .Values.gatewayConfig.service.port.http "context" $) | nindent 14 }}
{{- end }}
{{- end }}
15 changes: 13 additions & 2 deletions support-files/kubernetes/charts/bk-job/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,9 @@ job:
# 各微服务Actuator监控端口
managePort: 19876
web:
# 作业平台主站域名
# 作业平台主站域名(被前端与Web API使用)
domain: "job.example.com"
# 作业平台API域名
# 作业平台API域名(被上层系统ESB、ApiGW使用)
apiDomain: "jobapi.example.com"
ingress:
https:
Expand Down Expand Up @@ -1281,6 +1281,17 @@ frontendConfig:
extraTls: []
secrets: []

## 对外暴露API的Ingress配置
apiConfig:
ingress:
# 对外暴露API的Ingress是否启用,默认启用
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
# 请求包大小限制
nginx.ingress.kubernetes.io/proxy-body-size: "10240m"

## migration迁移任务配置
migration:
# 模块是否启用,默认启用
Expand Down

0 comments on commit 0a5c8db

Please sign in to comment.