Skip to content

WPB-12109: Migrate Elasticsearch client to upstream bloodhound v1.0.0.0 and OpenSearch 1.3 - #5561

Open
blackheaven wants to merge 8 commits into
developfrom
gdifolco/WPB-12109-bloodhound-upstream
Open

blackheaven wants to merge 8 commits into
developfrom
gdifolco/WPB-12109-bloodhound-upstream

Conversation

@blackheaven

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-12109

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

Replace our wireapp/bloodhound fork pin with upstream bitemyapp/bloodhound
v1.0.0.0 (rev-pinned in flake.nix) and port all call sites to its API:

- Drop the typed-API surface (MappingName/searchByType/putNamedMapping) in
  favor of untyped /{index}/_doc and PUT /{index}/_mapping endpoints;
  requires ES >= 7 (or >= 6.7 with untyped indices).
- Handle the new error model: runBH returns Either EsError, client functions
  throw EsError; normalize via tryEsError in the polysemy interpreters.
  Version-conflict (409) tolerance is preserved via error status checks.
- Version user documents with external_gte instead of strictly-greater
  external: re-indexing with an equal version now overwrites (behavior
  change, covered by a new mock-interpreter unit test).
- Adapt to upstream changes: abstract IndexName (mkIndexName/unIndexName),
  Key-typed term fields, Maybe BooleanOperator, 3-field IndexSettings,
  EsResult-based getDocument, new MonadBH class (Backend/dispatch).
- Bump dev chart elasticsearch-ephemeral to ES 7.17.26 (chart 0.0.43).
@blackheaven
blackheaven requested review from a team as code owners September 24, 2026 15:58
Replace ElasticSearch with OpenSearch 1.3.20 as the search backend across
charts, dev/demo deployment, and integration test setup:

- Rename charts elasticsearch-{ephemeral,index,external,curator} to
  opensearch-*; ephemeral chart now runs opensearchproject/opensearch:1.3.20
  with OpenSearch env names (OPENSEARCH_JAVA_OPTS, plugins.security.ssl.http.*
  for TLS, DISABLE_SECURITY_PLUGIN when TLS is off).
- Replace the kibana chart with a native opensearch-dashboards chart
  (opensearchproject/opensearch-dashboards:1); kibana-basic-auth secret
  behavior unchanged. The Kibana index-pattern postStart import hook is
  dropped (endpoint removed in OpenSearch Dashboards 1.x).
- dockerephemeral: drop the elasticsearch:6.8.23 service; OpenSearch is the
  only search service, published on localhost:9200; nginx ES-proxy removed;
  federation brig configs point directly at OpenSearch with basic-auth
  credentials matching the mounted securityconfig.
- integration.yaml additionalElasticSearch repointed to the OpenSearch
  endpoint; hack/helmfile + helm_vars release names, hosts, and cert-manager
  Issuer renamed (official opensearch/opensearch release renamed to
  opensearch-cluster to avoid a release-name collision).
- Brig's elasticsearch:* config keys and the Haskell client are unchanged.
  Migration instructions in changelog.d/5-internal/opensearch-cutover.md.
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Sep 24, 2026
The opensearch-ephemeral Certificate template inherited encoding: PKCS1
from the old elasticsearch chart, which emits an SEC1 'EC PRIVATE KEY'
block. OpenSearch 1.x (Java 11 + security plugin) only parses PKCS#8,
so opensearch-ephemeral and opensearch-cluster-master (which mounts
tls.key from the same secret) crash-looped with 'File does not contain
valid private key' during CI integration setup, and the brig
'different ElasticSearch instance' migration test failed TLS
verification against the demo cert served meanwhile.
Two cert-manager Certificates (the opensearch chart extraObjects and the
opensearch-ephemeral chart) wrote the same secret
opensearch-ephemeral-certificate, racing on who owns it. Once the
ephemeral chart's PKCS8 fix re-issued it, the secret flipped to a cert
with SAN opensearch-ephemeral and every TLS client of
opensearch-cluster-master (notably the opensearch-index-create pre-install
hook) failed hostname verification, failing the wire-server release with
'job opensearch-index-create failed: BackoffLimitExceeded'.

Dedicate opensearch-cluster-certificate to the cluster chart (extraObjects
Certificate + secretMounts). The shared CA is unaffected: caSecretName
references keep pointing at opensearch-ephemeral-certificate, whose ca.crt
is issued by the same Issuer.
…meral

The TLS branch of the ephemeral chart ran OpenSearch 1.x with the demo
securityconfig (admin/admin), while every consumer (brig integration
tests, helm_vars secrets, federation credential files) authenticates as
elastic/changeme. Dual-writing to the additional instance therefore
failed with 401 ('Create index - error: EsError {errorStatus = Just
401, ...}') in the brig integration tests.

Mount a chart-provided securityconfig secret (same content as
helm_vars/opensearch: basic auth, user elastic with the changeme hash,
index_manager -> all_access) and set DISABLE_INSTALL_DEMO_CONFIG=true
when TLS is enabled, mirroring the dockerephemeral compose setup.
@blackheaven
blackheaven force-pushed the gdifolco/WPB-12109-bloodhound-upstream branch from 2f38b8b to 4cb3475 Compare September 24, 2026 21:58
The TLS branch enabled only HTTP SSL while the mounted securityconfig
enables transport authentication, so the security plugin failed to
initialize and the pod crash-looped. With no endpoints behind the
service, clients saw 'connect: permission denied (EPERM)' — the brig
'different ElasticSearch instance' migration test failed, and the
missing readiness probe let 'helm --wait' declare the release ready
anyway.

Configure transport SSL (certs/tls.crt, certs/tls.key, certs/ca.crt,
hostname verification off), allow_default_init_securityindex and the
internal audit type — matching the proven dockerephemeral compose
config — and add TCP readiness/liveness probes so a broken OpenSearch
fails the helmfile setup instead of the integration tests.
@blackheaven blackheaven changed the title WPB-12109: Migrate Elasticsearch client to upstream bloodhound v1.0.0.0 WPB-12109: Migrate Elasticsearch client to upstream bloodhound v1.0.0.0 and OpenSearch 1.3 Sep 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants