From 53e42f1cabd6278947f1b95add73385842f3c9e1 Mon Sep 17 00:00:00 2001 From: Florian Loretan Date: Wed, 17 Jun 2020 14:09:16 +0200 Subject: [PATCH] [elasticsearch] Disable service links to prevent very long startup times (#542) Prevents very long startup times when the namespace contains many services. Only valid for kubernetes versions >1.13 --- elasticsearch/README.md | 1 + elasticsearch/templates/statefulset.yaml | 3 +++ elasticsearch/values.yaml | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index e8d26e2bd..15ed406ee 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -109,6 +109,7 @@ support multiple versions with minimal changes. | `antiAffinity` | Setting this to hard enforces the [anti-affinity][] rules. If it is set to soft it will be done "best effort". Other values will be ignored | `hard` | | `clusterHealthCheckParams` | The [Elasticsearch cluster health status params][] that will be used by readiness [probe][] command | `wait_for_status=green&timeout=1s` | | `clusterName` | This will be used as the Elasticsearch [cluster.name][] and should be unique per cluster in the namespace | `elasticsearch` | +| `enableServiceLinks` | Set to false to disabling service links, which can cause slow pod startup times when there are many services in the current namespace. | `true` | | `envFrom` | Templatable string to be passed to the [environment from variables][] which will be appended to the `envFrom:` definition for the container | `[]` | | `esConfig` | Allows you to add any config files in `/usr/share/elasticsearch/config/` such as `elasticsearch.yml` and `log4j2.properties`. See [values.yaml][] for an example of the formatting | `{}` | | `esJavaOpts` | [Java options][] for Elasticsearch. This is where you should configure the [jvm heap size][] | `-Xmx1g -Xms1g` | diff --git a/elasticsearch/templates/statefulset.yaml b/elasticsearch/templates/statefulset.yaml index acb1afbc8..f79b8f48f 100644 --- a/elasticsearch/templates/statefulset.yaml +++ b/elasticsearch/templates/statefulset.yaml @@ -143,6 +143,9 @@ spec: {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + {{- if semverCompare ">1.13" .Capabilities.KubeVersion.GitVersion }} + enableServiceLinks: {{ .Values.enableServiceLinks }} {{- end }} initContainers: {{- if .Values.sysctlInitContainer.enabled }} diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 069cfd17e..1d558e10c 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -159,6 +159,11 @@ nodeAffinity: {} # the same time when bootstrapping the cluster podManagementPolicy: "Parallel" +# The environment variables injected by service links are not used, but can lead to slow Elasticsearch boot times when +# there are many services in the current namespace. +# If you experience slow pod startups you probably want to set this to `false`. +enableServiceLinks: true + protocol: http httpPort: 9200 transportPort: 9300