Skip to content

Commit

Permalink
Promote elasticsearch to stable (helm#8476)
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Brown <pete.brown@powerhrg.com>
  • Loading branch information
rendhalver authored and Dario Blanco committed Oct 22, 2018
1 parent 0fe730a commit 7aad691
Show file tree
Hide file tree
Showing 20 changed files with 1,306 additions and 9 deletions.
13 changes: 4 additions & 9 deletions incubator/elasticsearch/Chart.yaml
@@ -1,8 +1,10 @@
# elasticsearch has been promoted to stable
deprecated: true
name: elasticsearch
home: https://www.elastic.co/products/elasticsearch
version: 1.10.1
version: 1.10.2
appVersion: 6.4.2
description: Flexible and powerful open source, distributed real-time search and analytics
description: DEPRECATED Flexible and powerful open source, distributed real-time search and analytics
engine.
icon: https://static-www.elastic.co/assets/blteb1c97719574938d/logo-elastic-elasticsearch-lt.svg
sources:
Expand All @@ -12,10 +14,3 @@ sources:
- https://github.com/GoogleCloudPlatform/elasticsearch-docker
- https://github.com/clockworksoul/helm-elasticsearch
- https://github.com/pires/kubernetes-elasticsearch-cluster
maintainers:
- name: simonswine
email: christian@jetstack.io
- name: icereval
email: michael.haselton@gmail.com
- name: rendhalver
email: pete.brown@powerhrg.com
2 changes: 2 additions & 0 deletions incubator/elasticsearch/README.md
@@ -1,5 +1,7 @@
# Elasticsearch Helm Chart

**Note - this chart has been deprecated and [moved to stable](../../stable/elasticsearch)**.

This chart uses a standard Docker image of Elasticsearch (docker.elastic.co/elasticsearch/elasticsearch-oss) and uses a service pointing to the master's transport port for service discovery.
Elasticsearch does not communicate with the Kubernetes API, hence no need for RBAC permissions.

Expand Down
5 changes: 5 additions & 0 deletions incubator/elasticsearch/templates/NOTES.txt
@@ -1,5 +1,10 @@
The elasticsearch cluster has been installed.

***
Please note that this chart has been deprecated and moved to stable.
Going forward please use the stable version of this chart.
***

Elasticsearch can be accessed:

* Within your cluster, at the following DNS name at port 9200:
Expand Down
3 changes: 3 additions & 0 deletions stable/elasticsearch/.helmignore
@@ -0,0 +1,3 @@
.git
# OWNERS file for Kubernetes
OWNERS
21 changes: 21 additions & 0 deletions stable/elasticsearch/Chart.yaml
@@ -0,0 +1,21 @@
name: elasticsearch
home: https://www.elastic.co/products/elasticsearch
version: 1.11.0
appVersion: 6.4.2
description: Flexible and powerful open source, distributed real-time search and analytics
engine.
icon: https://static-www.elastic.co/assets/blteb1c97719574938d/logo-elastic-elasticsearch-lt.svg
sources:
- https://www.elastic.co/products/elasticsearch
- https://github.com/jetstack/elasticsearch-pet
- https://github.com/giantswarm/kubernetes-elastic-stack
- https://github.com/GoogleCloudPlatform/elasticsearch-docker
- https://github.com/clockworksoul/helm-elasticsearch
- https://github.com/pires/kubernetes-elasticsearch-cluster
maintainers:
- name: simonswine
email: christian@jetstack.io
- name: icereval
email: michael.haselton@gmail.com
- name: rendhalver
email: pete.brown@powerhrg.com
8 changes: 8 additions & 0 deletions stable/elasticsearch/OWNERS
@@ -0,0 +1,8 @@
approvers:
- simonswine
- icereval
- rendhalver
reviewers:
- simonswine
- icereval
- rendhalver
220 changes: 220 additions & 0 deletions stable/elasticsearch/README.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions stable/elasticsearch/ci/extrainitcontainers-values.yaml
@@ -0,0 +1,9 @@
extraInitContainers: |
- name: "plugin-install-ingest-attachment"
image: "docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.0"
command: ["/bin/bash"]
args: ["-c", "yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment"]
- name: "plugin-install-mapper-size"
image: "docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.0"
command: ["/bin/bash"]
args: ["-c", "yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install mapper-size"]
31 changes: 31 additions & 0 deletions stable/elasticsearch/templates/NOTES.txt
@@ -0,0 +1,31 @@
The elasticsearch cluster has been installed.

Elasticsearch can be accessed:

* Within your cluster, at the following DNS name at port 9200:

{{ template "elasticsearch.client.fullname" . }}.{{ .Release.Namespace }}.svc

* From outside the cluster, run these commands in the same shell:
{{- if contains "NodePort" .Values.client.serviceType }}

export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "elasticsearch.client.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.client.serviceType }}

WARNING: You have likely exposed your Elasticsearch cluster direct to the internet.
Elasticsearch does not implement any security for public facing clusters by default.
As a minimum level of security; switch to ClusterIP/NodePort and place an Nginx gateway infront of the cluster in order to lock down access to dangerous HTTP endpoints and verbs.

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "elasticsearch.client.fullname" . }}'

export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "elasticsearch.client.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:9200
{{- else if contains "ClusterIP" .Values.client.serviceType }}

export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "elasticsearch.name" . }},component={{ .Values.client.name }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:9200 to use Elasticsearch"
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 9200:9200
{{- end }}
48 changes: 48 additions & 0 deletions stable/elasticsearch/templates/_helpers.tpl
@@ -0,0 +1,48 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "elasticsearch.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "elasticsearch.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified client name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "elasticsearch.client.fullname" -}}
{{ template "elasticsearch.fullname" . }}-{{ .Values.client.name }}
{{- end -}}

{{/*
Create a default fully qualified data name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "elasticsearch.data.fullname" -}}
{{ template "elasticsearch.fullname" . }}-{{ .Values.data.name }}
{{- end -}}

{{/*
Create a default fully qualified master name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "elasticsearch.master.fullname" -}}
{{ template "elasticsearch.fullname" . }}-{{ .Values.master.name }}
{{- end -}}
153 changes: 153 additions & 0 deletions stable/elasticsearch/templates/client-deployment.yaml
@@ -0,0 +1,153 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
labels:
app: {{ template "elasticsearch.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.client.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "elasticsearch.client.fullname" . }}
spec:
replicas: {{ .Values.client.replicas }}
template:
metadata:
labels:
app: {{ template "elasticsearch.name" . }}
component: "{{ .Values.client.name }}"
release: {{ .Release.Name }}
{{- if .Values.client.podAnnotations }}
annotations:
{{ toYaml .Values.client.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.client.priorityClassName }}
priorityClassName: "{{ .Values.client.priorityClassName }}"
{{- end }}
securityContext:
fsGroup: 1000
{{- if or .Values.client.antiAffinity .Values.client.nodeAffinity }}
affinity:
{{- end }}
{{- if eq .Values.client.antiAffinity "hard" }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app: "{{ template "elasticsearch.name" . }}"
release: "{{ .Release.Name }}"
component: "{{ .Values.client.name }}"
{{- else if eq .Values.client.antiAffinity "soft" }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: "{{ template "elasticsearch.name" . }}"
release: "{{ .Release.Name }}"
component: "{{ .Values.client.name }}"
{{- end }}
{{- with .Values.client.nodeAffinity }}
nodeAffinity:
{{ toYaml . | indent 10 }}
{{- end }}
{{- if .Values.client.nodeSelector }}
nodeSelector:
{{ toYaml .Values.client.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.client.tolerations }}
tolerations:
{{ toYaml .Values.client.tolerations | indent 8 }}
{{- end }}
initContainers:
# see https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
# and https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html#mlockall
- name: "sysctl"
image: "{{ .Values.initImage.repository }}:{{ .Values.initImage.tag }}"
imagePullPolicy: {{ .Values.initImage.pullPolicy | quote }}
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
{{- if .Values.extraInitContainers }}
{{ tpl .Values.extraInitContainers . | indent 6 }}
{{- end }}
containers:
- name: elasticsearch
env:
- name: NODE_DATA
value: "false"
{{- if hasPrefix "5." .Values.appVersion }}
- name: NODE_INGEST
value: "false"
{{- end }}
- name: NODE_MASTER
value: "false"
- name: DISCOVERY_SERVICE
value: {{ template "elasticsearch.fullname" . }}-discovery
- name: PROCESSORS
valueFrom:
resourceFieldRef:
resource: limits.cpu
- name: ES_JAVA_OPTS
value: "-Djava.net.preferIPv4Stack=true -Xms{{ .Values.client.heapSize }} -Xmx{{ .Values.client.heapSize }} {{ .Values.cluster.additionalJavaOpts }}"
{{- range $key, $value := .Values.cluster.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
resources:
{{ toYaml .Values.client.resources | indent 12 }}
readinessProbe:
httpGet:
path: /_cluster/health
port: 9200
initialDelaySeconds: 5
livenessProbe:
httpGet:
path: /_cluster/health?local=true
port: 9200
initialDelaySeconds: 90
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
ports:
- containerPort: 9200
name: http
- containerPort: 9300
name: transport
volumeMounts:
- mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
name: config
subPath: elasticsearch.yml
{{- if hasPrefix "2." .Values.image.tag }}
- mountPath: /usr/share/elasticsearch/config/logging.yml
name: config
subPath: logging.yml
{{- end }}
{{- if hasPrefix "5." .Values.image.tag }}
- mountPath: /usr/share/elasticsearch/config/log4j2.properties
name: config
subPath: log4j2.properties
{{- end }}
{{- if .Values.cluster.keystoreSecret }}
- name: keystore
mountPath: "/usr/share/elasticsearch/config/elasticsearch.keystore"
subPath: elasticsearch.keystore
readOnly: true
{{- end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range $pullSecret := .Values.image.pullSecrets }}
- name: {{ $pullSecret }}
{{- end }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ template "elasticsearch.fullname" . }}
{{- if .Values.cluster.keystoreSecret }}
- name: keystore
secret:
secretName: {{ .Values.cluster.keystoreSecret }}
{{- end }}
24 changes: 24 additions & 0 deletions stable/elasticsearch/templates/client-pdb.yaml
@@ -0,0 +1,24 @@
{{- if .Values.client.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
app: {{ template "elasticsearch.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.client.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "elasticsearch.client.fullname" . }}
spec:
{{- if .Values.client.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.client.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.client.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.client.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
app: {{ template "elasticsearch.name" . }}
component: "{{ .Values.client.name }}"
release: {{ .Release.Name }}
{{- end }}
34 changes: 34 additions & 0 deletions stable/elasticsearch/templates/client-svc.yaml
@@ -0,0 +1,34 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ template "elasticsearch.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.client.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "elasticsearch.client.fullname" . }}
{{- if .Values.client.serviceAnnotations }}
annotations:
{{ toYaml .Values.client.serviceAnnotations | indent 4 }}
{{- end }}

spec:
ports:
- name: http
port: 9200
targetPort: http
selector:
app: {{ template "elasticsearch.name" . }}
component: "{{ .Values.client.name }}"
release: {{ .Release.Name }}
type: {{ .Values.client.serviceType }}
{{- if .Values.client.loadBalancerIP }}
loadBalancerIP: "{{ .Values.client.loadBalancerIP }}"
{{- end }}
{{if .Values.client.loadBalancerSourceRanges}}
loadBalancerSourceRanges:
{{range $rangeList := .Values.client.loadBalancerSourceRanges}}
- {{ $rangeList }}
{{end}}
{{end}}

0 comments on commit 7aad691

Please sign in to comment.