{{- if .Values.ingress.enabled -}} {{- $fullName := include "my-bloody-jenkins.fullname" . -}} {{- 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: {{ $fullName }} labels: app: {{ template "my-bloody-jenkins.name" . }} chart: {{ template "my-bloody-jenkins.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- with .Values.ingress.labels }} {{ toYaml . | indent 4 }} {{- end }} {{- with .Values.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} {{- end }} spec: {{- if .Values.ingress.ingressClassName }} ingressClassName: {{ .Values.ingress.ingressClassName }} {{- end }} {{- if .Values.ingress.tls }} tls: - hosts: - {{ .Values.ingress.hostname }} {{- if .Values.ingress.tls.secretName }} secretName: {{ .Values.ingress.tls.secretName }} {{- else if (and .Values.ingress.tls.certificate .Values.ingress.tls.privateKey) }} secretName: {{ template "my-bloody-jenkins.tlsSecretName" . }} {{- end }} {{- end }} rules: {{- if .Values.ingress.preAdditionalRules }} {{ toYaml .Values.ingress.preAdditionalRules | indent 2 }} {{- end }} - http: paths: - path: {{ .Values.ingress.path }} {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }} pathType: {{ .Values.ingress.pathType }} backend: service: name: {{ $fullName }} port: name: http {{ else }} backend: serviceName: {{ $fullName }} servicePort: http {{- end }} {{- if .Values.ingress.hostname }} host: {{ .Values.ingress.hostname }} {{- end }} {{- if .Values.ingress.additionalRules }} {{ toYaml .Values.ingress.additionalRules | indent 2 }} {{- end }} {{- end }}