Skip to content

Commit

Permalink
feat(helm-charts): helm chart ingress 支持公网 #3540
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Mar 13, 2024
1 parent fbfbdf4 commit eb1a9c8
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 12 deletions.
6 changes: 3 additions & 3 deletions helm-charts/bk-dbm/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
version: 7.9.8
- name: dbm
repository: file://charts/dbm
version: 0.1.32
version: 0.1.33
- name: dbconfig
repository: file://charts/dbconfig
version: 0.1.13
Expand Down Expand Up @@ -56,5 +56,5 @@ dependencies:
- name: backup-consumer
repository: file://charts/backup-consumer
version: 0.0.3
digest: sha256:cdce7dfdf738437c0905f61ac8d058a90a1740ca22ed2da5c9ab6c2e863f91d1
generated: "2024-03-07T20:39:45.062582+08:00"
digest: sha256:bf4ff8ce83089fd40ede0edf862d7e1f1c13a8b1d63a717f6fd51cee0d3a252a
generated: "2024-03-13T16:49:07.079999+08:00"
6 changes: 3 additions & 3 deletions helm-charts/bk-dbm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- condition: dbm.enabled
name: dbm
repository: file://charts/dbm
version: 0.1.32
version: 0.1.33
- condition: dbconfig.enabled
name: dbconfig
repository: file://charts/dbconfig
Expand Down Expand Up @@ -79,5 +79,5 @@ dependencies:
description: A Helm chart for bk-dbm
name: bk-dbm
type: application
version: 1.3.0-alpha.40
appVersion: 1.3.0-alpha.40
version: 1.3.0-alpha.41
appVersion: 1.3.0-alpha.41
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/backup-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.0.1-alpha.47
appVersion: 0.0.1-alpha.57
description: A Helm chart for backup-server
name: backup-server
type: application
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/dbconfig/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.0.1-alpha.80
appVersion: 0.0.1-alpha.81
description: A Helm chart for dbconfig
name: dbconfig
type: application
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/bk-dbm/charts/dbm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
appVersion: 1.3.0-alpha.489
appVersion: 1.3.0-alpha.503
description: A Helm chart for dbm
name: dbm
type: application
version: 0.1.32
version: 0.1.33
61 changes: 61 additions & 0 deletions helm-charts/bk-dbm/charts/dbm/templates/ingress-public.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingressPublic.enabled -}}
{{- $fullName := include "bk-dbm.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingressPublic.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingressPublic.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingressPublic.annotations "kubernetes.io/ingress.class" .Values.ingressPublic.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "bk-dbm.labels" . | nindent 4 }}
{{- with .Values.ingressPublic.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingressPublic.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingressPublic.className }}
{{- end }}
{{- if .Values.ingressPublic.tls }}
tls:
{{- range .Values.ingressPublic.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- if .Values.ingressPublic.hostname }}
- host: {{ .Values.ingressPublic.hostname }}
http:
paths:
{{- range .Values.ingressPublic.paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion helm-charts/bk-dbm/charts/dbpartition/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.0.1-alpha.152
appVersion: 0.0.1-alpha.154
name: dbpartition
description: A Helm chart for db partition service
type: application
Expand Down
11 changes: 10 additions & 1 deletion helm-charts/bk-dbm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ dbm:
slowQueryParseApigwDomain: ""

ingress:
# 在跨云管控场景下,需要配置公网 clb 进行访问
enabled: true
className: ""
annotations:
Expand All @@ -125,6 +124,16 @@ dbm:
pathType: ImplementationSpecific
tls: []

ingressPublic:
# 在跨云管控场景下,需要配置公网 clb 进行访问
enabled: false
className: ""
hostname: "bkdbm-public.example.com"
paths:
- path: /
pathType: ImplementationSpecific
tls: []

autoscaling:
enabled: false

Expand Down

0 comments on commit eb1a9c8

Please sign in to comment.