Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ECK-managed resources Helm Charts #5781

Merged
merged 52 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d273aa1
Adding initial revision of eck-stack, and eck-kibana charts.
naemono Jun 14, 2022
a19716a
Update Chart.yaml to have kubeversion.
naemono Jun 14, 2022
25f1ad4
Update values file with more information.
naemono Jun 14, 2022
67d9135
adding es resource
framsouza Jun 15, 2022
210f6b3
Making things consistent across charts.
naemono Jun 15, 2022
7d3311c
Adding newlines
naemono Jun 15, 2022
1c29c8d
Add public documentation for eck-stack helm chart.
naemono Jun 16, 2022
8507897
Adding helm test script.
naemono Jun 17, 2022
222912a
add newline
naemono Jun 17, 2022
bdde4bc
Add makefile entry.
naemono Jun 17, 2022
5457d3d
Add helm test to ci checks
naemono Jun 17, 2022
81e2900
make chart.yaml consistent
naemono Jun 17, 2022
8f9f8da
Adding newlines
naemono Jun 20, 2022
8f091ce
Update newline
naemono Jun 20, 2022
c16e54d
Update readme for eck-stack
naemono Jun 20, 2022
174216c
remove todo from eck-stack readme
naemono Jun 20, 2022
b9cffc4
quote things to passify spellcheck
naemono Jun 20, 2022
0fcfb91
Quote more vars.
naemono Jun 20, 2022
9ed4c4e
Fix sc2045
naemono Jun 20, 2022
426121e
Updates from first round of reviews.
naemono Jun 23, 2022
44a2373
Update the documentation.
naemono Jun 23, 2022
5dfae51
Fix shellcheck
naemono Jun 23, 2022
8325042
Add note that ECK stack helm charts are enterprise
naemono Jun 29, 2022
ef8d97f
Update license note in docs/orchestrating-elastic-stack-applications/…
naemono Jun 30, 2022
71a9154
Update verbiage deploy/eck-stack/README.md
naemono Jun 30, 2022
2ff2fbd
Update verbiage deploy/eck-stack/README.md
naemono Jun 30, 2022
ffb1522
Add 'the' to documentation in docs/orchestrating-elastic-stack-appli…
naemono Jun 30, 2022
2c7be26
add 'the' again to docs in docs/orchestrating-elastic-stack-applicat…
naemono Jun 30, 2022
60937d9
Comment out affinity section, as it won't work by default.
naemono Jul 11, 2022
ebb0e41
Update public documentation to be more clear.
naemono Jul 15, 2022
2f4c274
Add dedicated master nodes to dedicated examples
naemono Jul 15, 2022
a62f8f4
Fix elasticsearch test in eck-elasticsearch chart
naemono Jul 19, 2022
bf15730
Fix missing default labels in Elasticsearch.
naemono Jul 20, 2022
bffa0b4
Make default quickstart elasticsearchRef work by default.
naemono Jul 20, 2022
4474144
Removing logic that inserts namespace for elasticsearchRef, as operat…
naemono Jul 21, 2022
00bc01a
Move to referencing https://helm.elastic.co helm repository.
naemono Jul 21, 2022
58dde1c
Fix helm tests
naemono Jul 21, 2022
35b9259
Add helm test to pr ci pipeline
naemono Jul 21, 2022
a4babf4
Add helm to ci-tools container.
naemono Jul 21, 2022
0317433
Handling Review comments
naemono Jul 22, 2022
614d3cc
Adjust default readme in deploy directory
naemono Jul 22, 2022
148369a
Debugging helm unittest
naemono Jul 22, 2022
04478f1
Fix shellcheck complaining about debugging messages.
naemono Jul 25, 2022
777500b
Try and run helm unittest directly
naemono Jul 25, 2022
b5d4320
Install the correct plugin, with static version
naemono Jul 25, 2022
4133b83
Adjust default values for eck-elasticsearch, and eck-kibana for the e…
naemono Jul 25, 2022
0bd2310
Fix test for default elasticsearch name
naemono Jul 25, 2022
5d86328
Remove debugging from helm test script.
naemono Jul 25, 2022
15cffbd
Adjust chart.yaml back to using helm.elastic.co repository.
naemono Jul 25, 2022
44bab71
Use sed to force local changes during helm testing, and not charts in…
naemono Jul 25, 2022
0a61296
Making shellcheck happy
naemono Jul 25, 2022
fd43737
Add helm documentation to dev-setup.md.
naemono Jul 26, 2022
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ pkg/controller/common/license/zz_generated.pubkey.go

# ignore validator for Jenkins pipelines
hack/pipeline-validator/validator

# ignore helm chart dependencies in eck-stack chart
deploy/eck-stack/charts/*
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ unit: clean
unit-xml: clean
ECK_TEST_LOG_LEVEL=$(LOG_VERBOSITY) gotestsum --junitfile unit-tests.xml -- -cover ./pkg/... ./cmd/... $(TEST_OPTS)

helm-test:
@hack/helm/test.sh

integration: GO_TAGS += integration
integration: clean generate-crds-v1
ECK_TEST_LOG_LEVEL=$(LOG_VERBOSITY) go test -tags='$(GO_TAGS)' ./pkg/... ./cmd/... -cover $(TEST_OPTS)
Expand Down Expand Up @@ -530,7 +533,7 @@ e2e-local: go-generate

ci-check: check-license-header lint shellcheck generate check-local-changes check-predicates

ci: unit-xml integration-xml docker-build reattach-pv
ci: unit-xml integration-xml helm-test docker-build reattach-pv

setup-e2e: e2e-compile run-deployer apply-psp e2e-docker-multiarch-build

Expand Down
23 changes: 23 additions & 0 deletions deploy/eck-elasticsearch/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions deploy/eck-elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: eck-elasticsearch
description: A Helm chart to deploy Elasticsearch managed by the ECK Operator.
type: application
version: 0.1.0
Copy link
Member

Choose a reason for hiding this comment

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

I also recommend adding the appVersion set to the operator version.

sources:
- https://github.com/elastic/cloud-on-k8s
- https://github.com/elastic/elasticsearch/
icon: https://helm.elastic.co/icons/elasticsearch.png
9 changes: 9 additions & 0 deletions deploy/eck-elasticsearch/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

1. Check Elasticsearch cluster status
$ kubectl get es --namespace={{ .Release.Namespace }} -L common.k8s.elastic.co/type=elasticsearch
naemono marked this conversation as resolved.
Show resolved Hide resolved

2. Check Elasticsearch pod status
$ kubectl get pods --namespace={{ .Release.Namespace }} -L common.k8s.elastic.co/type=elasticsearch
naemono marked this conversation as resolved.
Show resolved Hide resolved

3. Expose Elasticsearch service
$ kubectl port-forward svc/{{ .Values.name }}-es-http 9200
naemono marked this conversation as resolved.
Show resolved Hide resolved
51 changes: 51 additions & 0 deletions deploy/eck-elasticsearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "elasticsearch.fullname" -}}
naemono marked this conversation as resolved.
Show resolved Hide resolved
{{- 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 chart name and version as used by the chart label.
*/}}
{{- define "elasticsearch.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "elasticsearch.labels" -}}
helm.sh/chart: {{ include "elasticsearch.chart" . }}
{{ include "elasticsearch.selectorLabels" . }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Chart.AppVersion }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "elasticsearch.selectorLabels" -}}
app.kubernetes.io/name: {{ include "elasticsearch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
41 changes: 41 additions & 0 deletions deploy/eck-elasticsearch/templates/elasticsearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: {{ required "A name for the Elasticsearch instance is required" .Values.name }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
namespace: {{ .Release.Namespace }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.labels }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
labels:
{{- toYaml .Values.labels | indent 4 }}
{{- end }}
{{- if .Values.annotations }}
annotations:
{{- toYaml .Values.annotations | indent 4 }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}
spec:
{{- if .Values.updateStrategy }}
updateStrategy:
{{- toYaml .Values.updateStrategy | indent 4 }}
{{- end }}
{{- if .Values.secureSettings }}
secureSettings:
{{- toYaml .Values.secureSettings | indent 2 }}
{{- end }}
{{- if .Values.transport }}
transport:
{{- toYaml .Values.transport | indent 4 }}
{{- end }}
version: {{ required "An Elasticsearch version is required" .Values.version }}
{{- if .Values.monitoring }}
monitoring:
{{- toYaml .Values.monitoring | indent 4 }}
{{- end }}
{{- if .Values.remoteClusters }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
remoteClusters:
{{- toYaml .Values.remoteClusters | indent 2 }}
{{- end }}
{{- if eq (len .Values.nodeSets) 0 }}
{{ fail "At least one nodeSet is required" }}
{{- end }}
nodeSets:
{{ toYaml .Values.nodeSets | indent 4 }}
86 changes: 86 additions & 0 deletions deploy/eck-elasticsearch/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
# Default values for eck-elasticsearch.
# This is a YAML-formatted file.

# Name of the Elasticsearch instance.
#
name: "quickstart"

# Version of Elasticsearch.
#
version: 8.2.3

# Labels that will be applied to Elasticsearch.
#
labels: {}

# Annotations that will be applied to Elasticsearch.
#
annotations: {}

# Settings for configuring stack monitoring.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-stack-monitoring.html
#
monitoring: {}

# Control the Elasticsearch transport module used for internal communication between nodes.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-transport-settings.html
#
transport: {}

# Settings to control how Elasticsearch will be accessed.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-accessing-elastic-services.html
#
http: {}

# Control Elasticsearch Secure Settings.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-es-secure-settings.html#k8s-es-secure-settings
#
secureSettings: {}

# Settings for limiting the number of simultaneous changes to an Elasticsearch cluster.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-update-strategy.html
#
# The default are the default settings for ECK.
naemono marked this conversation as resolved.
Show resolved Hide resolved
#
updateStrategy: {}

# Controlling of connectivity between remote clusters within the same kubernetes cluster.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-remote-clusters.html
#
remoteClusters: {}

# Node configuration settings.
# The node roles which can be configured here are:
# - "master"
# - "data_hot"
# - "data_cold"
# - "data_frozen"
# - "data_content"
# - "ml"
# - "ingest"
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-node-configuration.html
#
nodeSets:
- name: default
count: 1
config:
node.store.allow_mmap: false
naemono marked this conversation as resolved.
Show resolved Hide resolved
naemono marked this conversation as resolved.
Show resolved Hide resolved
podTemplate:
spec:
containers:
- name: elasticsearch
resources:
requests:
cpu: 1
limits:
memory: 1Gi
# Uncomment these lines in case you want to increase vm.max_map_count and/or use initContainers.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
# initContainers:
# - name: sysctl
# securityContext:
# privileged: true
# runAsUser: 0
# command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
naemono marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions deploy/eck-kibana/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions deploy/eck-kibana/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: eck-kibana
description: A Helm chart to deploy Kibana managed by the ECK Operator.
type: application
version: 0.1.0
Copy link
Member

Choose a reason for hiding this comment

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

also having appVersion field would be great.

sources:
- https://github.com/elastic/cloud-on-k8s
- https://github.com/elastic/kibana
icon: https://helm.elastic.co/icons/kibana.png
9 changes: 9 additions & 0 deletions deploy/eck-kibana/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

1. Check Kibana status
$ kubectl get kibana --namespace={{ .Release.Namespace }} -L common.k8s.elastic.co/type=kibana
naemono marked this conversation as resolved.
Show resolved Hide resolved

2. Check Kibana pod status
$ kubectl get pods --namespace={{ .Release.Namespace }} -L common.k8s.elastic.co/type=kibana

3. Expose Kibana service
$ kubectl port-forward svc/{{ .Values.name }}-kb-http 9200
naemono marked this conversation as resolved.
Show resolved Hide resolved
62 changes: 62 additions & 0 deletions deploy/eck-kibana/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kibana.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kibana.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 chart name and version as used by the chart label.
*/}}
{{- define "kibana.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kibana.labels" -}}
helm.sh/chart: {{ include "kibana.chart" . }}
{{ include "kibana.selectorLabels" . }}
{{- if .Chart.AppVersion }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kibana.selectorLabels" -}}
app.kubernetes.io/name: {{ include "kibana.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kibana.serviceAccountName" -}}
naemono marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.serviceAccount.create }}
{{- default (include "kibana.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions deploy/eck-kibana/templates/kibana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: {{ required "A name for the Kibana instance is required" .Values.name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "kibana.labels" . | nindent 4 }}
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
annotations:
{{- range $key, $value := .Values.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
naemono marked this conversation as resolved.
Show resolved Hide resolved
spec:
version: {{ required "A Kibana version is required" .Values.version }}
{{- $finalSpec := .Values.spec }}
{{- if and .Values.spec.elasticsearchRef ( not .Values.spec.elasticsearchRef.namespace ) }}
{{- $finalSpec = mustMergeOverwrite (dict) .Values.spec (dict "elasticsearchRef" (dict "namespace" .Release.Namespace )) }}
{{- end }}
{{- toYaml $finalSpec | nindent 2 }}
Loading