2022-10-31 15:52:45 +00:00
{{- 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 -}}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
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 }}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
defaultBackend :
service :
name : {{ $serviceName }}
port :
number : {{ $servicePort }}
{{- else }}
backend :
serviceName : {{ $serviceName }}
servicePort : {{ $servicePort }}
{{- end }}
{{- end }}
rules :
{{- if .Values.ingress.hosts }}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
{{- 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 }}
2023-09-13 13:36:39 +00:00
{{- 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 }}
2022-10-31 15:52:45 +00:00
{{- 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 -}}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
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 }}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
defaultBackend :
service :
name : {{ $serviceName }}
port :
number : {{ $servicePort }}
{{- else }}
backend :
serviceName : {{ $serviceName }}
servicePort : {{ $servicePort }}
{{- end }}
{{- end }}
rules :
{{- if .Values.artifactory.replicator.ingress.hosts }}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
{{- 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 -}}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
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 }}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
defaultBackend :
service :
name : {{ $serviceName }}
port :
number : {{ $servicePort }}
{{- else }}
backend :
serviceName : {{ $serviceName }}
servicePort : {{ $servicePort }}
{{- end }}
{{- end }}
rules :
{{- if .Values.artifactory.replicator.trackerIngress.hosts }}
2023-01-31 17:20:39 +00:00
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
2022-10-31 15:52:45 +00:00
{{- 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 -}}