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

Fix helm chart rendering issues associated with indentation #6004

Merged
merged 2 commits into from
Sep 12, 2022
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ hack/pipeline-validator/validator

# ignore helm chart dependencies in eck-stack chart
deploy/eck-stack/charts/*

# Ignore eck-stack lockfile to allow upgrading of dependencies/child charts.
deploy/eck-stack/Chart.lock
2 changes: 1 addition & 1 deletion deploy/eck-elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: eck-elasticsearch
description: A Helm chart to deploy Elasticsearch managed by the ECK Operator.
kubeVersion: ">= 1.20.0-0"
type: application
version: 0.1.0
version: 0.1.1
sources:
- https://github.com/elastic/cloud-on-k8s
- https://github.com/elastic/elasticsearch/
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-elasticsearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ helm.sh/chart: {{ include "elasticsearch.chart" . }}
{{ include "elasticsearch.selectorLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.labels }}
{{ .Values.labels }}
{{ toYaml .Values.labels }}
{{- end }}
{{- end }}

Expand Down
18 changes: 11 additions & 7 deletions deploy/eck-elasticsearch/templates/elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,36 @@ metadata:
annotations:
eck.k8s.elastic.co/license: enterprise
{{- if .Values.annotations }}
{{- toYaml .Values.annotations | indent 4 }}
{{- toYaml .Values.annotations | nindent 4 }}
{{- end }}
spec:
{{- if .Values.updateStrategy }}
updateStrategy:
{{- toYaml .Values.updateStrategy | indent 4 }}
{{- toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
{{- if .Values.secureSettings }}
secureSettings:
{{- toYaml .Values.secureSettings | indent 2 }}
{{- toYaml .Values.secureSettings | nindent 2 }}
{{- end }}
{{- if .Values.transport }}
transport:
{{- toYaml .Values.transport | indent 4 }}
{{- toYaml .Values.transport | nindent 4 }}
{{- end }}
{{- if .Values.http }}
http:
{{- toYaml .Values.http | nindent 4 }}
{{- end }}
version: {{ required "An Elasticsearch version is required" .Values.version }}
{{- if .Values.monitoring }}
monitoring:
{{- toYaml .Values.monitoring | indent 4 }}
{{- toYaml .Values.monitoring | nindent 4 }}
{{- end }}
{{- if .Values.remoteClusters }}
remoteClusters:
{{- toYaml .Values.remoteClusters | indent 2 }}
{{- toYaml .Values.remoteClusters | nindent 2 }}
{{- end }}
{{- if eq (len .Values.nodeSets) 0 }}
{{ fail "At least one nodeSet is required" }}
{{- end }}
nodeSets:
{{ toYaml .Values.nodeSets | indent 4 }}
{{ toYaml .Values.nodeSets | nindent 4 }}
104 changes: 104 additions & 0 deletions deploy/eck-elasticsearch/templates/tests/elasticsearch_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,110 @@ tests:
- equal:
path: metadata.name
value: override
- it: should render labels, annotations, and additional custom values properly
set:
labels:
test: label
annotations:
test: annotation
monitoring:
metrics:
elasticsearchRefs:
- name: monitoring
namespace: observability
logs:
elasticsearchRefs:
- name: monitoring
namespace: observability
transport:
service:
metadata:
labels:
test: label
spec:
type: LoadBalancer
http:
service:
spec:
type: LoadBalancer
secureSettings:
- secretName: one-secure-settings-secret
- secretName: two-secure-settings-secret
updateStrategy:
changeBudget:
maxSurge: 3
maxUnavailable: 1
remoteClusters:
- name: cluster-one
elasticsearchRef:
name: cluster-one
- name: cluster-two
elasticsearchRef:
name: cluster-two
release:
name: quickstart
asserts:
- isKind:
of: Elasticsearch
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: quickstart
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: eck-elasticsearch
helm.sh/chart: eck-elasticsearch-0.1.1
test: label
- equal:
path: metadata.annotations
value:
eck.k8s.elastic.co/license: enterprise
test: annotation
- equal:
path: spec.monitoring
value:
metrics:
elasticsearchRefs:
- name: monitoring
namespace: observability
logs:
elasticsearchRefs:
- name: monitoring
namespace: observability
- equal:
path: spec.transport
value:
service:
metadata:
labels:
test: label
spec:
type: LoadBalancer
- equal:
path: spec.http
value:
service:
spec:
type: LoadBalancer
- equal:
path: spec.secureSettings
value:
- secretName: one-secure-settings-secret
- secretName: two-secure-settings-secret
- equal:
path: spec.updateStrategy
value:
changeBudget:
maxSurge: 3
maxUnavailable: 1
- equal:
path: spec.remoteClusters
value:
- name: cluster-one
elasticsearchRef:
name: cluster-one
- name: cluster-two
elasticsearchRef:
name: cluster-two
- it: should render node roles properly
values:
- ../../examples/hot-warm-cold.yaml
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-kibana/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: eck-kibana
description: A Helm chart to deploy Kibana managed by the ECK Operator.
kubeVersion: ">= 1.20.0-0"
type: application
version: 0.1.0
version: 0.1.1
sources:
- https://github.com/elastic/cloud-on-k8s
- https://github.com/elastic/kibana
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-kibana/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ helm.sh/chart: {{ include "kibana.chart" . }}
{{ include "kibana.selectorLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.labels }}
{{ .Values.labels }}
{{ toYaml .Values.labels }}
{{- end }}
{{- end }}

Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-kibana/templates/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
annotations:
eck.k8s.elastic.co/license: enterprise
{{- if .Values.annotations }}
{{- toYaml .Values.annotations | indent 4 }}
{{- toYaml .Values.annotations | nindent 4 }}
{{- end }}
spec:
version: {{ required "A Kibana version is required" .Values.version }}
Expand Down
24 changes: 24 additions & 0 deletions deploy/eck-kibana/templates/tests/kibana_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ tests:
- equal:
path: metadata.name
value: override
- it: should render custom labels, and annotations values properly
set:
labels:
test: label
annotations:
test: annotation
release:
name: quickstart
asserts:
- isKind:
of: Kibana
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: quickstart
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: eck-kibana
helm.sh/chart: eck-kibana-0.1.1
test: label
- equal:
path: metadata.annotations
value:
eck.k8s.elastic.co/license: enterprise
test: annotation
- it: should render http service properly
set:
spec.elasticsearchRef.namespace: default
Expand Down
9 changes: 0 additions & 9 deletions deploy/eck-stack/Chart.lock

This file was deleted.

4 changes: 2 additions & 2 deletions deploy/eck-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ version: 0.1.0
dependencies:
- name: eck-elasticsearch
condition: eck-elasticsearch.enabled
version: "0.1.0"
version: "0.1.1"
# uncomment for local testing, and comment
# the helm.elastic.co repository.
# repository: "file://../eck-elasticsearch"
repository: "https://helm.elastic.co"
- name: eck-kibana
condition: eck-kibana.enabled
version: "0.1.0"
version: "0.1.1"
# uncomment for local testing, and comment
# the helm.elastic.co repository.
# repository: "file://../eck-kibana"
Expand Down