{{- if .Values.ingress.enabled -}}
{{- $fullName := include "cla-frontend.fullname" . -}}
{{- $svcPort := .Values.service.port -}}

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include "cla-frontend.labels" . | nindent 4 }}
  annotations:
    nginx.ingress.kubernetes.io/whitelist-source-range: "{{ include "cla-frontend.whitelist" . }}"
    nginx.ingress.kubernetes.io/server-snippets: |
      location /socket.io {
        proxy_pass http://nodejs';
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        # proxy_set_header X-Forwarded-Host $http_host;
        # proxy_set_header X-Forwarded-Proto $scheme;
        # proxy_set_header X-Forwarded-For $remote_addr;
        # proxy_cache_bypass $http_upgrade;
       }
spec:
  tls:
    - hosts:
       - "{{ .Values.host }}"
      {{- if .Values.secretName }}
      secretName: {{ .Values.secretName }}
      {{- end }}
  rules:
    - host: "{{ .Values.host }}"
      http:
        paths:
          - path: "/"
            backend:
              serviceName: {{ $fullName }}-app
              servicePort: {{ .Values.service.port }}
          - path: "/socket.io/"
            backend:
              serviceName: {{ $fullName }}-socket-server
              servicePort: {{ .Values.socketServer.service.port }}
{{- end }}

{{- if .Values.ingress.enabled -}}
{{- $fullName := include "cla-frontend.fullname" . -}}
{{- $svcPort := .Values.service.port -}}

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include "cla-frontend.labels" . | nindent 4 }}
  annotations:
    nginx.ingress.kubernetes.io/whitelist-source-range: "{{ include "cla-frontend.whitelist" . }}"
    nginx.ingress.kubernetes.io/server-snippets: |
      location /socket.io {
        proxy_pass http://nodejs';
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
      }
spec:
  tls:
    - hosts:
       - "{{ .Values.host }}"
      {{- if .Values.secretName }}
      secretName: {{ .Values.secretName }}
      {{- end }}
  rules:
    - host: "{{ .Values.host }}"
      http:
        paths:
          - path: "/"
            backend:
              serviceName: {{ $fullName }}-app
              servicePort: {{ .Values.service.port }}
          - path: "/socket.io/"
            backend:
              serviceName: {{ $fullName }}-socket-server
              servicePort: {{ .Values.socketServer.service.port }}
{{- end }}

Remove unused bits of nginx annotation
Remove unused bits of nginx annotation
