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

Commit

Permalink
Add tests and fix README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Joris Andrade <joris@frontapp.com>
  • Loading branch information
JorisAndrade committed Jul 11, 2019
1 parent 2c3a7ba commit a86782b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ helm install --name elasticsearch elastic/elasticsearch --version 7.2.0 --set im
| `podSecurityContext` | Allows you to set the [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) for the pod | `fsGroup: 1000` |
| `securityContext` | Allows you to set the [securityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) for the container | `capabilities.drop:[ALL]`<br>`runAsNonRoot: true`<br>`runAsUser: 1000` |
| `terminationGracePeriod` | The [terminationGracePeriod](https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods) in seconds used when trying to stop the pod | `120` |
| `sysctlInitContainer.enabled` | Allows you to disable the sysctlInitContainer if you are setting vm.max_map_count with another method | `true` |
| `sysctlVmMaxMapCount` | Sets the [sysctl vm.max_map_count](https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html#vm-max-map-count) needed for Elasticsearch | `262144` |
| `readinessProbe` | Configuration fields for the [readinessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) | `failureThreshold: 3`<br>`initialDelaySeconds: 10`<br>`periodSeconds: 10`<br>`successThreshold: 3`<br>`timeoutSeconds: 5` |
| `clusterHealthCheckParams` | The [Elasticsearch cluster health status params](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html#request-params) that will be used by readinessProbe command | `wait_for_status=green&timeout=1s` |
Expand All @@ -109,7 +110,6 @@ helm install --name elasticsearch elastic/elasticsearch --version 7.2.0 --set im
| `schedulerName` | Name of the [alternate scheduler](https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/#specify-schedulers-for-pods) | `nil` |
| `masterTerminationFix` | A workaround needed for Elasticsearch < 7.2.0 to prevent master status being lost during restarts [#63](https://github.com/elastic/helm-charts/issues/63) | `false` |
| `lifecycle` | Allows you to add lifecycle configuration. See [values.yaml](./values.yaml) for an example of the formatting. | `{}` |
| `sysctlInitContainer.enabled` | Allows you to disable the sysctlInitContainer if you are not allowed to run privileged:true. | `false` |

## Try it out

Expand Down
21 changes: 17 additions & 4 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ def test_defaults():
'name': 'node.ingest',
'value': 'true'
},
{
'name': 'sysctlInitContainer.enabled',
'value': 'true'
},
]

c = r['statefulset'][uname]['spec']['template']['spec']['containers'][0]
Expand Down Expand Up @@ -338,6 +334,23 @@ def test_adding_a_extra_init_container():
extraInitContainer = r['statefulset'][uname]['spec']['template']['spec']['initContainers']
assert {'name': 'do-something', 'image': 'busybox', 'command': ['do', 'something'], } in extraInitContainer

def test_sysctl_init_container_disabled():
config = '''
sysctlInitContainer:
enabled: false
'''
r = helm_template(config)
initContainers = r['statefulset'][uname]['spec']['template']['spec']['initContainers']
assert initContainers is None

def test_sysctl_init_container_enabled():
config = '''
sysctlInitContainer:
enabled: true
'''
r = helm_template(config)
initContainers = r['statefulset'][uname]['spec']['template']['spec']['initContainers']
assert initContainers[0]['name'] == 'configure-sysctl'

def test_adding_storageclass_annotation_to_volumeclaimtemplate():
config = '''
Expand Down

0 comments on commit a86782b

Please sign in to comment.