From f52b9066e9240eeefbb8afd64c489bf96c3660dc Mon Sep 17 00:00:00 2001 From: Chinmaya <1096515+chinmaya-n@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:46:30 -0400 Subject: [PATCH] Add service type LoadBalancer --- charts/maildev/templates/smtp/service.yaml | 13 +++++++++---- charts/maildev/values.schema.json | 8 +++++++- charts/maildev/values.yaml | 8 ++++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/charts/maildev/templates/smtp/service.yaml b/charts/maildev/templates/smtp/service.yaml index 5779b08..bd42ee6 100644 --- a/charts/maildev/templates/smtp/service.yaml +++ b/charts/maildev/templates/smtp/service.yaml @@ -3,7 +3,11 @@ kind: Service metadata: name: {{ include "maildev.smtp.serviceName" . }} labels: - {{- include "maildev.labels" . | nindent 4 }}s + {{- include "maildev.labels" . | nindent 4 }} + {{- if .Values.services.smtp.annotations }} + annotations: + {{- toYaml .Values.services.smtp.annotations | nindent 4 }} + {{- end }} spec: type: {{ .Values.services.smtp.type }} ports: @@ -11,10 +15,11 @@ spec: targetPort: smtp protocol: TCP name: smtp - {{- if (eq .Values.services.smtp.type "NodePort") }} - {{- if .Values.services.smtp.nodePort }} + {{- if and (eq .Values.services.smtp.type "NodePort") .Values.services.smtp.nodePort }} nodePort: {{ .Values.services.smtp.nodePort }} {{- end }} - {{- end }} + {{- if and (eq .Values.services.smtp.type "LoadBalancer") .Values.services.smtp.loadBalancerIP }} + loadBalancerIP: {{ .Values.services.smtp.loadBalancerIP | quote }} + {{- end }} selector: {{- include "maildev.selectorLabels" . | nindent 4 }} diff --git a/charts/maildev/values.schema.json b/charts/maildev/values.schema.json index 6406dae..fc35a30 100644 --- a/charts/maildev/values.schema.json +++ b/charts/maildev/values.schema.json @@ -359,13 +359,19 @@ "type": "object", "properties": { "nodePort": { - "type": "integer" + "type": "string" }, "port": { "type": "integer" }, "type": { "type": "string" + }, + "loadBalancerIP": { + "type": "string" + }, + "annotations": { + "type": "object" } } }, diff --git a/charts/maildev/values.yaml b/charts/maildev/values.yaml index de02059..93aca85 100644 --- a/charts/maildev/values.yaml +++ b/charts/maildev/values.yaml @@ -68,12 +68,16 @@ services: # -- Kubernetes port to use for the web GUI port: 1080 smtp: - # -- Kubernetes service type for the SMTP server + # -- Kubernetes service type for the SMTP server. One of NodePort, LoadBalancer, or ClusterIP type: ClusterIP # -- Kubernetes port to use for the internal SMTP server port: 1025 # -- You can set the node port for the external SMTP server that should be used or leave it blank to get a random node port. Only active if `services.smtp.type == NodePort` - nodePort: + nodePort: "" + # -- Annotations to be added to the service + annotations: {} + # -- loadBalancerIP if services.smtp.type is LoadBalancer + loadBalancerIP: "" ingress: # -- Enable ingress record generation