Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
Helm 3 (elastic#516)
Browse files Browse the repository at this point in the history
* bump helm version to helm 3.4.1
* update doc to make helm 3 the recommended version
* update helm commands arguments for helm 3
* remove helm init and tiller install commands
* add stable repo for metricbeat dependencies
* remove the charts dance in helmignore (related to elastic#127)
* optimize docker images
* replace deprecated gitversion capability (related to helm/helm#5601)
* remove some heritage labels in immutable fields
  • Loading branch information
jmlrt committed Nov 17, 2020
1 parent 5d0eb5a commit f29459b
Show file tree
Hide file tree
Showing 49 changed files with 160 additions and 184 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
- [Support Matrix](#support-matrix)
- [Kubernetes Versions](#kubernetes-versions)
- [Helm versions](#helm-versions)
- [Helm 3 beta](#helm-3-beta)
- [ECK](#eck)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Expand Down Expand Up @@ -76,13 +75,8 @@ exact versions are defined under `KUBERNETES_VERSIONS` in
### Helm versions

While we are checking backward compatibility, the charts are only tested with
Helm version mentioned in [helm-tester Dockerfile][] (currently 2.17.0).
Helm version mentioned in [helm-tester Dockerfile][] (currently 3.4.1).

#### Helm 3 beta

While we don't have automated tests for [Helm 3][] yet, we fixed the main
blockers to use it. We now have enough feedbacks from internal and external
users to add support in beta.

## ECK

Expand All @@ -96,7 +90,6 @@ Kubernetes.
[elastic cloud on kubernetes]: https://github.com/elastic/cloud-on-k8s
[elastic helm repo]: https://helm.elastic.co
[github releases]: https://github.com/elastic/helm-charts/releases
[helm 3]: https://v3.helm.sh
[helm-tester Dockerfile]: https://github.com/elastic/helm-charts/blob/6.8/helpers/helm-tester/Dockerfile
[helpers/matrix.yml]: https://github.com/elastic/helm-charts/blob/6.8/helpers/matrix.yml
[operator pattern]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
Expand Down
9 changes: 4 additions & 5 deletions apm-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ This chart is tested with the latest 6.8.14-SNAPSHOT version.
`helm repo add elastic https://helm.elastic.co`

* Install it:
- with Helm 2: `helm install --name apm-server --version <version> elastic/apm-server`
- with [Helm 3 (beta)][]: `helm install apm-server --version <version> elastic/apm-server`
- with Helm 3: `helm install apm-server --version <version> elastic/apm-server`
- with Helm 2 (deprecated): `helm install --name apm-server --version <version> elastic/apm-server`

### Install development version using 6.8 branch and 6.8.14-SNAPSHOT versions

Expand All @@ -60,8 +60,8 @@ This chart is tested with the latest 6.8.14-SNAPSHOT version.
* Checkout the branch : git checkout 6.8

* Install it:
- with Helm 2: `helm install --name apm-server --version 6.8.14-SNAPSHOT ./helm-charts/apm-server`
- with [Helm 3 (beta)][]: `helm install apm-server --version 6.8.14-SNAPSHOT ./helm-charts/apm-server`
- with Helm 3: `helm install apm-server ./helm-charts/apm-server --set imageTag=6.8.14-SNAPSHOT`
- with Helm 2 (deprecated): `helm install --name apm-server ./helm-charts/apm-server --set imageTag=6.8.14-SNAPSHOT`


## Upgrading
Expand Down Expand Up @@ -163,7 +163,6 @@ about our development and testing process.
[examples/oss]: https://github.com/elastic/helm-charts/tree/6.8/apm-server/examples/oss
[examples/security]: https://github.com/elastic/helm-charts/tree/6.8/apm-server/examples/security
[helm]: https://helm.sh
[helm 3 (beta)]: https://github.com/elastic/helm-charts/tree/master/README.md#helm-3-beta
[horizontal pod autoscaler]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
[imagePullPolicy]: https://kubernetes.io/docs/concepts/containers/images/#updating-images
[imagePullSecrets]: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret
Expand Down
4 changes: 2 additions & 2 deletions apm-server/examples/default/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ include ../../../helpers/examples.mk
RELEASE := helm-apm-server-default

install:
helm upgrade --wait --timeout=900 --install $(RELEASE) ../../
helm upgrade --wait --timeout=900s --install $(RELEASE) ../../

test: install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions apm-server/examples/oss/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ include ../../../helpers/examples.mk
RELEASE := helm-apm-server-oss

install:
helm upgrade --wait --timeout=900 --install $(RELEASE) --values values.yaml ../../
helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../

test: install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions apm-server/examples/security/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ include ../../../helpers/examples.mk
RELEASE := helm-apm-server-security

install:
helm upgrade --wait --timeout=900 --install $(RELEASE) --values values.yaml ../../
helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../

test: install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions apm-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
Return the appropriate apiVersion for ingress.
*/}}
{{- define "apm.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.Version -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- end -}}
{{- end -}}
{{- define "apm.autoscaling.apiVersion" -}}
{{- if semverCompare "<1.12-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare "<1.12-0" .Capabilities.KubeVersion.Version -}}
{{- print "autoscaling/v2beta1" -}}
{{- else -}}
{{- print "autoscaling/v2beta2" -}}
Expand Down
13 changes: 7 additions & 6 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ This chart is tested with the latest 6.8.14-SNAPSHOT version.
`helm repo add elastic https://helm.elastic.co`

* Install it:
- with Helm 2: `helm install --name elasticsearch --version <version> elastic/elasticsearch`
- with [Helm 3 (beta)][]: `helm install elasticsearch --version <version> elastic/elasticsearch`
- with Helm 3: `helm install elasticsearch --version <version> elastic/elasticsearch`
- with Helm 2 (deprecated): `helm install --name elasticsearch --version <version> elastic/elasticsearch`


### Install development version using 6.8 branch and 6.8.14-SNAPSHOT versions

Expand All @@ -71,8 +72,9 @@ This chart is tested with the latest 6.8.14-SNAPSHOT version.
* Checkout the branch : git checkout 6.8

* Install it:
- with Helm 2: `helm install --name elasticsearch --version 6.8.14-SNAPSHOT ./helm-charts/elasticsearch`
- with [Helm 3 (beta)][]: `helm install elasticsearch --version 6.8.14-SNAPSHOT ./helm-charts/elasticsearch`
- with Helm 3: `helm install elasticsearch ./helm-charts/elasticsearch --set imageTag=6.8.14-SNAPSHOT`
- with Helm 2 (deprecated): `helm install --name elasticsearch ./helm-charts/elasticsearch --set imageTag=6.8.14-SNAPSHOT`


## Upgrading

Expand Down Expand Up @@ -159,7 +161,7 @@ support multiple versions with minimal changes.
| `secretMounts` | Allows you easily mount a secret as a file inside the StatefulSet. Useful for mounting certificates and other secrets. See [values.yaml][] for an example | `[]` |
| `securityContext` | Allows you to set the [securityContext][] for the container | see [values.yaml][] |
| `service.annotations` | [LoadBalancer annotations][] that Kubernetes will use for the service. This will configure load balancer if `service.type` is `LoadBalancer` | `{}` |
| `service.externalTrafficPolicy` | Some cloud providers allow you to specify the [LoadBalancer externalTrafficPolicy][]. Kubernetes will use this to preserve the client source IP. This will configure load balancer if `service.type` is `LoadBalancer` | `""` |
| `service.externalTrafficPolicy` | Some cloud providers allow you to specify the [LoadBalancer externalTrafficPolicy][]. Kubernetes will use this to preserve the client source IP. This will configure load balancer if `service.type` is `LoadBalancer` | `""` |
| `service.httpPortName` | The name of the http port within the service | `http` |
| `service.labelsHeadless` | Labels to be added to headless service | `{}` |
| `service.labels` | Labels to be added to non-headless service | `{}` |
Expand Down Expand Up @@ -416,7 +418,6 @@ about our development and testing process.
[examples/security]: https://github.com/elastic/helm-charts/tree/6.8/elasticsearch/examples/security
[gke]: https://cloud.google.com/kubernetes-engine
[helm]: https://helm.sh
[helm 3 (beta)]: https://github.com/elastic/helm-charts/tree/master/README.md#helm-3-beta
[helm/charts stable]: https://github.com/helm/charts/tree/master/stable/elasticsearch/
[how to install plugins guide]: https://github.com/elastic/helm-charts/tree/6.8/elasticsearch/README.md#how-to-install-plugins
[how to use the keystore]: https://github.com/elastic/helm-charts/tree/6.8/elasticsearch/README.md#how-to-use-the-keystore
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch/examples/config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include ../../../helpers/examples.mk
RELEASE := helm-es-config

install:
helm upgrade --wait --timeout=900 --install $(RELEASE) --values ./values.yaml ../../
helm upgrade --wait --timeout=900s --install $(RELEASE) --values ./values.yaml ../../

secrets:
kubectl delete secret elastic-config-credentials elastic-config-secret elastic-config-slack elastic-config-custom-path || true
Expand All @@ -16,4 +16,4 @@ secrets:
test: secrets install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
6 changes: 3 additions & 3 deletions elasticsearch/examples/default/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ include ../../../helpers/examples.mk
RELEASE := helm-es-default

install:
helm upgrade --wait --timeout=900 --install $(RELEASE) ../../
helm upgrade --wait --timeout=900s --install $(RELEASE) ../../

restart:
helm upgrade --set terminationGracePeriod=121 --wait --timeout=900 --install $(RELEASE) ../../
helm upgrade --set terminationGracePeriod=121 --wait --timeout=900s --install $(RELEASE) ../../

test: install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions elasticsearch/examples/docker-for-mac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ default: test
RELEASE := helm-es-docker-for-mac

install:
helm upgrade --wait --timeout=1200 --install --values values.yaml $(RELEASE) ../../
helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../

test: install
helm test $(RELEASE)

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
6 changes: 3 additions & 3 deletions elasticsearch/examples/kubernetes-kind/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ default: test
RELEASE := helm-es-kind

install:
helm upgrade --wait --timeout=1200 --install --values values.yaml $(RELEASE) ../../
helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../

install-local-path:
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
helm upgrade --wait --timeout=1200 --install --values values-local-path.yaml $(RELEASE) ../../
helm upgrade --wait --timeout=1200s --install --values values-local-path.yaml $(RELEASE) ../../

test: install
helm test $(RELEASE)

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions elasticsearch/examples/microk8s/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ default: test
RELEASE := helm-es-microk8s

install:
helm upgrade --wait --timeout=1200 --install --values values.yaml $(RELEASE) ../../
helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../

test: install
helm test $(RELEASE)

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
6 changes: 3 additions & 3 deletions elasticsearch/examples/migration/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PREFIX := helm-es-migration

data:
helm upgrade --wait --timeout=900 --install --values ./data.yml $(PREFIX)-data ../../
helm upgrade --wait --timeout=900s --install --values ./data.yml $(PREFIX)-data ../../

master:
helm upgrade --wait --timeout=900 --install --values ./master.yml $(PREFIX)-master ../../
helm upgrade --wait --timeout=900s --install --values ./master.yml $(PREFIX)-master ../../

client:
helm upgrade --wait --timeout=900 --install --values ./client.yml $(PREFIX)-client ../../
helm upgrade --wait --timeout=900s --install --values ./client.yml $(PREFIX)-client ../../
4 changes: 2 additions & 2 deletions elasticsearch/examples/minikube/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ default: test
RELEASE := helm-es-minikube

install:
helm upgrade --wait --timeout=1200 --install --values values.yaml $(RELEASE) ../../
helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../

test: install
helm test $(RELEASE)

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
12 changes: 6 additions & 6 deletions elasticsearch/examples/multi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ PREFIX := helm-es-multi
RELEASE := helm-es-multi-master

install:
helm upgrade --wait --timeout=900 --install --values ./master.yml $(PREFIX)-master ../../
helm upgrade --wait --timeout=900 --install --values ./data.yml $(PREFIX)-data ../../
helm upgrade --wait --timeout=900 --install --values ./client.yml $(PREFIX)-client ../../
helm upgrade --wait --timeout=900s --install --values ./master.yml $(PREFIX)-master ../../
helm upgrade --wait --timeout=900s --install --values ./data.yml $(PREFIX)-data ../../
helm upgrade --wait --timeout=900s --install --values ./client.yml $(PREFIX)-client ../../

test: install goss

purge:
helm del --purge $(PREFIX)-master
helm del --purge $(PREFIX)-data
helm del --purge $(PREFIX)-client
helm del $(PREFIX)-master
helm del $(PREFIX)-data
helm del $(PREFIX)-client
4 changes: 2 additions & 2 deletions elasticsearch/examples/openshift/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ template:
helm template --values ./values.yaml ../../

install:
helm upgrade --wait --timeout=900 --install $(RELEASE) --values ./values.yaml ../../
helm upgrade --wait --timeout=900s --install $(RELEASE) --values ./values.yaml ../../

test: install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions elasticsearch/examples/oss/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ include ../../../helpers/examples.mk
RELEASE := helm-es-oss

install:
helm upgrade --wait --timeout=900 --install $(RELEASE) --values ./values.yaml ../../
helm upgrade --wait --timeout=900s --install $(RELEASE) --values ./values.yaml ../../

test: install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions elasticsearch/examples/security/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ RELEASE := helm-es-security
ELASTICSEARCH_IMAGE := docker.elastic.co/elasticsearch/elasticsearch:$(STACK_VERSION)

install:
helm upgrade --wait --timeout=900 --install --values ./security.yml $(RELEASE) ../../
helm upgrade --wait --timeout=900s --install --values ./security.yml $(RELEASE) ../../

purge:
kubectl delete secrets elastic-credentials elastic-certificates elastic-certificate-pem elastic-certificate-crt|| true
helm del --purge $(RELEASE)
helm del $(RELEASE)

test: secrets install goss

Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1. Watch all cluster members come up.
$ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "elasticsearch.uname" . }} -w
2. Test cluster health using Helm test.
$ helm test {{ .Release.Name }} --cleanup
$ helm test {{ .Release.Name }}
4 changes: 2 additions & 2 deletions elasticsearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
Return the appropriate apiVersion for statefulset.
*/}}
{{- define "elasticsearch.statefulset.apiVersion" -}}
{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.Version -}}
{{- print "apps/v1beta2" -}}
{{- else -}}
{{- print "apps/v1" -}}
Expand All @@ -71,7 +71,7 @@ Return the appropriate apiVersion for statefulset.
Return the appropriate apiVersion for ingress.
*/}}
{{- define "elasticsearch.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.Version -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1beta1" -}}
Expand Down
4 changes: 1 addition & 3 deletions elasticsearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ spec:
name: {{ template "elasticsearch.uname" . }}
{{- if .Values.persistence.labels.enabled }}
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
chart: "{{ .Chart.Name }}"
app: "{{ template "elasticsearch.uname" . }}"
Expand All @@ -47,7 +46,6 @@ spec:
metadata:
name: "{{ template "elasticsearch.uname" . }}"
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
chart: "{{ .Chart.Name }}"
app: "{{ template "elasticsearch.uname" . }}"
Expand Down Expand Up @@ -154,7 +152,7 @@ spec:
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
{{- if semverCompare ">1.13-0" .Capabilities.KubeVersion.GitVersion }}
{{- if semverCompare ">1.13-0" .Capabilities.KubeVersion.Version }}
enableServiceLinks: {{ .Values.enableServiceLinks }}
{{- end }}
initContainers:
Expand Down
5 changes: 4 additions & 1 deletion elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,10 @@ def test_enabling_persistence_label_in_volumeclaimtemplate():
"volumeClaimTemplates"
][0]["metadata"]["labels"]
statefulset_labels = r["statefulset"][uname]["metadata"]["labels"]
assert volume_claim_template_labels == statefulset_labels
expected_labels = statefulset_labels
# heritage label shouldn't be present in volumeClaimTemplates labels
expected_labels.pop("heritage")
assert volume_claim_template_labels == expected_labels


def test_adding_a_secret_mount():
Expand Down
Loading

0 comments on commit f29459b

Please sign in to comment.