Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow automatic Elasticsearch nodes discovery #3837

Merged
merged 3 commits into from
Oct 19, 2020
Merged

Conversation

barkbay
Copy link
Contributor

@barkbay barkbay commented Oct 14, 2020

This PR allows automatic discovery of Elasticsearch nodes by clients which support "sniffing" mode.

More precisely it:

  • Sets http.publish_host to the Pod hostname (in the form $(podname).$(governing service domain).$(namespace).svc). Note that it is different from network.publish_host, therefore I think we should not hit TestMutationHTTPToHTTPS is flaky  #3723 again.
  • Adds the DNS wildcards *.$(governing service domain).$(namespace).svc in the HTTP self signed certificate, for example:
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment
            X509v3 Extended Key Usage:
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Subject Alternative Name:
                DNS:elasticsearch-sample-es-http.default.es.local,
                DNS:elasticsearch-sample-es-http,
                DNS:elasticsearch-sample-es-http.default.svc,
                DNS:elasticsearch-sample-es-http.default,
                DNS:*.elasticsearch-sample-es-default.default.svc

Autodiscovery mostly makes sense if the client has an interface in the Kubernetes network. Therefore DNS wildcards are added automatically in the SANs only in the self signed certificate.

IPs are ephemeral in a Kubernetes cluster, I think it is fair to assume that DNS issues should be handled by the client. During my tests with the Node.js client it has always been able to gently reconnect to the cluster while I was randomly deleting the Elasticsearch Pods.

A sample based on the official ones is available here if you want to test that feature.

Fixes #3182

@botelastic botelastic bot added the triage label Oct 14, 2020
@barkbay barkbay added v1.4.0 >enhancement Enhancement of existing functionality labels Oct 14, 2020
@botelastic botelastic bot removed the triage label Oct 14, 2020
@barkbay
Copy link
Contributor Author

barkbay commented Oct 14, 2020

jenkins test this please

Copy link
Contributor

@sebgl sebgl left a comment

Choose a reason for hiding this comment

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

LGTM, just one naming suggestion.

pkg/controller/common/certificates/reconcile.go Outdated Show resolved Hide resolved
@barkbay barkbay merged commit c48ec7d into elastic:master Oct 19, 2020
@barkbay barkbay deleted the sniffv2 branch October 19, 2020 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support client nodes discovery (a.k.a. sniffing)
2 participants