Skip to content
Snippets Groups Projects
ingress.yaml 2.55 KiB
Newer Older
  • Learn to ignore specific revisions
  • Alex Dunn's avatar
    Alex Dunn committed
    {{- if .Values.ingress.enabled -}}
    {{- $fullName := include "mastodon.fullname" . -}}
    
    {{- $webPort := .Values.mastodon.web.port -}}
    {{- $streamingPort := .Values.mastodon.streaming.port -}}
    
    {{- if or (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (not (.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress")) }}
    apiVersion: networking.k8s.io/v1
    {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
    
    Alex Dunn's avatar
    Alex Dunn committed
    apiVersion: networking.k8s.io/v1beta1
    {{- else -}}
    apiVersion: extensions/v1beta1
    {{- end }}
    kind: Ingress
    metadata:
      name: {{ $fullName }}
      labels:
        {{- include "mastodon.labels" . | nindent 4 }}
      {{- with .Values.ingress.annotations }}
      annotations:
        {{- toYaml . | nindent 4 }}
      {{- end }}
    spec:
      {{- if .Values.ingress.tls }}
      tls:
        {{- range .Values.ingress.tls }}
        - hosts:
            {{- range .hosts }}
            - {{ . | quote }}
            {{- end }}
          secretName: {{ .secretName }}
        {{- end }}
      {{- end }}
      rules:
    
        {{- range .Values.ingress.hosts }}
        - host: {{ .host | quote }}
    
    Alex Dunn's avatar
    Alex Dunn committed
          http:
            paths:
    
              {{- range .paths }}
              - path: {{ .path }}
    
    Alex Dunn's avatar
    Alex Dunn committed
                backend:
    
                  {{- if or ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (not ($.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress")) }}
                  service:
                    name: {{ $fullName }}-web
                    port:
                      number: {{ $webPort }}
                  {{- else }}
    
    Alex Dunn's avatar
    Alex Dunn committed
                  serviceName: {{ $fullName }}-web
    
                  servicePort: {{ $webPort }}
    
                  {{- end }}
                {{- if or ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (not ($.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress")) }}
    
                pathType: Prefix
    
                {{- end }}
    
              - path: {{ .path }}api/v1/streaming/
    
    Alex Dunn's avatar
    Alex Dunn committed
                backend:
    
                  {{- if or ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (not ($.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress")) }}
                  service:
                    name: {{ $fullName }}-streaming
                    port:
                      number: {{ $streamingPort }}
                  {{- else }}
    
    Alex Dunn's avatar
    Alex Dunn committed
                  serviceName: {{ $fullName }}-streaming
    
                  servicePort: {{ $streamingPort }}
    
                  {{- end }}
                {{- if or ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") (not ($.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress")) }}
    
                pathType: Exact
    
                {{- end }}
    
              {{- end }}
        {{- end }}
    
    Alex Dunn's avatar
    Alex Dunn committed
    {{- end }}