From 37ddd6d1e2364c33a201d4c50b0aeba175455e04 Mon Sep 17 00:00:00 2001
From: groundhog2k <10630407+groundhog2k@users.noreply.github.com>
Date: Mon, 14 Dec 2020 22:50:55 +0100
Subject: [PATCH] Improved service configuration (#149)

---
 charts/mariadb/Chart.yaml              |  2 +-
 charts/mariadb/README.md               |  7 ++++---
 charts/mariadb/templates/service.yaml  |  7 +++++--
 charts/mariadb/values.yaml             |  6 ++++--
 charts/mongodb/Chart.yaml              |  2 +-
 charts/mongodb/README.md               |  7 ++++---
 charts/mongodb/templates/service.yaml  |  7 +++++--
 charts/mongodb/values.yaml             |  6 ++++--
 charts/postgres/Chart.yaml             |  2 +-
 charts/postgres/README.md              |  7 ++++---
 charts/postgres/templates/service.yaml |  7 +++++--
 charts/postgres/values.yaml            |  6 ++++--
 charts/rabbitmq/Chart.yaml             |  2 +-
 charts/rabbitmq/README.md              |  9 +++++----
 charts/rabbitmq/templates/service.yaml | 11 +++++++----
 charts/rabbitmq/values.yaml            |  8 +++++---
 charts/redis/Chart.yaml                |  2 +-
 charts/redis/README.md                 |  7 ++++---
 charts/redis/templates/service.yaml    |  7 +++++--
 charts/redis/values.yaml               |  6 ++++--
 20 files changed, 74 insertions(+), 44 deletions(-)

diff --git a/charts/mariadb/Chart.yaml b/charts/mariadb/Chart.yaml
index 808d7898..346befe9 100644
--- a/charts/mariadb/Chart.yaml
+++ b/charts/mariadb/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.2.3
+version: 0.2.4
 
 appVersion: "10.5.8"
diff --git a/charts/mariadb/README.md b/charts/mariadb/README.md
index 684e7c99..958bc46e 100644
--- a/charts/mariadb/README.md
+++ b/charts/mariadb/README.md
@@ -1,6 +1,6 @@
 # MariaDB
 
-![Version: 0.2.3](https://img.shields.io/badge/Version-0.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 10.5.8](https://img.shields.io/badge/AppVersion-10.5.8-informational?style=flat-square)
+![Version: 0.2.4](https://img.shields.io/badge/Version-0.2.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 10.5.8](https://img.shields.io/badge/AppVersion-10.5.8-informational?style=flat-square)
 
 A Helm chart for MariaDB on Kubernetes
 
@@ -74,8 +74,9 @@ $ helm uninstall my-release
 |-----|------|---------|-------------|
 | service.type | string | `"ClusterIP"` | Service type |
 | service.port | int | `3306` | MariaDB service port |
-| service.nodePort | int | `nil` | Service node port (only relevant for type NodePort) |
-| service.clusterIP | string | `nil` | Service cluster IP (only relevant for type LoadBalancer) |
+| service.nodePort | int | `nil` | The node port (only relevant for type LoadBalancer or NodePort) |
+| service.clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
+| service.loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer) |
 
 ## Storage parameters
 
diff --git a/charts/mariadb/templates/service.yaml b/charts/mariadb/templates/service.yaml
index 3e1e564f..69af1321 100644
--- a/charts/mariadb/templates/service.yaml
+++ b/charts/mariadb/templates/service.yaml
@@ -11,10 +11,13 @@ spec:
       targetPort: sql
       protocol: TCP
       name: sql
-      {{- if and (eq .Values.service.type "NodePort") (.Values.service.nodePort) }}
+      {{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.nodePort) }}
       nodePort: {{ .Values.service.nodePort }}
       {{- end }}
-  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.clusterIP) }}
+  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.loadBalancerIP) }}
+  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
+  {{- end }}
+  {{- if .Values.service.clusterIP }}
   clusterIP: {{ .Values.service.clusterIP }}
   {{- end }}
   selector:
diff --git a/charts/mariadb/values.yaml b/charts/mariadb/values.yaml
index 5efe3033..72a4c78f 100644
--- a/charts/mariadb/values.yaml
+++ b/charts/mariadb/values.yaml
@@ -44,10 +44,12 @@ securityContext:
 service:
   type: ClusterIP
   port: 3306
-  ## The node port (only relevant for type NodePort)
+  ## The node port (only relevant for type LoadBalancer or NodePort)
   nodePort:
-  ## The cluster ip address (only relevant for type LoadBalancer)
+  ## The cluster ip address (only relevant for type LoadBalancer or NodePort)
   clusterIP:
+  ## The loadbalancer ip address (only relevant for type LoadBalancer)
+  loadBalancerIP:
 
 # Resource limits and requests
 resources: {}
diff --git a/charts/mongodb/Chart.yaml b/charts/mongodb/Chart.yaml
index b3a41908..6cd9a582 100644
--- a/charts/mongodb/Chart.yaml
+++ b/charts/mongodb/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.2.4
+version: 0.2.5
 
 appVersion: 4.2.11
diff --git a/charts/mongodb/README.md b/charts/mongodb/README.md
index 21464270..e4a8ced8 100644
--- a/charts/mongodb/README.md
+++ b/charts/mongodb/README.md
@@ -1,6 +1,6 @@
 # MongoDB
 
-![Version: 0.2.4](https://img.shields.io/badge/Version-0.2.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.2.11](https://img.shields.io/badge/AppVersion-4.2.11-informational?style=flat-square)
+![Version: 0.2.5](https://img.shields.io/badge/Version-0.2.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.2.11](https://img.shields.io/badge/AppVersion-4.2.11-informational?style=flat-square)
 
 A Helm chart for MongoDB on Kubernetes
 
@@ -78,8 +78,9 @@ $ helm uninstall my-release
 |-----|------|---------|-------------|
 | service.type | string | `"ClusterIP"` | Service type |
 | service.port | int | `27017` | MongoDB service port |
-| service.nodePort | int | `nil` | Service node port (only relevant for type NodePort) |
-| service.clusterIP | string | `nil` | Service cluster IP (only relevant for type LoadBalancer) |
+| service.nodePort | int | `nil` | The node port (only relevant for type LoadBalancer or NodePort) |
+| service.clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
+| service.loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer) |
 
 ## Storage parameters
 
diff --git a/charts/mongodb/templates/service.yaml b/charts/mongodb/templates/service.yaml
index 45328e1b..31357c0c 100644
--- a/charts/mongodb/templates/service.yaml
+++ b/charts/mongodb/templates/service.yaml
@@ -11,10 +11,13 @@ spec:
       targetPort: mongodb
       protocol: TCP
       name: mongodb
-      {{- if and (eq .Values.service.type "NodePort") (.Values.service.nodePort) }}
+      {{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.nodePort) }}
       nodePort: {{ .Values.service.nodePort }}
       {{- end }}
-  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.clusterIP) }}
+  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.loadBalancerIP) }}
+  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
+  {{- end }}
+  {{- if .Values.service.clusterIP }}
   clusterIP: {{ .Values.service.clusterIP }}
   {{- end }}
   selector:
diff --git a/charts/mongodb/values.yaml b/charts/mongodb/values.yaml
index ba7a455f..d6abe712 100644
--- a/charts/mongodb/values.yaml
+++ b/charts/mongodb/values.yaml
@@ -45,10 +45,12 @@ securityContext:
 service:
   type: ClusterIP
   port: 27017
-  ## The node port (only relevant for type NodePort)
+  ## The node port (only relevant for type LoadBalancer or NodePort)
   nodePort:
-  ## The cluster ip address (only relevant for type LoadBalancer)
+  ## The cluster ip address (only relevant for type LoadBalancer or NodePort)
   clusterIP:
+  ## The loadbalancer ip address (only relevant for type LoadBalancer)
+  loadBalancerIP:
 
 ## Resource limits and requests
 resources: {}
diff --git a/charts/postgres/Chart.yaml b/charts/postgres/Chart.yaml
index dd92248f..6647b6a2 100644
--- a/charts/postgres/Chart.yaml
+++ b/charts/postgres/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.2.4
+version: 0.2.5
 
 appVersion: "13.1"
diff --git a/charts/postgres/README.md b/charts/postgres/README.md
index 3cd9d916..d5e99e83 100644
--- a/charts/postgres/README.md
+++ b/charts/postgres/README.md
@@ -1,6 +1,6 @@
 # PostgreSQL
 
-![Version: 0.2.4](https://img.shields.io/badge/Version-0.2.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 13.1](https://img.shields.io/badge/AppVersion-13.1-informational?style=flat-square)
+![Version: 0.2.5](https://img.shields.io/badge/Version-0.2.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 13.1](https://img.shields.io/badge/AppVersion-13.1-informational?style=flat-square)
 
 A Helm chart for PostgreSQL on Kubernetes
 
@@ -76,8 +76,9 @@ $ helm uninstall my-release
 |-----|------|---------|-------------|
 | service.type | string | `"ClusterIP"` | Service type |
 | service.port | int | `5432` | PostreSQL service port |
-| service.nodePort | int | `nil` | Service node port (only relevant for type NodePort) |
-| service.clusterIP | string | `nil` | Service cluster IP (only relevant for type LoadBalancer) |
+| service.nodePort | int | `nil` | The node port (only relevant for type LoadBalancer or NodePort) |
+| service.clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
+| service.loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer) |
 
 ## Storage parameters
 
diff --git a/charts/postgres/templates/service.yaml b/charts/postgres/templates/service.yaml
index 8548ec64..d13b907f 100644
--- a/charts/postgres/templates/service.yaml
+++ b/charts/postgres/templates/service.yaml
@@ -11,10 +11,13 @@ spec:
       targetPort: postgres
       protocol: TCP
       name: postgres
-      {{- if and (eq .Values.service.type "NodePort") (.Values.service.nodePort) }}
+      {{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.nodePort) }}
       nodePort: {{ .Values.service.nodePort }}
       {{- end }}
-  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.clusterIP) }}
+  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.loadBalancerIP) }}
+  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
+  {{- end }}
+  {{- if .Values.service.clusterIP }}
   clusterIP: {{ .Values.service.clusterIP }}
   {{- end }}
   selector:
diff --git a/charts/postgres/values.yaml b/charts/postgres/values.yaml
index c5edb4a0..654bba75 100644
--- a/charts/postgres/values.yaml
+++ b/charts/postgres/values.yaml
@@ -42,10 +42,12 @@ securityContext:
 service:
   type: ClusterIP
   port: 5432
-  ## The node port (only relevant for type NodePort)
+  ## The node port (only relevant for type LoadBalancer or NodePort)
   nodePort:
-  ## The cluster ip address (only relevant for type LoadBalancer)
+  ## The cluster ip address (only relevant for type LoadBalancer or NodePort)
   clusterIP:
+  ## The loadbalancer ip address (only relevant for type LoadBalancer)
+  loadBalancerIP:
 
 resources: {}
   # limits:
diff --git a/charts/rabbitmq/Chart.yaml b/charts/rabbitmq/Chart.yaml
index b5fcd811..fb930cc4 100644
--- a/charts/rabbitmq/Chart.yaml
+++ b/charts/rabbitmq/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.2.2
+version: 0.2.3
 
 appVersion: 3.8.9
diff --git a/charts/rabbitmq/README.md b/charts/rabbitmq/README.md
index 8918719f..90693515 100644
--- a/charts/rabbitmq/README.md
+++ b/charts/rabbitmq/README.md
@@ -1,6 +1,6 @@
 # RabbitMQ
 
-![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.8.9](https://img.shields.io/badge/AppVersion-3.8.9-informational?style=flat-square)
+![Version: 0.2.3](https://img.shields.io/badge/Version-0.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.8.9](https://img.shields.io/badge/AppVersion-3.8.9-informational?style=flat-square)
 
 A Helm chart for a RabbitMQ cluster on Kubernetes
 
@@ -77,11 +77,12 @@ $ helm uninstall my-release
 | Key | Type | Default | Description |
 |-----|------|---------|-------------|
 | service.type | string | `"ClusterIP"` | Service type |
-| service.clusterIP | string | `nil` | Service cluster IP (only relevant for type LoadBalancer) |
+| service.clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
+| service.loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer) |
 | service.amqp.port | int | `5672` | AMQP port |
-| service.amqp.nodePort | int | `nil` | Service node port (only relevant for type NodePort) |
+| service.amqp.nodePort | int | `nil` | Service node port (only relevant for type LoadBalancer or NodePort)|
 | service.mgmt.port | int | `15672` | Management UI port |
-| service.mgmt.nodePort | int | `nil` | Service node port (only relevant for type NodePort) |
+| service.mgmt.nodePort | int | `nil` | Service node port (only relevant for type LoadBalancer or NodePort) |
 
 ## Storage parameters
 
diff --git a/charts/rabbitmq/templates/service.yaml b/charts/rabbitmq/templates/service.yaml
index e3fc63b2..59a2dc07 100644
--- a/charts/rabbitmq/templates/service.yaml
+++ b/charts/rabbitmq/templates/service.yaml
@@ -10,17 +10,20 @@ spec:
     - port: {{ .Values.service.amqp.port }}
       targetPort: amqp
       name: amqp
-      {{- if and (eq .Values.service.type "NodePort") (.Values.service.amqp.nodePort) }}
+      {{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.amqp.nodePort) }}
       nodePort: {{ .Values.service.amqp.nodePort }}
       {{- end }}
     - port: {{ .Values.service.mgmt.port }}
       targetPort: mgmt
       name: mgmt
-      {{- if and (eq .Values.service.type "NodePort") (.Values.service.mgmt.nodePort) }}
+      {{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.mgmt.nodePort) }}
       nodePort: {{ .Values.service.mgmt.nodePort }}
       {{- end }}
-  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.clusterIP) }}
+  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.loadBalancerIP) }}
+  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
+  {{- end }}
+  {{- if .Values.service.clusterIP }}
   clusterIP: {{ .Values.service.clusterIP }}
-  {{- end }}      
+  {{- end }}
   selector:
     {{- include "rabbitmq.selectorLabels" . | nindent 4 }}
diff --git a/charts/rabbitmq/values.yaml b/charts/rabbitmq/values.yaml
index fa3e239a..8cbfb5b3 100644
--- a/charts/rabbitmq/values.yaml
+++ b/charts/rabbitmq/values.yaml
@@ -39,14 +39,16 @@ service:
   type: ClusterIP
   amqp:
     port: 5672
-    ## The node port (only relevant for type NodePort)
+    ## The node port (only relevant for type LoadBalancer or NodePort)
     nodePort:
   mgmt:
     port: 15672
-    ## The node port (only relevant for type NodePort)
+    ## The node port (only relevant for type LoadBalancer or NodePort)
     nodePort:
-  ## The cluster ip address (only relevant for type LoadBalancer)
+  ## The cluster ip address (only relevant for type LoadBalancer or NodePort)
   clusterIP:
+  ## The loadbalancer ip address (only relevant for type LoadBalancer)
+  loadBalancerIP:
 
 ## Ingress configuration
 ingress:
diff --git a/charts/redis/Chart.yaml b/charts/redis/Chart.yaml
index b9c821b0..db5f0197 100644
--- a/charts/redis/Chart.yaml
+++ b/charts/redis/Chart.yaml
@@ -8,7 +8,7 @@ maintainers:
   - name: groundhog2k
 
 # This is the chart version
-version: 0.2.3
+version: 0.2.4
 
 # This is the version number of the application being deployed.
 appVersion: "6.0.9"
diff --git a/charts/redis/README.md b/charts/redis/README.md
index d6cf86bf..f5a83eb7 100644
--- a/charts/redis/README.md
+++ b/charts/redis/README.md
@@ -1,6 +1,6 @@
 # Redis
 
-![Version: 0.2.3](https://img.shields.io/badge/Version-0.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.0.9](https://img.shields.io/badge/AppVersion-6.0.9-informational?style=flat-square)
+![Version: 0.2.4](https://img.shields.io/badge/Version-0.2.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.0.9](https://img.shields.io/badge/AppVersion-6.0.9-informational?style=flat-square)
 
 A Helm chart for Redis on Kubernetes
 
@@ -75,8 +75,9 @@ $ helm uninstall my-release
 |-----|------|---------|-------------|
 | service.type | string | `"ClusterIP"` | Service type |
 | service.port | int | `6379` | Redis service port |
-| service.nodePort | int | `nil` | Service node port (only relevant for type NodePort) |
-| service.clusterIP | string | `nil` | Service cluster IP (only relevant for type LoadBalancer) |
+| service.nodePort | int | `nil` | The node port (only relevant for type LoadBalancer or NodePort) |
+| service.clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
+| service.loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer) |
 
 ## Storage parameters
 
diff --git a/charts/redis/templates/service.yaml b/charts/redis/templates/service.yaml
index f22994cf..f6e607dc 100644
--- a/charts/redis/templates/service.yaml
+++ b/charts/redis/templates/service.yaml
@@ -11,10 +11,13 @@ spec:
       targetPort: redis
       protocol: TCP
       name: redis
-      {{- if and (eq .Values.service.type "NodePort") (.Values.service.nodePort) }}
+      {{- if and ( or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") ) (.Values.service.nodePort) }}
       nodePort: {{ .Values.service.nodePort }}
       {{- end }}
-  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.clusterIP) }}
+  {{- if and (eq .Values.service.type "LoadBalancer") (.Values.service.loadBalancerIP) }}
+  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
+  {{- end }}
+  {{- if .Values.service.clusterIP }}
   clusterIP: {{ .Values.service.clusterIP }}
   {{- end }}
   selector:
diff --git a/charts/redis/values.yaml b/charts/redis/values.yaml
index a5f700d4..b243195b 100644
--- a/charts/redis/values.yaml
+++ b/charts/redis/values.yaml
@@ -44,10 +44,12 @@ securityContext:
 service:
   type: ClusterIP
   port: 6379
-  ## The node port (only relevant for type NodePort)
+  ## The node port (only relevant for type LoadBalancer or NodePort)
   nodePort:
-  ## The cluster ip address (only relevant for type LoadBalancer)
+  ## The cluster ip address (only relevant for type LoadBalancer or NodePort)
   clusterIP:
+  ## The loadbalancer ip address (only relevant for type LoadBalancer)
+  loadBalancerIP:
 
 ## Resource limits and requests
 resources: {}
-- 
GitLab