Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 3f8e99e

Browse files
committed
[elasticsearch] add value to disable service
Signed-off-by: nflaig <[email protected]>
1 parent b870c3f commit 3f8e99e

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

elasticsearch/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ support multiple versions with minimal changes.
160160
| `secretMounts` | Allows you easily mount a secret as a file inside the StatefulSet. Useful for mounting certificates and other secrets. See [values.yaml][] for an example | `[]` |
161161
| `securityContext` | Allows you to set the [securityContext][] for the container | see [values.yaml][] |
162162
| `service.annotations` | [LoadBalancer annotations][] that Kubernetes will use for the service. This will configure load balancer if `service.type` is `LoadBalancer` | `{}` |
163+
| `service.enabled` | Enable non-headless service | `true` |
163164
| `service.externalTrafficPolicy` | Some cloud providers allow you to specify the [LoadBalancer externalTrafficPolicy][]. Kubernetes will use this to preserve the client source IP. This will configure load balancer if `service.type` is `LoadBalancer` | `""` |
164165
| `service.httpPortName` | The name of the http port within the service | `http` |
165166
| `service.labelsHeadless` | Labels to be added to headless service | `{}` |

elasticsearch/templates/service.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
{{- if .Values.service.enabled -}}
23
kind: Service
34
apiVersion: v1
45
metadata:
@@ -43,6 +44,7 @@ spec:
4344
{{- if .Values.service.externalTrafficPolicy }}
4445
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
4546
{{- end }}
47+
{{- end -}}
4648
---
4749
kind: Service
4850
apiVersion: v1

elasticsearch/tests/elasticsearch_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,23 @@ def test_scheduler_name():
799799
)
800800

801801

802+
def test_disabling_non_headless_service():
803+
config = ""
804+
805+
r = helm_template(config)
806+
807+
assert uname in r["service"]
808+
809+
config = """
810+
service:
811+
enabled: false
812+
"""
813+
814+
r = helm_template(config)
815+
816+
assert uname not in r["service"]
817+
818+
802819
def test_adding_a_nodePort():
803820
config = ""
804821

elasticsearch/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ httpPort: 9200
180180
transportPort: 9300
181181

182182
service:
183+
enabled: true
183184
labels: {}
184185
labelsHeadless: {}
185186
type: ClusterIP

0 commit comments

Comments
 (0)