Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions elasticsearch/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
20 changes: 20 additions & 0 deletions elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
description: A Helm chart for Elasticsearch
name: elasticsearch
version: 0.1.0
maintainers:
- name: OpenStack-Helm Authors
71 changes: 71 additions & 0 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Elasticsearch Helm Chart

This chart installs a working version of Elasticsearch cluster on Kubernetes.

### Installation

Values.yaml contains configuration for Elasticsearch cluster.

#### Note: Minimum of 2 Master Nodes are required for elasticsearch cluster

```
helm install elasticsearch

```
### To verify the helm deployment was successful:

```
helm list
```

### To confirm all pods are up and running:

```
kubectl get pods

```

### To view list of services

```
kubectl get svc
```

```
elasticsearch-discovery 10.99.148.252 <none> 9300/TCP 47m
elasticsearch-logging 10.105.222.126 <pending> 9200:31070/TCP 47m
```

### Test elasticsearch functionality:

#### From any host within cluster..

1) Check if Elasticsearch cluster is up
```
curl http://10.105.222.126:9200
```
```
curl http://10.105.222.126:9200/_cluster/health?pretty
```

2) Store data manually using APIs
```
curl -XPUT 'http://10.105.222.126:9200/blog/user/renmak' -d \
'{ "name" : "Dilbert Brown" }'
```
```
curl -XPUT 'http://10.105.222.126:9200/blog/post/1' -d \
'{ "user":"renmak", "title":"how to test ES"}'
```
3) Retrive data manually using APIs
```
curl -XGET 'http://10.105.222.126:9200/blog/user/renmak?pretty=true'

curl -XGET 'http://10.105.222.126:9200/blog/post/1?pretty=true'

curl -XGET 'http://10.105.222.126:9200/blog/post/_search?q=user:renmak&pretty=true'

curl -XGET 'http://10.105.222.126:9200/_search?q=*renmak&pretty=true'

```

Binary file added elasticsearch/templates/.DS_Store
Binary file not shown.
Empty file.
16 changes: 16 additions & 0 deletions elasticsearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see these two partial templates used anywhere. If they're unnecessary, they should be removed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes will delete this file if no usage found. Keeping it right now just in case if needed.

{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 24 | trimSuffix "-" -}}
{{- end -}}
96 changes: 96 additions & 0 deletions elasticsearch/templates/deployment-es-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ .Values.labels.es_client.name }}
labels:
component: {{ .Values.labels.common.component }}
role: {{ .Values.labels.es_client.role }}
spec:
replicas: {{ .Values.replicas.es_client }}
template:
metadata:
labels:
component: {{ .Values.labels.common.component }}
role: {{ .Values.labels.es_client.role }}
annotations:
# Elasticsearch uses a hybrid mmapfs / niofs directory by default to
# store its indices. The default operating system limits on mmap counts
# is likely to be too low, which may result in out of memory exceptions,
# so we use vm.max_map_count=262144 to increase that value.
pod.beta.kubernetes.io/init-containers: '[
{
"name": "sysctl",
"image": "busybox",
"imagePullPolicy": "IfNotPresent",
"command": ["sysctl", "-w", "vm.max_map_count=262144"],
"securityContext": {
"privileged": true
}
}
]'
spec:
containers:
- name: {{ .Values.labels.es_client.name }}
securityContext:
privileged: false
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
image: {{ .Values.images.elasticsearch }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ability to enable resources and template the values for limits and requests should be included, as in the other charts

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{{- if .Values.resources.enabled }}
resources:
limits:
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
{{- end }}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: "CLUSTER_NAME"
value: {{ .Values.cluster_name }}
- name: NODE_MASTER
value: "false"
- name: NODE_DATA
value: "false"
- name: HTTP_ENABLE
value: "true"
- name: "ES_JAVA_OPTS"
value: {{ .Values.es_java_opts.es_client }}
ports:
- containerPort: {{ .Values.network.client.port }}
name: {{ .Values.network.client.name }}
protocol: {{ .Values.network.client.protocol }}
- containerPort: {{ .Values.network.discovery.port}}
name: {{ .Values.network.discovery.name }}
protocol: {{ .Values.network.discovery.protocol }}
volumeMounts:
- name: storage
mountPath: /data
volumes:
- name: storage
emptyDir: {}
89 changes: 89 additions & 0 deletions elasticsearch/templates/deployment-es-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ .Values.labels.es_data.name }}
labels:
component: {{ .Values.labels.common.component }}
role: {{ .Values.labels.es_data.role }}
spec:
replicas: {{ .Values.replicas.es_data }}
template:
metadata:
labels:
component: {{ .Values.labels.common.component }}
role: {{ .Values.labels.es_data.role }}
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "sysctl",
"image": "busybox",
"imagePullPolicy": "IfNotPresent",
"command": ["sysctl", "-w", "vm.max_map_count=262144"],
"securityContext": {
"privileged": true
}
}
]'
spec:
containers:
- name: {{ .Values.labels.es_data.name }}
securityContext:
privileged: false
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
image: {{ .Values.images.elasticsearch }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
{{- if .Values.resources.enabled }}
resources:
limits:
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
{{- end }}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: "CLUSTER_NAME"
value: {{ .Values.cluster_name }}
- name: NODE_MASTER
value: "false"
- name: NODE_INGEST
value: "false"
- name: HTTP_ENABLE
value: "false"
- name: "ES_JAVA_OPTS"
value: {{ .Values.es_java_opts.es_data }}
ports:
- containerPort: {{ .Values.network.discovery.port}}
name: {{ .Values.network.discovery.name}}
protocol: {{ .Values.network.discovery.protocol}}
volumeMounts:
- name: storage
mountPath: /data
volumes:
- name: storage
emptyDir: {}
Loading