From 54ef2cba4775275e03181b70d58ec7c69f808523 Mon Sep 17 00:00:00 2001 From: a601287411 <601287411@qq.com> Date: Wed, 19 Apr 2023 10:23:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4path=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/_helpers.tpl | 7 +++++++ templates/deployment.yaml | 8 ++------ templates/httpscaledobject.yaml | 5 +---- templates/ingress.yaml | 4 ++-- values.yaml | 27 ++++++++++++++++++++++++++- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 7b3f6c7..d1571cd 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -61,6 +61,13 @@ Create the name of the service account to use {{- end }} {{- end }} +{{/* +Create the full host of demo +*/}} +{{- define "demo-chart.host" -}} +{{ .Release.Name }}.{{ .Values.host }} +{{- end }} + {{/* Create the url path of service */}} diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 28941c5..e535bb7 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -36,13 +36,9 @@ spec: containerPort: {{ .Values.service.port }} protocol: TCP livenessProbe: - httpGet: - path: / - port: http + {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: - httpGet: - path: / - port: http + {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/templates/httpscaledobject.yaml b/templates/httpscaledobject.yaml index b091b36..bf1f0c3 100644 --- a/templates/httpscaledobject.yaml +++ b/templates/httpscaledobject.yaml @@ -3,10 +3,7 @@ apiVersion: http.keda.sh/v1alpha1 metadata: name: {{ include "demo-chart.fullname" . }} spec: - host: {{ .Values.host }} - path: {{ include "demo-chart.path" . }} - pathType: {{ .Values.pathType }} - rewrite: {{ .Values.rewritePath }} + host: {{ include "demo-chart.host" . }} targetPendingRequests: {{ .Values.targetPendingRequests }} scaleTargetRef: deployment: {{ include "demo-chart.fullname" . }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml index 8b69e97..a43444f 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -7,10 +7,10 @@ metadata: kubernetes.io/ingress.class: nginx spec: rules: - - host: {{ .Values.host }} + - host: {{ include "demo-chart.host" . }} http: paths: - - path: {{ include "demo-chart.path" . }}/ + - path: / pathType: Prefix backend: service: diff --git a/values.yaml b/values.yaml index 55d1f45..10d65b4 100644 --- a/values.yaml +++ b/values.yaml @@ -5,7 +5,7 @@ replicaCount: 1 targetPendingRequests: 200 -host: ailab-demo.xf-yun.com +host: ailab.xf-yun.com pathType: prefix pathPrefix: /demo rewritePath: true @@ -87,3 +87,28 @@ tolerations: [] # Temporarily unconfigurable # affinity: {} + +# Liveness and readiness probes +# These are disabled by default, as they are not required for the demo +# application to function. If you want to enable them, you can uncomment +# the following lines and adjust them as necessary. +livenessProbe: + {} +# failureThreshold: 3 +# httpGet: +# path: / +# port: http +# scheme: HTTP +# periodSeconds: 10 +# successThreshold: 1 +# timeoutSeconds: 1 +readinessProbe: + {} +# failureThreshold: 3 +# httpGet: +# path: / +# port: http +# scheme: HTTP +# periodSeconds: 10 +# successThreshold: 1 +# timeoutSeconds: 1 \ No newline at end of file