ingress.yaml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {{- if .Values.ingress.enabled -}}
  2. {{- $apiVersions := .Capabilities.APIVersions -}}
  3. {{- $serviceName := include "docker-registry.fullname" . -}}
  4. {{- $servicePort := .Values.service.port -}}
  5. {{- $path := .Values.ingress.path -}}
  6. apiVersion: {{- if $apiVersions.Has "networking.k8s.io/v1" }} networking.k8s.io/v1 {{- else }} networking.k8s.io/v1beta1 {{- end }}
  7. kind: Ingress
  8. metadata:
  9. name: {{ template "docker-registry.fullname" . }}
  10. namespace: {{ .Values.namespace | default .Release.Namespace }}
  11. labels:
  12. app: {{ template "docker-registry.name" . }}
  13. chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
  14. release: {{ .Release.Name }}
  15. heritage: {{ .Release.Service }}
  16. {{- if .Values.ingress.labels }}
  17. {{ toYaml .Values.ingress.labels | indent 4 }}
  18. {{- end }}
  19. annotations:
  20. {{- range $key, $value := .Values.ingress.annotations }}
  21. {{ $key }}: {{ $value | quote }}
  22. {{- end }}
  23. spec:
  24. {{- if $apiVersions.Has "networking.k8s.io/v1" }}
  25. ingressClassName: {{ .Values.ingress.className }}
  26. {{- end }}
  27. rules:
  28. {{- range $host := .Values.ingress.hosts }}
  29. - host: {{ $host }}
  30. http:
  31. paths:
  32. - path: {{ $path }}
  33. {{- if $apiVersions.Has "networking.k8s.io/v1" }}
  34. pathType: Prefix
  35. backend:
  36. service:
  37. name: {{ $serviceName }}
  38. port:
  39. number: {{ $servicePort }}
  40. {{- else }}
  41. backend:
  42. serviceName: {{ $serviceName }}
  43. servicePort: {{ $servicePort }}
  44. {{- end }}
  45. {{- end -}}
  46. {{- if .Values.ingress.tls }}
  47. tls:
  48. {{ toYaml .Values.ingress.tls | indent 4 }}
  49. {{- end -}}
  50. {{- end -}}