Skip to content

Commit

Permalink
Refresh elastic helm chart to stable/elasticsearch (#260)
Browse files Browse the repository at this point in the history
* Updated the kanister-elasticsearch helm chart to use the stable elasticsearch helmchart

* Fixed the issue of blueprint getting created in the incorrect namespace
  • Loading branch information
joshiomkarj authored and mergify[bot] committed Nov 1, 2019
1 parent e33d7ac commit 91a332a
Show file tree
Hide file tree
Showing 32 changed files with 1,118 additions and 140 deletions.
1 change: 1 addition & 0 deletions examples/helm/kanister/kanister-elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
name: kanister-elasticsearch
home: https://www.elastic.co/products/elasticsearch
version: 0.21.0
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# Expose transport port on ClusterIP service

client:
exposeTransportPort: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extraInitContainers: |
- name: "plugin-install-ingest-attachment"
image: "docker.elastic.co/elasticsearch/elasticsearch-oss:6.6.1"
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.6.1"
command: ["/bin/bash"]
args: ["-c", "yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install mapper-size"]
31 changes: 31 additions & 0 deletions examples/helm/kanister/kanister-elasticsearch/ci/hooks-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# Enable custom lifecycle hooks for client, data and master pods

client:
hooks:
preStop: |-
#!/bin/bash
echo "Node {{ template "elasticsearch.client.fullname" . }} is shutting down"
postStart: |-
#!/bin/bash
echo "Node {{ template "elasticsearch.client.fullname" . }} is ready to be used"
data:
hooks:
drain:
enabled: false
preStop: |-
#!/bin/bash
echo "Node {{ template "elasticsearch.data.fullname" . }} is shutting down"
postStart: |-
#!/bin/bash
echo "Node {{ template "elasticsearch.data.fullname" . }} is ready to be used"
master:
hooks:
preStop: |-
#!/bin/bash
echo "Node {{ template "elasticsearch.master.fullname" . }} is shutting down"
postStart: |-
#!/bin/bash
echo "Node {{ template "elasticsearch.master.fullname" . }} is ready to be used"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# Deploy Chart as non-root and unprivileged

chownInitContainer:
enabled: false

securityContext:
enabled: true
runAsUser: 1000

sysctlInitContainer:
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# Enable init container for installing plugins

cluster:
plugins:
- ingest-attachment
- mapper-size
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data:
updateStrategy:
type: RollingUpdate

master:
updateStrategy:
type: RollingUpdate
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
actions:
backup:
type: Deployment
type: StatefulSet
outputArtifacts:
cloudObject:
keyValue:
Expand All @@ -9,56 +9,59 @@ actions:
- func: KubeTask
name: backupToObjectStore
args:
namespace: "{{ .Deployment.Namespace }}"
namespace: "{{ .StatefulSet.Namespace }}"
image: "kanisterio/es-sidecar:0.21.0"
command:
- bash
- -o
- errexit
- -o
- pipefail
- -c
- |
host_name="{{ .Deployment.Name }}.{{ .Deployment.Namespace }}.svc.cluster.local"
BACKUP_LOCATION=es_backups/{{ .Deployment.Namespace }}/{{ .Deployment.Name }}/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15:04:05Z07:00" }}/backup.gz
elasticdump --bulk=true --input=http://${host_name}:9200 --output=$ | gzip | kando location push --profile '{{ toJson .Profile }}' --path $BACKUP_LOCATION -
kando output backupLocation $BACKUP_LOCATION
- bash
- -o
- errexit
- -o
- pipefail
- -c
- |
host_name="{{ .Object.metadata.labels.release }}-kanister-elasticsearch-client.{{ .StatefulSet.Namespace }}.svc.cluster.local"
echo $host_name
BACKUP_LOCATION=es_backups/{{ .StatefulSet.Namespace }}/{{ .StatefulSet.Name }}/{{ toDate "2006-01-02T15:04:05.999999999Z07:00" .Time | date "2006-01-02T15:04:05Z07:00" }}/backup.gz
echo $BACKUP_LOCATION
elasticdump --bulk=true --input=http://${host_name}:9200 --output=$ | gzip | kando location push --profile '{{ toJson .Profile }}' --path $BACKUP_LOCATION -
kando output backupLocation $BACKUP_LOCATION
echo "exiting from backup"
restore:
type: Deployment
type: StatefulSet
inputArtifactNames:
- cloudObject
- cloudObject
phases:
- func: KubeTask
name: restoreFromObjectStore
args:
namespace: "{{ .Deployment.Namespace }}"
namespace: "{{ .StatefulSet.Namespace }}"
image: "kanisterio/es-sidecar:0.21.0"
command:
- bash
- -o
- errexit
- -o
- pipefail
- -c
- |
host_name="{{ .Deployment.Name }}.{{ .Deployment.Namespace }}.svc.cluster.local"
kando location pull --profile '{{ toJson .Profile }}' --path '{{ .ArtifactsIn.cloudObject.KeyValue.backupLocation }}' - | gunzip | elasticdump --bulk=true --input=$ --output=http://${host_name}:9200
- bash
- -o
- errexit
- -o
- pipefail
- -c
- |
host_name="{{ .Object.metadata.labels.release }}-kanister-elasticsearch-client.{{ .StatefulSet.Namespace }}.svc.cluster.local"
kando location pull --profile '{{ toJson .Profile }}' --path '{{ .ArtifactsIn.cloudObject.KeyValue.backupLocation }}' - | gunzip | elasticdump --bulk=true --input=$ --output=http://${host_name}:9200
delete:
type: Deployment
type: StatefulSet
inputArtifactNames:
- cloudObject
- cloudObject
phases:
- func: KubeTask
name: deleteFromObjectStore
args:
namespace: "{{ .Deployment.Namespace }}"
namespace: "{{ .StatefulSet.Namespace }}"
image: "kanisterio/es-sidecar:0.21.0"
command:
- bash
- -o
- errexit
- -o
- pipefail
- -c
- |
kando location delete --profile '{{ toJson .Profile }}' --path '{{ .ArtifactsIn.cloudObject.KeyValue.backupLocation }}'
- bash
- -o
- errexit
- -o
- pipefail
- -c
- |
kando location delete --profile '{{ toJson .Profile }}' --path '{{ .ArtifactsIn.cloudObject.KeyValue.backupLocation }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: profile
repository: https://charts.kanister.io
version: 0.21.0
digest: sha256:2baa62cdb59e2cd3710041f955e3a56b207219afc9d32f3794452c302ddbfdac
generated: 2019-09-09T14:44:45.462908118+05:30
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Elasticsearch can be accessed:

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

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

* From outside the cluster, run these commands in the same shell:
{{- if contains "NodePort" .Values.client.serviceType }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,63 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- define "elasticsearch.master.fullname" -}}
{{ template "elasticsearch.fullname" . }}-{{ .Values.master.name }}
{{- end -}}

{{/*
Create the name of the service account to use for the client component
*/}}
{{- define "elasticsearch.serviceAccountName.client" -}}
{{- if .Values.serviceAccounts.client.create -}}
{{ default (include "elasticsearch.client.fullname" .) .Values.serviceAccounts.client.name }}
{{- else -}}
{{ default "default" .Values.serviceAccounts.client.name }}
{{- end -}}
{{- end -}}

{{/*
Create the name of the service account to use for the data component
*/}}
{{- define "elasticsearch.serviceAccountName.data" -}}
{{- if .Values.serviceAccounts.data.create -}}
{{ default (include "elasticsearch.data.fullname" .) .Values.serviceAccounts.data.name }}
{{- else -}}
{{ default "default" .Values.serviceAccounts.data.name }}
{{- end -}}
{{- end -}}

{{/*
Create the name of the service account to use for the master component
*/}}
{{- define "elasticsearch.serviceAccountName.master" -}}
{{- if .Values.serviceAccounts.master.create -}}
{{ default (include "elasticsearch.master.fullname" .) .Values.serviceAccounts.master.name }}
{{- else -}}
{{ default "default" .Values.serviceAccounts.master.name }}
{{- end -}}
{{- end -}}

{{/*
plugin installer template
*/}}
{{- define "plugin-installer" -}}
- name: es-plugin-install
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
command:
- "sh"
- "-c"
- |
{{- range .Values.cluster.plugins }}
/usr/share/elasticsearch/bin/elasticsearch-plugin install -b {{ . }}
{{- end }}
volumeMounts:
- mountPath: /usr/share/elasticsearch/plugins/
name: plugindir
- mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
name: config
subPath: elasticsearch.yml
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if and ( .Values.client.ingress.user ) ( .Values.client.ingress.password ) }}
---
apiVersion: v1
kind: Secret
metadata:
name: '{{ include "elasticsearch.client.fullname" . }}-auth'
type: Opaque
data:
auth: {{ printf "%s:{PLAIN}%s\n" .Values.client.ingress.user .Values.client.ingress.password | b64enc | quote }}
{{- end }}

Loading

0 comments on commit 91a332a

Please sign in to comment.