diff --git a/Deploy.md b/Deploy.md index 075dd49a5c186774ea03452ed32fcfd111ff26e8..04b25832520579dd1c8bbeb6367313ba2cae6787 100644 --- a/Deploy.md +++ b/Deploy.md @@ -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 ``` diff --git a/templates/ingress/ingress.yaml b/templates/ingress/ingress.yaml index 863e91f39cc4aac7ae5f606f0c6792a3033dc896..e6a12dfc097a77e745ba473aa9378fb58474e7be 100644 --- a/templates/ingress/ingress.yaml +++ b/templates/ingress/ingress.yaml @@ -1,3 +1,4 @@ +{{- 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 diff --git a/templates/ingress/ingressroute.yaml b/templates/ingress/ingressroute.yaml new file mode 100644 index 0000000000000000000000000000000000000000..faa01698c091f62a847811b1c372838d1a6bb2af --- /dev/null +++ b/templates/ingress/ingressroute.yaml @@ -0,0 +1,112 @@ +{{- $_ := 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 -}}