jenkins-controller-secondary-ingress.yaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. {{- if .Values.controller.secondaryingress.enabled }}
  2. {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
  3. {{- $serviceName := include "jenkins.fullname" . -}}
  4. {{- $servicePort := .Values.controller.servicePort -}}
  5. {{- if semverCompare ">=1.19-0" $kubeTargetVersion -}}
  6. apiVersion: networking.k8s.io/v1
  7. {{- else if semverCompare ">=1.14-0" $kubeTargetVersion -}}
  8. apiVersion: networking.k8s.io/v1beta1
  9. {{- else -}}
  10. apiVersion: {{ .Values.controller.secondaryingress.apiVersion }}
  11. {{- end }}
  12. kind: Ingress
  13. metadata:
  14. namespace: {{ template "jenkins.namespace" . }}
  15. labels:
  16. "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
  17. {{- if .Values.renderHelmLabels }}
  18. "helm.sh/chart": "{{ template "jenkins.label" .}}"
  19. {{- end }}
  20. "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
  21. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  22. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  23. {{- if .Values.controller.secondaryingress.labels -}}
  24. {{ toYaml .Values.controller.secondaryingress.labels | nindent 4 }}
  25. {{- end }}
  26. {{- if .Values.controller.secondaryingress.annotations }}
  27. annotations: {{ toYaml .Values.controller.secondaryingress.annotations | nindent 4 }}
  28. {{- end }}
  29. name: {{ template "jenkins.fullname" . }}-secondary
  30. spec:
  31. {{- if .Values.controller.secondaryingress.ingressClassName }}
  32. ingressClassName: {{ .Values.controller.secondaryingress.ingressClassName | quote }}
  33. {{- end }}
  34. rules:
  35. - host: {{ .Values.controller.secondaryingress.hostName }}
  36. http:
  37. paths:
  38. {{- range .Values.controller.secondaryingress.paths }}
  39. - path: {{ . | quote }}
  40. backend:
  41. {{ if semverCompare ">=1.19-0" $kubeTargetVersion }}
  42. service:
  43. name: {{ $serviceName }}
  44. port:
  45. number: {{ $servicePort }}
  46. pathType: ImplementationSpecific
  47. {{ else }}
  48. serviceName: {{ $serviceName }}
  49. servicePort: {{ $servicePort }}
  50. {{ end }}
  51. {{- end}}
  52. {{- if .Values.controller.secondaryingress.tls }}
  53. tls:
  54. {{ toYaml .Values.controller.secondaryingress.tls | indent 4 }}
  55. {{- end -}}
  56. {{- end }}