From 0f8f5920241a2ddf29a6cddb91892603af2e63db Mon Sep 17 00:00:00 2001 From: shucheng Date: Mon, 28 Dec 2020 14:25:04 +0800 Subject: [PATCH] v2.1.1 fix up --- templates/ingress/ingress.yaml | 5 +++- templates/ingress/ingressroute.yaml | 42 ++++++++++++----------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/templates/ingress/ingress.yaml b/templates/ingress/ingress.yaml index e6a12df..e4eef8d 100644 --- a/templates/ingress/ingress.yaml +++ b/templates/ingress/ingress.yaml @@ -1,4 +1,7 @@ -{{- if not .Capabilities.APIVersions.Has "bcc.bd-apaas.com/v1alpha1/IngressRoute" -}} +{{- if .Capabilities.APIVersions.Has "bcc.bd-apaas.com/v1alpha1/IngressRoute" -}} + +{{- else }} + {{- if eq .Values.expose.type "ingress" }} {{- $ingress := .Values.expose.ingress -}} {{- $tls := .Values.expose.tls -}} diff --git a/templates/ingress/ingressroute.yaml b/templates/ingress/ingressroute.yaml index faa0169..5def218 100644 --- a/templates/ingress/ingressroute.yaml +++ b/templates/ingress/ingressroute.yaml @@ -1,11 +1,3 @@ -{{- $_ := set . "portal_path" "/" -}} -{{- $_ := set . "api_path" "/api/" -}} -{{- $_ := set . "service_path" "/service/" -}} -{{- $_ := set . "v2_path" "/v2/" -}} -{{- $_ := set . "chartrepo_path" "/chartrepo/" -}} -{{- $_ := set . "controller_path" "/c/" -}} -{{- $_ := set . "notary_path" "/" -}} - {{- if .Capabilities.APIVersions.Has "bcc.bd-apaas.com/v1alpha1/IngressRoute" -}} --- apiVersion: bcc.bd-apaas.com/v1alpha1 @@ -17,42 +9,42 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} labels: - {{ include "harbor.labels" . | indent 4 }} + {{ include "harbor.labels" . | nindent 4 }} spec: entryPoints: - websecure routes: - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .portal_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/`) kind: Rule services: - name: {{ template "harbor.portal" . }} port: {{ template "harbor.portal.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .api_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/api/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .service_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/service/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .v2_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/v2/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .chartrepo_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/chartrepo/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .controller_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/c/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.notary }}`) && PathPrefix(`{{ .notary_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.notary }}`) && PathPrefix(`/`) kind: Rule services: - name: {{ template "harbor.notary-server" . }} @@ -65,46 +57,46 @@ kind: IngressRoute metadata: name: "{{ template "harbor.ingress" . }}-http" annotations: - {{- with .Values.ingress.annotations }} + {{- with .Values.expose.ingress.annotations }} {{- toYaml . | nindent 4 }} {{- end }} labels: - {{ include "harbor.labels" . | indent 4 }} + {{ include "harbor.labels" . | nindent 4 }} spec: entryPoints: - web routes: - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .portal_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/`) kind: Rule services: - name: {{ template "harbor.portal" . }} port: {{ template "harbor.portal.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .api_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/api/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .service_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/service/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .v2_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/v2/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .chartrepo_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/chartrepo/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .controller_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`/c/`) kind: Rule services: - name: {{ template "harbor.core" . }} port: {{ template "harbor.core.servicePort" . }} - - match: Host(`{{ .Values.expose.ingress.hosts.notary }}`) && PathPrefix(`{{ .notary_path }}`) + - match: Host(`{{ .Values.expose.ingress.hosts.notary }}`) && PathPrefix(`/`) kind: Rule services: - name: {{ template "harbor.notary-server" . }} -- 2.26.0