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

[7.x] [elasticsearch] use bash for readiness script (#1458) #1459

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

jmlrt
Copy link
Member

@jmlrt jmlrt commented Dec 9, 2021

Backports the following commits to 7.x:

This commit set the readiness probe to use bash instead of sh. This is
required for Elasticsearch > 7.16.0 because the Docker image is now
based on Ubuntu instead of CentOS 8, and sh on Ubuntu isn't compatible
with the `if [[ ... -eq .... ]]` statements used in the readiness probe.
@jmlrt jmlrt added the backport label Dec 9, 2021
@jmlrt
Copy link
Member Author

jmlrt commented Dec 9, 2021

Tests are still failing because we can't download the goss binary from GitHub inside the Ubuntu based Elasticsearch Docker image:

elasticsearch@elasticsearch-master-0:~$ curl -L "https://github.com/aelsabbahy/goss/releases/download/v0.3.6/goss-linux-amd64" -o goss
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (77) error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs

It seems that's because the ca-certificates package is missing in the Docker image. cc @elastic/infra-release @elastic/es-delivery

@pugnascotia
Copy link
Contributor

We don't install ca-certificates for Elasticsearch, though we do copy in a file from ca-certificates-java. You can use apt-get to install ca-certificates though, e.g.

RUN set -eux ; \
    export DEBIAN_FRONTEND=noninteractive ; \
    apt-get update ; \
    apt-get install -y ca-certificates ; \
    apt-get clean ; \
    rm -rf /var/lib/apt/lists/*

@jmlrt
Copy link
Member Author

jmlrt commented Dec 9, 2021

We don't install ca-certificates for Elasticsearch, though we do copy in a file from ca-certificates-java. You can use apt-get to install ca-certificates though, e.g.

RUN set -eux ; \
    export DEBIAN_FRONTEND=noninteractive ; \
    apt-get update ; \
    apt-get install -y ca-certificates ; \
    apt-get clean ; \
    rm -rf /var/lib/apt/lists/*

Unfortunately that's not possible for Elasticsearch chart tests as we need to run tests in an already running container from the unmodified Elasticsearch image which means we also can't exec as root in the running pod to install the package.

jmlrt added a commit to jmlrt/helm-charts that referenced this pull request Dec 9, 2021
This commit update the way goss binary is retrieved in the
tests/examples. The goss binary is now downloaded locally then copied
inside the pod.

This is needed because the Elasticsearch Ubuntu based Docker images is
missing the ca-certificates package, and so the curl https command is
failling with `curl: (77) error setting certificate verify locations`
error.

Follow-up of elastic#1458
Relates to elastic#1459 (comment)
@jmlrt
Copy link
Member Author

jmlrt commented Dec 9, 2021

PR for workaround => #1460

@pugnascotia
Copy link
Contributor

Well...we could add the package in, but 7.16.0 has already been cut so that's not going to help you. It could be added for 7.16.1 I guess.

jmlrt added a commit that referenced this pull request Dec 9, 2021
This commit update the way goss binary is retrieved in the
tests/examples. The goss binary is now downloaded locally then copied
inside the pod.

This is needed because the Elasticsearch Ubuntu based Docker images is
missing the ca-certificates package, and so the curl https command is
failling with `curl: (77) error setting certificate verify locations`
error.

Follow-up of #1458
Relates to #1459 (comment)
@jmlrt
Copy link
Member Author

jmlrt commented Dec 9, 2021

Well...we could add the package in, but 7.16.0 has already been cut so that's not going to help you. It could be added for 7.16.1 I guess.

#1460 should do the trick for helm-charts tests, I don't know if there is other use cases outside of helm-charts tests that could require having to run curl with HTTPS inside the containers. I may roll back #1460 later id you're adding back the ca-certificate package in 7.16.1 but can live with it if you don't think that's worth adding it back.

@jmlrt
Copy link
Member Author

jmlrt commented Dec 9, 2021

Merging like this for now as tests are already failing anyway and it will need #1460 backport in addition of this PR to fix them.

@jmlrt jmlrt merged commit 42cd287 into elastic:7.x Dec 9, 2021
@jmlrt jmlrt deleted the backport/7.x/pr-1458 branch December 9, 2021 17:27
jmlrt added a commit to jmlrt/helm-charts that referenced this pull request Dec 9, 2021
This commit update the way goss binary is retrieved in the
tests/examples. The goss binary is now downloaded locally then copied
inside the pod.

This is needed because the Elasticsearch Ubuntu based Docker images is
missing the ca-certificates package, and so the curl https command is
failling with `curl: (77) error setting certificate verify locations`
error.

Follow-up of elastic#1458
Relates to elastic#1459 (comment)
jmlrt added a commit that referenced this pull request Dec 13, 2021
This commit update the way goss binary is retrieved in the
tests/examples. The goss binary is now downloaded locally then copied
inside the pod.

This is needed because the Elasticsearch Ubuntu based Docker images is
missing the ca-certificates package, and so the curl https command is
failling with `curl: (77) error setting certificate verify locations`
error.

Follow-up of #1458
Relates to #1459 (comment)
@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.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants