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

Commit 5972a4c

Browse files
jmlrtnflaig
andauthored
[elasticsearch] add value to disable service (#1115) (#1366)
Signed-off-by: nflaig <[email protected]> Co-authored-by: Nico Flaig <[email protected]>
1 parent 3170d95 commit 5972a4c

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
@@ -162,6 +162,7 @@ support multiple versions with minimal changes.
162162
| `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 | `[]` |
163163
| `securityContext` | Allows you to set the [securityContext][] for the container | see [values.yaml][] |
164164
| `service.annotations` | [LoadBalancer annotations][] that Kubernetes will use for the service. This will configure load balancer if `service.type` is `LoadBalancer` | `{}` |
165+
| `service.enabled` | Enable non-headless service | `true` |
165166
| `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` | `""` |
166167
| `service.httpPortName` | The name of the http port within the service | `http` |
167168
| `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
@@ -856,6 +856,23 @@ def test_scheduler_name():
856856
)
857857

858858

859+
def test_disabling_non_headless_service():
860+
config = ""
861+
862+
r = helm_template(config)
863+
864+
assert uname in r["service"]
865+
866+
config = """
867+
service:
868+
enabled: false
869+
"""
870+
871+
r = helm_template(config)
872+
873+
assert uname not in r["service"]
874+
875+
859876
def test_adding_a_nodePort():
860877
config = ""
861878

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)