# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Service
metadata:
  name: {{ template "aether-enterprise-portal.fullname" . }}
  labels:
    app: {{ template "aether-enterprise-portal.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
    {{- include "aether-enterprise-portal.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  selector:
    name: {{ template "aether-enterprise-portal.fullname" . }}
    app: aether
    type: arg
    resource: {{ template "aether-enterprise-portal.fullname" . }}
    {{- include "aether-enterprise-portal.selectorLabels" . | nindent 4 }}
  ports:
    - name: web
      port: 80
---
{{- if .Values.service.external.nodePort }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "aether-enterprise-portal.fullname" . }}-external
  labels:
    app: {{ template "aether-enterprise-portal.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
    {{- include "aether-enterprise-portal.labels" . | nindent 4 }}
spec:
  type: NodePort
  selector:
    name: {{ template "aether-enterprise-portal.fullname" . }}
    app: aether
    type: arg
    resource: {{ template "aether-enterprise-portal.fullname" . }}
    {{- include "aether-enterprise-portal.selectorLabels" . | nindent 4 }}
  ports:
    - name: web
      port: 80
      nodePort: {{ .Values.service.external.nodePort }}
      protocol: TCP
{{- end }}
