Merge "Elasticsearch Chart"

This commit is contained in:
Jenkins 2017-07-05 19:54:01 +00:00 committed by Gerrit Code Review
commit e0fa1372a6
21 changed files with 968 additions and 3 deletions

View File

@ -15,7 +15,7 @@
HELM = helm
TASK = build
CHARTS = helm-toolkit postgresql
CHARTS = elasticsearch helm-toolkit postgresql
all: $(CHARTS)

24
elasticsearch/Chart.yaml Normal file
View File

@ -0,0 +1,24 @@
# 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: OpenStack-Helm ElasticSearch
name: elasticsearch
version: 0.1.0
home: https://www.elastic.co/
sources:
- https://github.com/elastic/elasticsearch
- https://git.openstack.org/cgit/openstack/openstack-helm-addons
maintainers:
- name: OpenStack-Helm Authors

View File

@ -0,0 +1,19 @@
# 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.
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
version: 0.1.0

View File

@ -0,0 +1,27 @@
#!/bin/bash
# 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.
set -ex
COMMAND="${@:-start}"
function start () {
exec /usr/share/elasticsearch/bin/elasticsearch
}
function stop () {
kill -TERM 1
}
$COMMAND

View File

@ -0,0 +1,79 @@
#!/bin/bash
# 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.
set -ex
function create_index () {
index_result=$(curl -XPUT "$ELASTICSEARCH_ENDPOINT/test_index?pretty" -H 'Content-Type: application/json' -d'
{
"settings" : {
"index" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
}
}
}
' | python -c "import sys, json; print json.load(sys.stdin)['acknowledged']")
if [ "$index_result" == "True" ];
then
echo "PASS: Test index created!"
else
echo "FAIL: Test index not created!";
exit 1;
fi
}
function insert_test_data () {
insert_result=$(curl -XPUT "$ELASTICSEARCH_ENDPOINT/sample_index/sample_type/123/_create?pretty" -H 'Content-Type: application/json' -d'
{
"name" : "Elasticsearch",
"message" : "Test data text entry"
}
' | python -c "import sys, json; print json.load(sys.stdin)['created']")
if [ "$insert_result" == "True" ]; then
sleep 20
echo "PASS: Test data inserted into test index!"
else
echo "FAIL: Test data not inserted into test index!";
exit 1;
fi
}
function check_hits () {
total_hits=$(curl -XGET "$ELASTICSEARCH_ENDPOINT/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query" : {
"bool": {
"must": [
{ "match": { "name": "Elasticsearch" }},
{ "match": { "message": "Test data text entry" }}
]
}
}
}
' | python -c "import sys, json; print json.load(sys.stdin)['hits']['total']")
if [ "$total_hits" -gt 0 ]; then
echo "PASS: Successful hits on test data query!"
else
echo "FAIL: No hits on query for test data! Exiting";
exit 1;
fi
}
create_index
insert_test_data
check_hits

View File

@ -0,0 +1,23 @@
# 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
kind: ConfigMap
metadata:
name: elastic-bin
data:
elasticsearch.sh: |
{{ tuple "bin/_elasticsearch.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
helm-tests.sh: |
{{ tuple "bin/_helm-tests.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}

View File

@ -0,0 +1,43 @@
# 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
kind: ConfigMap
metadata:
name: elastic-etc
data:
elasticsearch.yml: |
{{ if .Values.conf.elasticsearch.override -}}
{{ .Values.conf.elasticsearch.override | indent 4 }}
{{- else -}}
{{- if .Values.conf.elasticsearch.prefix -}}
{{ .Values.conf.elasticsearch.prefix | indent 4 }}
{{- end }}
{{ tuple "etc/_elasticsearch.yml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
{{- if .Values.conf.elasticsearch.append -}}
{{ .Values.conf.elasticsearch.append | indent 4 }}
{{- end }}
logging.yml: |
{{ if .Values.conf.logging.override -}}
{{ .Values.conf.logging.override | indent 4 }}
{{- else -}}
{{- if .Values.conf.logging.prefix -}}
{{ .Values.conf.logging.prefix | indent 4 }}
{{- end }}
{{ tuple "etc/_logging.yml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
{{- if .Values.conf.logging.append -}}
{{ .Values.conf.logging.append | indent 4 }}
{{- end }}

View File

@ -0,0 +1,28 @@
# 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
kind: Service
metadata:
name: elasticsearch-data
labels:
component: elasticsearch
role: data
spec:
selector:
component: elasticsearch
role: data
ports:
- port: {{ .Values.network.data.port }}
name: transport

View File

@ -0,0 +1,130 @@
# 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: elasticsearch-client
labels:
component: elasticsearch
role: client
spec:
replicas: {{ .Values.replicas.client }}
revisionHistoryLimit: {{ .Values.upgrades.revision_history }}
strategy:
type: {{ .Values.upgrades.pod_replacement_strategy }}
{{ if eq .Values.upgrades.pod_replacement_strategy "RollingUpdate" }}
rollingUpdate:
maxUnavailable: {{ .Values.upgrades.rolling_update.max_unavailable }}
maxSurge: {{ .Values.upgrades.rolling_update.max_surge }}
{{ end }}
template:
metadata:
labels:
component: elasticsearch
role: client
spec:
serviceAccount: elasticsearch
initContainers:
- name: memory-map-increase
securityContext:
privileged: true
image: {{ .Values.images.memory_init }}
imagePullPolicy: {{ .Values.images.pull_policy }}
command:
- sysctl
- -w
- vm.max_map_count=262144
containers:
- name: elasticsearch-client
securityContext:
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
image: {{ .Values.images.elasticsearch }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ if .Values.resources.enabled }}
resources:
limits:
cpu: {{ .Values.resources.client.limits.cpu | quote }}
memory: {{ .Values.resources.client.limits.memory | quote }}
requests:
cpu: {{ .Values.resources.client.requests.cpu | quote }}
memory: {{ .Values.resources.client.requests.memory | quote }}
{{ end }}
command:
- /tmp/elasticsearch.sh
- start
lifecycle:
preStop:
exec:
command:
- /tmp/elasticsearch.sh
- stop
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NODE_MASTER
value: "false"
- name: NODE_DATA
value: "false"
- name: HTTP_ENABLE
value: "true"
- name: DISCOVERY_SERVICE
value: "elasticsearch-discovery"
- name: ES_JAVA_OPTS
value: "-Xms256m -Xmx256m"
ports:
- containerPort: {{ .Values.network.client.port }}
name: {{ .Values.network.client.name }}
protocol: {{ .Values.network.client.proto }}
- containerPort: {{ .Values.network.discovery.port }}
name: {{ .Values.network.discovery.name }}
protocol: {{ .Values.network.discovery.proto }}
volumeMounts:
- name: elastic-bin
mountPath: /tmp/elasticsearch.sh
subPath: elasticsearch.sh
readOnly: true
- name: elastic-config
mountPath: /usr/share/elasticsearch/config
- name: elastic-etc
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
readOnly: true
- name: elastic-etc
mountPath: /usr/share/elasticsearch/config/logging.yml
subPath: logging.yml
readOnly: true
- mountPath: /data
name: storage
volumes:
- name: elastic-bin
configMap:
name: elastic-bin
defaultMode: 0555
- name: elastic-config
emptyDir: {}
- name: elastic-etc
configMap:
name: elastic-etc
- name: storage
emptyDir: {}

View File

@ -0,0 +1,129 @@
# 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: elasticsearch-master
labels:
component: elasticsearch
role: master
spec:
replicas: {{ .Values.replicas.master }}
revisionHistoryLimit: {{ .Values.upgrades.revision_history }}
strategy:
type: {{ .Values.upgrades.pod_replacement_strategy }}
{{ if eq .Values.upgrades.pod_replacement_strategy "RollingUpdate" }}
rollingUpdate:
maxUnavailable: {{ .Values.upgrades.rolling_update.max_unavailable }}
maxSurge: {{ .Values.upgrades.rolling_update.max_surge }}
{{ end }}
template:
metadata:
labels:
component: elasticsearch
role: master
spec:
serviceAccount: elasticsearch
initContainers:
- name: memory-map-increase
securityContext:
privileged: true
image: {{ .Values.images.memory_init }}
imagePullPolicy: {{ .Values.images.pull_policy }}
command:
- sysctl
- -w
- vm.max_map_count=262144
containers:
- name: elasticsearch-master
securityContext:
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
image: {{ .Values.images.elasticsearch }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ if .Values.resources.enabled }}
resources:
limits:
cpu: {{ .Values.resources.master.limits.cpu | quote }}
memory: {{ .Values.resources.master.limits.memory | quote }}
requests:
cpu: {{ .Values.resources.master.requests.cpu | quote }}
memory: {{ .Values.resources.master.requests.memory | quote }}
{{ end }}
command:
- /tmp/elasticsearch.sh
- start
lifecycle:
preStop:
exec:
command:
- /tmp/elasticsearch.sh
- stop
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NODE_MASTER
value: "true"
- name: NODE_INGEST
value: "false"
- name: NODE_DATA
value: "false"
- name: HTTP_ENABLE
value: "false"
- name: DISCOVERY_SERVICE
value: "elasticsearch-discovery"
- name: ES_JAVA_OPTS
value: "-Xms256m -Xmx256m"
ports:
- containerPort: {{ .Values.network.discovery.port }}
name: {{ .Values.network.discovery.name }}
protocol: {{ .Values.network.discovery.proto }}
volumeMounts:
- name: elastic-bin
mountPath: /tmp/elasticsearch.sh
subPath: elasticsearch.sh
readOnly: true
- name: elastic-config
mountPath: /usr/share/elasticsearch/config
- name: elastic-etc
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
readOnly: true
- name: elastic-etc
mountPath: /usr/share/elasticsearch/config/logging.yml
subPath: logging.yml
readOnly: true
- mountPath: /data
name: storage
volumes:
- name: elastic-bin
configMap:
name: elastic-bin
defaultMode: 0555
- name: elastic-config
emptyDir: {}
- name: elastic-etc
configMap:
name: elastic-etc
- name: storage
emptyDir: {}

View File

@ -0,0 +1,28 @@
# 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
kind: Service
metadata:
name: elasticsearch-discovery
labels:
component: elasticsearch
role: master
spec:
selector:
component: elasticsearch
role: master
ports:
- name: transport
port: {{ .Values.network.discovery.port }}

View File

@ -0,0 +1,26 @@
cluster:
name: {{ .Values.conf.elasticsearch.cluster.name }}
node:
master: ${NODE_MASTER}
data: ${NODE_DATA}
name: ${NODE_NAME}
network.host: {{ .Values.conf.elasticsearch.network.host }}
path:
data: {{ .Values.conf.elasticsearch.path.data }}
logs: {{ .Values.conf.elasticsearch.path.logs }}
bootstrap:
memory_lock: {{ .Values.conf.elasticsearch.bootstrap.memory_lock }}
http:
enabled: ${HTTP_ENABLE}
compression: true
discovery:
zen:
ping.unicast.hosts: ${DISCOVERY_SERVICE}
minimum_master_nodes: {{ .Values.conf.elasticsearch.zen.min_masters }}

View File

@ -0,0 +1,79 @@
# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
es.logger.level: INFO
rootLogger: ${es.logger.level}, console, file
logger:
# log action execution errors for easier debugging
action: DEBUG
# deprecation logging, turn to DEBUG to see them
deprecation: INFO, deprecation_log_file
org.apache.http: INFO
# gateway
#gateway: DEBUG
#index.gateway: DEBUG
# peer shard recovery
#indices.recovery: DEBUG
# discovery
#discovery: TRACE
index.search.slowlog: TRACE, index_search_slow_log_file
index.indexing.slowlog: TRACE, index_indexing_slow_log_file
additivity:
index.search.slowlog: false
index.indexing.slowlog: false
deprecation: false
appender:
console:
type: console
layout:
type: consolePattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
file:
type: dailyRollingFile
file: ${path.logs}/${cluster.name}.log
datePattern: "'.'yyyy-MM-dd"
layout:
type: pattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %.10000m%n"
# Use the following log4j-extras RollingFileAppender to enable gzip compression of log files.
# For more information see https://logging.apache.org/log4j/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html
#file:
#type: extrasRollingFile
#file: ${path.logs}/${cluster.name}.log
#rollingPolicy: timeBased
#rollingPolicy.FileNamePattern: ${path.logs}/${cluster.name}.log.%d{yyyy-MM-dd}.gz
#layout:
#type: pattern
#conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
deprecation_log_file:
type: dailyRollingFile
file: ${path.logs}/${cluster.name}_deprecation.log
datePattern: "'.'yyyy-MM-dd"
layout:
type: pattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
index_search_slow_log_file:
type: dailyRollingFile
file: ${path.logs}/${cluster.name}_index_search_slowlog.log
datePattern: "'.'yyyy-MM-dd"
layout:
type: pattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
index_indexing_slow_log_file:
type: dailyRollingFile
file: ${path.logs}/${cluster.name}_index_indexing_slowlog.log
datePattern: "'.'yyyy-MM-dd"
layout:
type: pattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

View File

@ -0,0 +1,28 @@
# 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
kind: Service
metadata:
name: elasticsearch-logging
labels:
component: elasticsearch
role: client
spec:
selector:
component: elasticsearch
role: client
ports:
- name: {{ .Values.network.client.name }}
port: {{ .Values.network.client.port }}

View File

@ -0,0 +1,25 @@
# 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.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Values.pvc.name }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.pvc.requests.storage }}
storageClassName: {{ .Values.pvc.storage_class }}

View File

@ -0,0 +1,18 @@
# 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
kind: ServiceAccount
metadata:
name: elasticsearch

View File

@ -0,0 +1,112 @@
# 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: apps/v1beta1
kind: StatefulSet
metadata:
name: elasticsearch-data
labels:
component: elasticsearch
role: data
spec:
serviceName: elasticsearch-data
replicas: {{ .Values.replicas.data }}
template:
metadata:
labels:
component: elasticsearch
role: data
spec:
serviceAccount: elasticsearch
initContainers:
- name: memory-map-increase
securityContext:
privileged: true
image: {{ .Values.images.memory_init }}
imagePullPolicy: {{ .Values.images.pull_policy }}
command:
- sysctl
- -w
- vm.max_map_count=262144
containers:
- name: elasticsearch-data
securityContext:
privileged: true
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
image: {{ .Values.images.elasticsearch }}
command:
- /tmp/elasticsearch.sh
- start
lifecycle:
preStop:
exec:
command:
- /tmp/elasticsearch.sh
- stop
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NODE_MASTER
value: "false"
- name: NODE_DATA
value: "true"
- name: HTTP_ENABLE
value: "false"
- name: ES_JAVA_OPTS
value: "-Xms256m -Xmx256m"
- name: DISCOVERY_SERVICE
value: "elasticsearch-discovery"
ports:
- containerPort: {{ .Values.network.data.port }}
name: {{ .Values.network.data.name }}
protocol: TCP
volumeMounts:
- name: elastic-bin
mountPath: /tmp/elasticsearch.sh
subPath: elasticsearch.sh
readOnly: true
- name: elastic-config
mountPath: /usr/share/elasticsearch/config
- name: elastic-etc
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
readOnly: true
- name: elastic-etc
mountPath: /usr/share/elasticsearch/config/logging.yml
subPath: logging.yml
readOnly: true
- name: storage
mountPath: /var/lib/elasticsearch/data
volumes:
- name: elastic-bin
configMap:
name: elastic-bin
defaultMode: 0555
- name: elastic-config
emptyDir: {}
- name: elastic-etc
configMap:
name: elastic-etc
- name: storage
persistentVolumeClaim:
claimName: {{ .Values.pvc.name }}

View File

@ -0,0 +1,40 @@
# 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.
{{- $envAll := . }}
apiVersion: v1
kind: Pod
metadata:
name: "{{.Release.Name}}-helm-tests"
annotations:
"helm.sh/hook": test-success
spec:
restartPolicy: Never
containers:
- name: {{.Release.Name}}-helm-tests
image: {{ .Values.images.helm_tests }}
command:
- /tmp/helm-tests.sh
env:
- name: ELASTICSEARCH_ENDPOINT
value: {{ tuple "logging_db" "default" "api" $envAll | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }}
volumeMounts:
- name: elastic-bin
mountPath: /tmp/helm-tests.sh
subPath: helm-tests.sh
volumes:
- name: elastic-bin
configMap:
name: elastic-bin
defaultMode: 0555

101
elasticsearch/values.yaml Normal file
View File

@ -0,0 +1,101 @@
# 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.
# Default values for elasticsearch
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
conf:
elasticsearch:
override:
prefix:
append:
bootstrap:
memory_lock: true
cluster:
name: elasticsearch
network:
host: 0.0.0.0
path:
data: /var/lib/elasticsearch/data
logs: /data/log
zen:
min_masters: 2
logging:
override:
prefix:
append:
endpoints:
logging_db:
name: elasticsearch
hosts:
default: elasticsearch-logging
public: elasticsearch
path:
default: null
scheme:
default: http
port:
api:
default: 9200
replicas:
master: 3
data: 3
client: 2
images:
memory_init: docker.io/kolla/ubuntu-source-elasticsearch:3.0.3
elasticsearch: docker.io/kolla/ubuntu-source-elasticsearch:3.0.3
helm_tests: docker.io/kolla/ubuntu-source-elasticsearch:3.0.3
pull_policy: "IfNotPresent"
network:
client:
port: 9200
discovery:
port: 9300
data:
port: 9300
upgrades:
revision_history: 3
pod_replacement_strategy: RollingUpdate
rolling_update:
max_unavailable: 1
max_surge: 3
resources:
enabled: false
client:
limits:
memory: "1024Mi"
cpu: "2000m"
requests:
memory: "128Mi"
cpu: "500m"
master:
limits:
memory: "1024Mi"
cpu: "2000m"
requests:
memory: "128Mi"
cpu: "500m"
pvc:
name: pvc-elastic
requests:
storage: 2Gi
storage_class: general

View File

@ -26,3 +26,8 @@ kube_wait_for_pods openstack 1200
# todo(srwilkers): implement helm tests for postgresql
#helm_test_deployment postgresql openstack
helm install --name=elasticsearch local/elasticsearch --namespace=kube-system
kube_wait_for_pods kube-system 600
helm_test_deployment elasticsearch kube-system

View File

@ -81,8 +81,9 @@ function helm_test_deployment {
DEPLOYMENT=$1
NAMESPACE=$2
helm test ${DEPLOYMENT}
mkdir -p ${LOGS_DIR}/helm-test
kubectl logs -n ${NAMESPACE} ${DEPLOYMENT}-helm-test > ${LOGS_DIR}/helm-test/${DEPLOYMENT}
mkdir -p ${LOGS_DIR}/helm-tests
kubectl logs -n ${NAMESPACE} ${DEPLOYMENT}-helm-tests > ${LOGS_DIR}/helm-tests/${DEPLOYMENT}
kubectl delete pods ${DEPLOYMENT}-helm-tests -n ${NAMESPACE}
}
function helm_plugin_template_install {