rancher-partner-charts/charts/jfrog/artifactory-ha/107.77.11/templates/ingress.yaml

257 lines
8.9 KiB
YAML

{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "artifactory-ha.fullname" . -}}
{{- $servicePort := .Values.artifactory.externalPort -}}
{{- $artifactoryServicePort := .Values.artifactory.externalArtifactoryPort -}}
{{- $ingressName := default ( include "artifactory-ha.fullname" . ) .Values.ingress.name -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $ingressName }}
labels:
app: {{ template "artifactory-ha.name" . }}
chart: {{ template "artifactory-ha.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.ingress.labels }}
{{ .Values.ingress.labels | toYaml | trimSuffix "\n"| indent 4 -}}
{{- end}}
{{- if .Values.ingress.annotations }}
annotations:
{{ .Values.ingress.annotations | toYaml | trimSuffix "\n" | indent 4 -}}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18.0-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.defaultBackend.enabled }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
defaultBackend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- else }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
rules:
{{- if .Values.ingress.hosts }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host | quote }}
http:
paths:
- path: {{ $.Values.ingress.routerPath }}
pathType: ImplementationSpecific
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
- path: {{ $.Values.ingress.artifactoryPath }}
pathType: ImplementationSpecific
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $artifactoryServicePort }}
{{- if and $.Values.federation.enabled (not (regexMatch "^.*(oss|cpp-ce|jcr).*$" $.Values.artifactory.image.repository)) }}
- path: {{ $.Values.ingress.rtfsPath }}
pathType: ImplementationSpecific
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $.Values.federation.internalPort }}
{{- end }}
{{- end }}
{{- else }}
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host | quote }}
http:
paths:
- path: {{ $.Values.ingress.routerPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
- path: {{ $.Values.ingress.artifactoryPath }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $artifactoryServicePort }}
{{- end }}
{{- end }}
{{- end -}}
{{- with .Values.ingress.additionalRules }}
{{ tpl . $ | indent 2 }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- if and .Values.artifactory.replicator.enabled .Values.artifactory.replicator.ingress.enabled }}
---
{{- $replicationIngressName := default ( include "artifactory-ha.replicator.fullname" . ) .Values.artifactory.replicator.ingress.name -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $replicationIngressName }}
labels:
app: "{{ template "artifactory-ha.name" $ }}"
chart: "{{ template "artifactory-ha.chart" $ }}"
release: {{ $.Release.Name | quote }}
heritage: {{ $.Release.Service | quote }}
{{- if .Values.artifactory.replicator.ingress.annotations }}
annotations:
{{ .Values.artifactory.replicator.ingress.annotations | toYaml | trimSuffix "\n" | indent 4 -}}
{{- end }}
spec:
{{- if and (or .Values.ingress.className .Values.artifactory.replicator.ingress.className) (semverCompare ">=1.18.0-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ default .Values.ingress.className .Values.artifactory.replicator.ingress.className }}
{{- end }}
{{- if .Values.ingress.defaultBackend.enabled }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
defaultBackend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- else }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
rules:
{{- if .Values.artifactory.replicator.ingress.hosts }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
{{- range $host := .Values.artifactory.replicator.ingress.hosts }}
- host: {{ $host | quote }}
http:
paths:
- path: /replicator/
pathType: ImplementationSpecific
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
- path: /artifactory/api/replication/replicate/file/streaming
pathType: ImplementationSpecific
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- end }}
{{- else }}
{{- range $host := .Values.artifactory.replicator.ingress.hosts }}
- host: {{ $host | quote }}
http:
paths:
- path: /replicator/
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
- path: /artifactory/api/replication/replicate/file/streaming
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end -}}
{{- if .Values.artifactory.replicator.ingress.tls }}
tls:
{{ toYaml .Values.artifactory.replicator.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
{{- if and .Values.artifactory.replicator.enabled .Values.artifactory.replicator.trackerIngress.enabled }}
---
{{- $replicatorTrackerIngressName := default ( include "artifactory-ha.replicator.tracker.fullname" . ) .Values.artifactory.replicator.trackerIngress.name -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $replicatorTrackerIngressName }}
labels:
app: "{{ template "artifactory-ha.name" $ }}"
chart: "{{ template "artifactory-ha.chart" $ }}"
release: {{ $.Release.Name | quote }}
heritage: {{ $.Release.Service | quote }}
{{- if .Values.artifactory.replicator.trackerIngress.annotations }}
annotations:
{{ .Values.artifactory.replicator.trackerIngress.annotations | toYaml | trimSuffix "\n" | indent 4 -}}
{{- end }}
spec:
{{- if and (or .Values.ingress.className .Values.artifactory.replicator.trackerIngress.className) (semverCompare ">=1.18.0-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ default .Values.ingress.className .Values.artifactory.replicator.trackerIngress.className }}
{{- end }}
{{- if .Values.ingress.defaultBackend.enabled }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
defaultBackend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- else }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
rules:
{{- if .Values.artifactory.replicator.trackerIngress.hosts }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
{{- range $host := .Values.artifactory.replicator.trackerIngress.hosts }}
- host: {{ $host | quote }}
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- end }}
{{- else }}
{{- range $host := .Values.artifactory.replicator.trackerIngress.hosts }}
- host: {{ $host | quote }}
http:
paths:
- path: /
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end -}}
{{- if .Values.artifactory.replicator.trackerIngress.tls }}
tls:
{{ toYaml .Values.artifactory.replicator.trackerIngress.tls | indent 4 }}
{{- end -}}
{{- end -}}
{{- if .Values.customIngress }}
---
{{ .Values.customIngress | toYaml | trimSuffix "\n" }}
{{- end -}}
{{- end -}}