jenkins-controller-ingress.yaml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
  2. {{- if .Values.controller.ingress.enabled }}
  3. {{- if semverCompare ">=1.19-0" $kubeTargetVersion -}}
  4. apiVersion: networking.k8s.io/v1
  5. {{- else if semverCompare ">=1.14-0" $kubeTargetVersion -}}
  6. apiVersion: networking.k8s.io/v1beta1
  7. {{- else -}}
  8. apiVersion: {{ .Values.controller.ingress.apiVersion }}
  9. {{- end }}
  10. kind: Ingress
  11. metadata:
  12. namespace: {{ template "jenkins.namespace" . }}
  13. labels:
  14. "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
  15. {{- if .Values.renderHelmLabels }}
  16. "helm.sh/chart": "{{ template "jenkins.label" .}}"
  17. {{- end }}
  18. "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
  19. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  20. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  21. {{- if .Values.controller.ingress.labels }}
  22. {{ toYaml .Values.controller.ingress.labels | indent 4 }}
  23. {{- end }}
  24. {{- if .Values.controller.ingress.annotations }}
  25. annotations:
  26. {{ toYaml .Values.controller.ingress.annotations | indent 4 }}
  27. {{- end }}
  28. name: {{ template "jenkins.fullname" . }}
  29. spec:
  30. {{- if .Values.controller.ingress.ingressClassName }}
  31. ingressClassName: {{ .Values.controller.ingress.ingressClassName | quote }}
  32. {{- end }}
  33. rules:
  34. - http:
  35. paths:
  36. {{- if empty (.Values.controller.ingress.paths) }}
  37. - backend:
  38. {{- if semverCompare ">=1.19-0" $kubeTargetVersion }}
  39. service:
  40. name: {{ template "jenkins.fullname" . }}
  41. port:
  42. number: {{ .Values.controller.servicePort }}
  43. pathType: ImplementationSpecific
  44. {{- else }}
  45. serviceName: {{ template "jenkins.fullname" . }}
  46. servicePort: {{ .Values.controller.servicePort }}
  47. {{- end }}
  48. {{- if .Values.controller.ingress.path }}
  49. path: {{ .Values.controller.ingress.path }}
  50. {{- end -}}
  51. {{- else }}
  52. {{ tpl (toYaml .Values.controller.ingress.paths | indent 6) . }}
  53. {{- end -}}
  54. {{- if .Values.controller.ingress.hostName }}
  55. host: {{ tpl .Values.controller.ingress.hostName . | quote }}
  56. {{- end }}
  57. {{- if .Values.controller.ingress.resourceRootUrl }}
  58. - http:
  59. paths:
  60. - backend:
  61. {{- if semverCompare ">=1.19-0" $kubeTargetVersion }}
  62. service:
  63. name: {{ template "jenkins.fullname" . }}
  64. port:
  65. number: {{ .Values.controller.servicePort }}
  66. pathType: ImplementationSpecific
  67. {{- else }}
  68. serviceName: {{ template "jenkins.fullname" . }}
  69. servicePort: {{ .Values.controller.servicePort }}
  70. {{- end }}
  71. host: {{ tpl .Values.controller.ingress.resourceRootUrl . | quote }}
  72. {{- end }}
  73. {{- if .Values.controller.ingress.tls }}
  74. tls:
  75. {{ tpl (toYaml .Values.controller.ingress.tls ) . | indent 4 }}
  76. {{- end -}}
  77. {{- end }}