{{- /*
{{- if .Values.enabled.ingress }}
  {{- $namespace := .Release.Namespace -}}
  {{- $applicationName := .Values.deploy.name -}}
  {{- $domain := ternary (first (regexSplit ":" .Values.global.domain.DeployDomainName -1)) ( .Values.global.domain.DeployDomainName ) (contains ":" .Values.global.domain.DeployDomainName) -}}

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ $applicationName }}-ingress
  namespace: {{ $namespace }}
  labels:
  {{- include "srs.labels.standard" . | nindent 4 }}
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      if ($request_uri ~* ^/console){
        return 403;
      }

spec:
  {{- if .Values.deploy.k8s.ingress.tls.enabled }}
  tls:
    - hosts:
        - live.{{ $domain }}
        - live-op.{{ $domain }}
        - live-api.{{ $domain }}
        {{- if .Values.enabled.nginx }}
        - live-hls.{{ $domain }}
      {{- end }}
      secretName: x.{{ $domain }}-tls
  {{- end }}

  rules:
    - host: live.{{ $domain }}
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              {{- if .Values.enabled.cluster }}
              serviceName: {{ $applicationName }}-edge-svc
              {{- else }}
              serviceName: {{ $applicationName }}-rtc-svc
              {{- end }}
              servicePort: {{ .Values.apps.srs.ports.flv }}

          - path: /rtc/v1
            pathType: ImplementationSpecific
            backend:
              {{- if .Values.enabled.cluster }}
              serviceName: {{ $applicationName }}-origin-svc
              {{- else }}
              serviceName: {{ $applicationName }}-rtc-svc
              {{- end }}
              servicePort: {{ .Values.apps.srs.ports.api }}

    - host: live-op.{{ $domain }}
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              serviceName: {{ $applicationName }}-op-svc
              servicePort: 8080

    - host: live-api.{{ $domain }}
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              {{- if .Values.enabled.cluster }}
              serviceName: {{ $applicationName }}-origin-svc
              {{- else }}
              serviceName: {{ $applicationName }}-rtc-svc
              {{- end }}
              servicePort: {{ .Values.apps.srs.ports.api }}

    {{- if .Values.enabled.nginx }}
    - host: live-hls.{{ $domain }}
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              {{- if .Values.enabled.cluster }}
              serviceName: {{ .Values.apps.srs.service.headless.og }}
              {{- else }}
              serviceName: {{ .Values.apps.srs.service.headless.rtc }}
              {{- end }}
              servicePort: {{ .Values.apps.srs.ports.flv }}
  {{- end }}

---
  {{- end }}*/}}
