From 34fa969b56c374ef4e18a8a237264c0a2c982464 Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Fri, 22 Jun 2018 17:47:14 +0800 Subject: [PATCH] Update ingress rule for Harbor chart Rewrite /v2/* to UI instead of registry to apply the filters to the requests --- .../harbor/templates/ingress/ingress.yaml | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/contrib/helm/harbor/templates/ingress/ingress.yaml b/contrib/helm/harbor/templates/ingress/ingress.yaml index cac2ad39f..a8d482745 100644 --- a/contrib/helm/harbor/templates/ingress/ingress.yaml +++ b/contrib/helm/harbor/templates/ingress/ingress.yaml @@ -1,7 +1,7 @@ apiVersion: extensions/v1beta1 kind: Ingress metadata: - name: "{{ template "harbor.fullname" . }}-ingress" + name: "{{ template "harbor.fullname" . }}-ingress-ui-notary" labels: {{ include "harbor.labels" . | indent 4 }} annotations: @@ -22,10 +22,6 @@ spec: backend: serviceName: {{ template "harbor.fullname" . }}-ui servicePort: 80 - - path: /v2 - backend: - serviceName: {{ template "harbor.fullname" . }}-registry - servicePort: 5000 - host: "{{ template "harbor.notaryFQDN" . }}" http: paths: @@ -33,3 +29,30 @@ spec: backend: serviceName: {{ template "harbor.notaryServiceName" . }} servicePort: 4443 + +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: "{{ template "harbor.fullname" . }}-ingress-registry" + labels: +{{ include "harbor.labels" . | indent 4 }} + annotations: +{{ toYaml .Values.ingress.annotations | indent 4 }} + nginx.ingress.kubernetes.io/rewrite-target: /registryproxy/v2 +spec: +{{ if not .Values.insecureRegistry }} + tls: + - hosts: + - "{{ .Values.externalDomain }}" + secretName: "{{ template "harbor.fullname" . }}-ingress" +{{ end }} + rules: + - host: "{{ .Values.externalDomain }}" + http: + paths: + - path: /v2 + backend: + serviceName: {{ template "harbor.fullname" . }}-ui + servicePort: 80 +