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

[meta] Helm 3 (#516) #902

Merged
merged 2 commits into from
Nov 18, 2020
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
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/7.x/helpers/helm-tester/Dockerfile
[helpers/matrix.yml]: https://github.com/elastic/helm-charts/blob/7.x/helpers/matrix.yml
[operator pattern]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
Expand Down
81 changes: 40 additions & 41 deletions apm-server/README.md

Large diffs are not rendered by default.

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
14 changes: 7 additions & 7 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@ This chart is tested with the latest 7.10.0-SNAPSHOT versions.
`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 7.x branch and 7.10.0-SNAPSHOT versions

* Clone the git repo: `git clone git@github.com:elastic/helm-charts.git`

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


## Upgrading
Expand Down Expand Up @@ -126,7 +127,7 @@ support multiple versions with minimal changes.
| `httpPort` | The http port that Kubernetes will use for the healthchecks and the service. If you change this you will also need to set [http.port][] in `extraEnvs` | `9200` |
| `imagePullPolicy` | The Kubernetes [imagePullPolicy][] value | `IfNotPresent` |
| `imagePullSecrets` | Configuration for [imagePullSecrets][] so that you can use a private registry for your image | `[]` |
| `imageTag` | The Elasticsearch Docker image tag | `7.10.0-SNAPSHOT` |
| `imageTag` | The Elasticsearch Docker image tag | `7.10.0-SNAPSHOT` |
| `image` | The Elasticsearch Docker image | `docker.elastic.co/elasticsearch/elasticsearch` |
| `ingress` | Configurable [ingress][] to expose the Elasticsearch service. See [values.yaml][] for an example | see [values.yaml][] |
| `initResources` | Allows you to set the [resources][] for the `initContainer` in the StatefulSet | `{}` |
Expand Down Expand Up @@ -158,7 +159,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 @@ -414,7 +415,6 @@ about our development and testing process.
[examples/security]: https://github.com/elastic/helm-charts/tree/7.x/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/7.x/elasticsearch/README.md#how-to-install-plugins
[how to use the keystore]: https://github.com/elastic/helm-charts/tree/7.x/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
7 changes: 2 additions & 5 deletions elasticsearch/examples/upgrade/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ RELEASE := helm-es-upgrade
install:
./scripts/upgrade.sh --release $(RELEASE)

init:
helm init --client-only

test: init install goss
test: install goss

purge:
helm del --purge $(RELEASE)
helm del $(RELEASE)
4 changes: 2 additions & 2 deletions elasticsearch/examples/upgrade/scripts/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ helm repo add elastic https://helm.elastic.co

# Initial install
printf "Installing Elasticsearch chart %s\n" "$FROM"
helm upgrade --wait --timeout=600 --install "$RELEASE" elastic/elasticsearch --version "$FROM" --set clusterName=upgrade
helm upgrade --wait --timeout=600s --install "$RELEASE" elastic/elasticsearch --version "$FROM" --set clusterName=upgrade
kubectl rollout status sts/upgrade-master --timeout=600s

# Upgrade
printf "Upgrading Elasticsearch chart\n"
helm upgrade --wait --timeout=600 --set terminationGracePeriod=121 --install "$RELEASE" ../../ --set clusterName=upgrade
helm upgrade --wait --timeout=600s --set terminationGracePeriod=121 --install "$RELEASE" ../../ --set clusterName=upgrade
kubectl rollout status sts/upgrade-master --timeout=600s
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 @@ -68,7 +68,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 @@ -79,7 +79,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 @@ -492,7 +492,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