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

ES Statefulset empty initContainers fix #795

Merged
merged 3 commits into from
Nov 24, 2020

Conversation

cloudziu
Copy link
Contributor

Modyfied elasticsearch statefulset template, so if none of the initContainers are declared, there will be no initContainers: directive.

  • Chart version not bumped (the versions are all bumped and released at the same time)
  • README.md updated with any new values or changes
  • Updated template tests in ${CHART}/tests/*.py
  • Updated integration tests in ${CHART}/examples/*/test/goss.yaml

Problem

Unable to patch image names/tags by using kustomize, when an empty initContainers directive is provided.
Error:
Error: containers path is not of type []interface{} but <nil>

Example with turned off all initContainers in values files.

extraInitContainers: []

sysctlInitContainer:
  enabled: false

keystore: []

Part of the statefulset

      terminationGracePeriodSeconds: 120
      volumes:
      enableServiceLinks: true
      initContainers:

      containers:
      - name: "elasticsearch"
        securityContext:
          capabilities:
            drop:
            - ALL

A fast workaround is to add a dummy initContainer.

What I've done in PR

Add an {{- if or }} statement to the initContainers: directive that will check if any of them is enabled.

Chart version

Elasticsearch chart
elastic/elasticsearch 7.9.0

Tools versions

Helm version
Client: &version.Version{SemVer:"v2.16.10", GitCommit:"bceca24a91639f045f22ab0f41e47589a932cf5e", GitTreeState:"clean"}

kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@botelastic
Copy link

botelastic bot commented Nov 23, 2020

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. To track this PR (even if closed), please open a corresponding issue if one does not already exist.

@botelastic botelastic bot removed the triage/stale label Nov 24, 2020
@jmlrt
Copy link
Member

jmlrt commented Nov 24, 2020

jenkins test this please

Copy link
Member

@jmlrt jmlrt left a comment

Choose a reason for hiding this comment

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

LGTM⛴

@jmlrt jmlrt merged commit f0681c1 into elastic:master Nov 24, 2020
jmlrt added a commit to jmlrt/helm-charts that referenced this pull request Nov 26, 2020
jmlrt added a commit to jmlrt/helm-charts that referenced this pull request Nov 26, 2020
jmlrt added a commit to jmlrt/helm-charts that referenced this pull request Nov 26, 2020
jmlrt added a commit that referenced this pull request Nov 26, 2020
jmlrt added a commit that referenced this pull request Nov 26, 2020
jmlrt added a commit that referenced this pull request Nov 26, 2020
@jmlrt jmlrt mentioned this pull request Feb 8, 2021
@jmlrt jmlrt mentioned this pull request Feb 18, 2021
This was referenced Mar 15, 2021
@jmlrt jmlrt mentioned this pull request May 25, 2021
@jmlrt jmlrt mentioned this pull request Mar 8, 2022
@jmlrt jmlrt mentioned this pull request Apr 21, 2022
This was referenced Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants