Commit 79aa2a83 authored by root's avatar root

v2.1.1 add ingress router support

parent 29823ad3
......@@ -5,9 +5,9 @@
```bash
# 1.install
helm install \
--namespace=devops \
harbor \
/etc/kubernetes/helm/harbor \
--namespace=devops \
-f /etc/kubernetes/helm/harbor/values-overrides.yaml
# uninstall
......@@ -16,15 +16,17 @@ helm uninstall \
harbor
# update
helm upgrade harbor /etc/kubernetes/helm/harbor \
helm upgrade \
--namespace=devops \
harbor \
/etc/kubernetes/helm/harbor \
-f /etc/kubernetes/helm/harbor/values-overrides.yaml
# template
helm template \
/etc/kubernetes/helm/harbor \
--name=harbor \
--namespace=devops \
harbor \
/etc/kubernetes/helm/harbor \
-f /etc/kubernetes/helm/harbor/values-overrides.yaml > /etc/kubernetes/helm/harbor/dist.yaml
```
......
{{- if not .Capabilities.APIVersions.Has "bcc.bd-apaas.com/v1alpha1/IngressRoute" -}}
{{- if eq .Values.expose.type "ingress" }}
{{- $ingress := .Values.expose.ingress -}}
{{- $tls := .Values.expose.tls -}}
......@@ -131,3 +132,4 @@ spec:
{{- end }}
{{- end }}
{{- end -}}
\ No newline at end of file
{{- $_ := 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
kind: IngressRoute
metadata:
name: "{{ template "harbor.ingress" . }}"
annotations:
{{- with .Values.expose.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{ include "harbor.labels" . | indent 4 }}
spec:
entryPoints:
- websecure
routes:
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .portal_path }}`)
kind: Rule
services:
- name: {{ template "harbor.portal" . }}
port: {{ template "harbor.portal.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .api_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .service_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .v2_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .chartrepo_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .controller_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.notary }}`) && PathPrefix(`{{ .notary_path }}`)
kind: Rule
services:
- name: {{ template "harbor.notary-server" . }}
port: 4443
tls:
certResolver: default
---
apiVersion: bcc.bd-apaas.com/v1alpha1
kind: IngressRoute
metadata:
name: "{{ template "harbor.ingress" . }}-http"
annotations:
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{ include "harbor.labels" . | indent 4 }}
spec:
entryPoints:
- web
routes:
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .portal_path }}`)
kind: Rule
services:
- name: {{ template "harbor.portal" . }}
port: {{ template "harbor.portal.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .api_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .service_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .v2_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .chartrepo_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.core }}`) && PathPrefix(`{{ .controller_path }}`)
kind: Rule
services:
- name: {{ template "harbor.core" . }}
port: {{ template "harbor.core.servicePort" . }}
- match: Host(`{{ .Values.expose.ingress.hosts.notary }}`) && PathPrefix(`{{ .notary_path }}`)
kind: Rule
services:
- name: {{ template "harbor.notary-server" . }}
port: 4443
{{- end -}}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment