{{- if eq .Values.expose.type "ingress" }} {{- $ingress := .Values.expose.ingress -}} {{- $tls := .Values.expose.tls -}} {{- if eq .Values.expose.ingress.controller "gce" }} {{- $_ := set . "portal_path" "/*" -}} {{- $_ := set . "api_path" "/api/*" -}} {{- $_ := set . "service_path" "/service/*" -}} {{- $_ := set . "v2_path" "/v2/*" -}} {{- $_ := set . "chartrepo_path" "/chartrepo/*" -}} {{- $_ := set . "controller_path" "/c/*" -}} {{- else if eq .Values.expose.ingress.controller "ncp" }} {{- $_ := set . "portal_path" "/" -}} {{- $_ := set . "api_path" "/api/.*" -}} {{- $_ := set . "service_path" "/service/.*" -}} {{- $_ := set . "v2_path" "/v2/.*" -}} {{- $_ := set . "chartrepo_path" "/chartrepo/.*" -}} {{- $_ := set . "controller_path" "/c/.*" -}} {{- else }} {{- $_ := set . "portal_path" "/" -}} {{- $_ := set . "api_path" "/api/" -}} {{- $_ := set . "service_path" "/service/" -}} {{- $_ := set . "v2_path" "/v2/" -}} {{- $_ := set . "chartrepo_path" "/chartrepo/" -}} {{- $_ := set . "controller_path" "/c/" -}} {{- end }} apiVersion: extensions/v1beta1 kind: Ingress metadata: name: "{{ template "harbor.ingress" . }}" labels: {{ include "harbor.labels" . | indent 4 }} annotations: {{ toYaml $ingress.annotations | indent 4 }} spec: {{- if $tls.enabled }} tls: {{- if $tls.secretName }} - secretName: {{ $tls.secretName }} {{- else }} - secretName: "{{ template "harbor.ingress" . }}" {{- end }} {{- if $ingress.hosts.core }} hosts: - {{ $ingress.hosts.core }} {{- end }} {{- if .Values.notary.enabled }} {{- if $tls.notarySecretName }} - secretName: {{ $tls.notarySecretName }} {{- else if $tls.secretName }} - secretName: {{ $tls.secretName }} {{- else }} - secretName: "{{ template "harbor.ingress" . }}" {{- end }} {{- if $ingress.hosts.notary }} hosts: - {{ $ingress.hosts.notary }} {{- end }} {{- end }} {{- end }} {{- if eq .Values.expose.ingress.controller "ncp" }} backend: serviceName: {{ template "harbor.portal" . }} servicePort: 80 {{- end }} rules: - http: paths: - path: {{ .portal_path }} backend: serviceName: {{ template "harbor.portal" . }} servicePort: 80 - path: {{ .api_path }} backend: serviceName: {{ template "harbor.core" . }} servicePort: 80 - path: {{ .service_path }} backend: serviceName: {{ template "harbor.core" . }} servicePort: 80 - path: {{ .v2_path }} backend: serviceName: {{ template "harbor.core" . }} servicePort: 80 - path: {{ .chartrepo_path }} backend: serviceName: {{ template "harbor.core" . }} servicePort: 80 - path: {{ .controller_path }} backend: serviceName: {{ template "harbor.core" . }} servicePort: 80 {{- if $ingress.hosts.core }} host: {{ $ingress.hosts.core }} {{- end }} {{- if .Values.notary.enabled }} - http: paths: - path: / backend: serviceName: {{ template "harbor.notary-server" . }} servicePort: 4443 {{- if $ingress.hosts.notary }} host: {{ $ingress.hosts.notary }} {{- end }} {{- end }} {{- end }} --- apiVersion: bcc.bd-apaas.com/v1alpha1 kind: IngressRoute metadata: name: harbor-ingress namespace: {{ .Release.Namespace }} spec: entryPoints: - websecure routes: - kind: Rule match: Host(`{{ $ingress.hosts.core }}`) && PathPrefix(`/`) middlewares: [] priority: 0 services: - kind: Service name: harbor-portal namespace: devops port: 80 - kind: Rule match: Host(`{{ $ingress.hosts.core }}`) && PathPrefix(`/api/`) middlewares: [] priority: 0 services: - kind: Service name: harbor-core namespace: devops port: 80 - kind: Rule match: Host(`{{ $ingress.hosts.core }}`) && PathPrefix(`/service/`) middlewares: [] priority: 0 services: - kind: Service name: harbor-core namespace: devops port: 80 - kind: Rule match: Host(`{{ $ingress.hosts.core }}`) && PathPrefix(`/v2/`) middlewares: [] priority: 0 services: - kind: Service name: harbor-core namespace: devops port: 80 - kind: Rule match: Host(`{{ $ingress.hosts.core }}`) && PathPrefix(`/chartrepo/`) middlewares: [] priority: 0 services: - kind: Service name: harbor-core namespace: devops port: 80 - kind: Rule match: Host(`{{ $ingress.hosts.core }}`) && PathPrefix(`/c/`) middlewares: [] priority: 0 services: - kind: Service name: harbor-core namespace: devops port: 80 - kind: Rule match: Host(`{{ $ingress.hosts.core }}`) && PathPrefix(`/`) middlewares: [] priority: 0 services: - kind: Service name: harbor-notary-server namespace: devops port: 4443 tls: certResolver: default --- apiVersion: bcc.bd-apaas.com/v1alpha1 kind: IngressHost metadata: name: harbor namespace: {{ .Release.Namespace }} spec: host: {{ $ingress.hosts.core }