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

Empty initContainers, preventing kustomize patches.#794

Closed
cloudziu wants to merge 1 commit intoelastic:masterfrom
cloudziu:hotfix/empty-initcontainer
Closed

Empty initContainers, preventing kustomize patches.#794
cloudziu wants to merge 1 commit intoelastic:masterfrom
cloudziu:hotfix/empty-initcontainer

Conversation

@cloudziu
Copy link
Copy Markdown
Contributor

@cloudziu cloudziu commented Aug 20, 2020

Messed up commit authors, so I could not properly sign CLA.

corrected here #795

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"}

…ntainers is declared, there will be no **initContainers:** directive.
@elasticmachine
Copy link
Copy Markdown
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?

@cla-checker-service
Copy link
Copy Markdown

❌ Author of the following commits did not sign a Contributor Agreement:
6c01a5d

Please, read and sign the above mentioned agreement if you want to contribute to this project

@cloudziu cloudziu closed this Aug 21, 2020
@cloudziu cloudziu deleted the hotfix/empty-initcontainer branch August 21, 2020 08:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants