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

Commit

Permalink
[elasticsearch] add value to disable service (#1115) (#1339)
Browse files Browse the repository at this point in the history
Signed-off-by: nflaig <nflaig@protonmail.com>

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
  • Loading branch information
jmlrt and nflaig committed Sep 21, 2021
1 parent b0ea476 commit e10cdbd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions elasticsearch/README.md
Expand Up @@ -161,6 +161,7 @@ support multiple versions with minimal changes.
| `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 | `[]` |
| `securityContext` | Allows you to set the [securityContext][] for the container | see [values.yaml][] |
| `service.annotations` | [LoadBalancer annotations][] that Kubernetes will use for the service. This will configure load balancer if `service.type` is `LoadBalancer` | `{}` |
| `service.enabled` | Enable non-headless service | `true` |
| `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` | `""` |
| `service.httpPortName` | The name of the http port within the service | `http` |
| `service.labelsHeadless` | Labels to be added to headless service | `{}` |
Expand Down
2 changes: 2 additions & 0 deletions elasticsearch/templates/service.yaml
@@ -1,4 +1,5 @@
---
{{- if .Values.service.enabled -}}
kind: Service
apiVersion: v1
metadata:
Expand Down Expand Up @@ -43,6 +44,7 @@ spec:
{{- if .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
{{- end }}
---
kind: Service
apiVersion: v1
Expand Down
17 changes: 17 additions & 0 deletions elasticsearch/tests/elasticsearch_test.py
Expand Up @@ -856,6 +856,23 @@ def test_scheduler_name():
)


def test_disabling_non_headless_service():
config = ""

r = helm_template(config)

assert uname in r["service"]

config = """
service:
enabled: false
"""

r = helm_template(config)

assert uname not in r["service"]


def test_adding_a_nodePort():
config = ""

Expand Down
1 change: 1 addition & 0 deletions elasticsearch/values.yaml
Expand Up @@ -180,6 +180,7 @@ httpPort: 9200
transportPort: 9300

service:
enabled: true
labels: {}
labelsHeadless: {}
type: ClusterIP
Expand Down

0 comments on commit e10cdbd

Please sign in to comment.