diff --git a/templates/ingress/ingress.yaml b/templates/ingress/ingress.yaml index e6a12dfc097a77e745ba473aa9378fb58474e7be..e4eef8d34afbe50617783c9a29d3292635dadf3b 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 faa01698c091f62a847811b1c372838d1a6bb2af..5def218499cf618e6697213e24ea20fc3f0c67a0 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" . }}