{{- if eq .Values.rabbitmq.env "prod" }}
apiVersion: v1
kind: Service
metadata:
  name: prod-rabbitmq-nodeport
  namespace: rabbitmq
spec:
  ports:
  - name: amqp
    nodePort: 30672
    port: 5672
    protocol: TCP
    targetPort: 5672
  - name: amqp-http
    nodePort: 30673
    port: 15672
    protocol: TCP
    targetPort: 15672
  selector:
    app.kubernetes.io/instance: prod-rabbitmq
    app.kubernetes.io/name: rabbitmq
  type: NodePort
{{- else if eq .Values.rabbitmq.env "staging" }}
apiVersion: v1
kind: Service
metadata:
  name: staging-rabbitmq-nodeport
  namespace: rabbitmq
spec:
  ports:
  - name: amqp
    nodePort: 31672
    port: 5672
    protocol: TCP
    targetPort: 5672
  - name: amqp-http
    nodePort: 31673
    port: 15672
    protocol: TCP
    targetPort: 15672
  selector:
    app.kubernetes.io/instance: staging-rabbitmq
    app.kubernetes.io/name: rabbitmq
  type: NodePort
{{- end }}
