Repository navigation
UNT162-10: Eureka in-cluster (discovery-server) no lugar do p-service-registry para o roteamento do Axon - #17
Merged
devin-ai-integration[bot] merged 3 commits intoNov 5, 2026
Conversation
…-registry para o roteamento do Axon, com prova em kind (2 réplicas, kill -9) Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Author
There was a problem hiding this comment.
🔍 Devin Review: 3 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
…st-once window, duplicate checks fail) - assert the generated ConfigMaps exist after the first (filtered) apply - during the eviction window: HTTP 200 <=> one log line and one event; other status <=> none - duplicate event counts now fail the script - kill -9 plus scale to 1 (pod-deletion-cost) so the restarted container cannot re-register before the lease expires; eviction timed by a background watcher - self-healing port-forwards Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
Author
|
Resposta às 3 flags do Devin Review, todas no head
|
Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plano
s3.3(UNT162-10): troca op-service-registrydo TAS pelo Eureka in-cluster do própriodiscovery-server, como decidido no ticket. O roteamento do Axon não muda: oSpringCloudCommandRoutercontinua publicando as capabilities de cada pod nos metadados da instância Eureka (loadFactor,serializedCommandFilter), comaxon.distributed.spring-cloud.fallback-to-http-get=false. Boot 2.0.3 / Java 8 / Axon 3.3.3 mantidos.Contexto
pom.xml:spring-cloud-services-starter-service-registry→spring-cloud-starter-netflix-eureka-client(Finchley); BOMspring-cloud-services-dependenciesremovido.discovery-server/.../application-kubernetes.properties: Eureka standalone, sem self-preservation, eviction a cada 5 s e sem read-only cache, para o anel de consistent hash não manter um pod morto.trader-app/trading-engine(application-kubernetes.properties): lease 5 s / expiração 15 s, fetch e replicação a cada 5 s,prefer-ip-address=true(IP do pod). Pod que cai sem deregistrar sai do anel em ~20-30 s (medido: 28 s e 33 s).deploy/kubernetes/discovery-server/: Deployment (non-root, rootfs read-only), Service ClusterIPdiscovery-server:8761e NetworkPolicies (apps → Eureka:8761; app ↔ app:8080 para oSpringHttpCommandBusConnector, já queinfra/k8s/platformnega ingress por padrão). Incluído nodeploy/kubernetes/kustomization.yamlpara o chart do s3.5.CommandLoggingConfiguration(trading-engine): interceptor nolocalSegmentque logaHandling command <payload>; é a evidência de qual pod tratou cada comando.ci/kind/: harness reproduzível (verify-axon-routing.sh) — kind, MySQL/RabbitMQ descartáveis com senhas geradas em runtime (nada commitado), 2×trader-appe 2×trading-engine.docs/migration/tas-gke-mapping.md: CHG-1, CHG-3, CHG-6, APP-4, SVC-4 e OPEN-5 fechados com a opção A.Contrato de API: sem mudança (nenhum endpoint, payload ou evento alterado).
Nada foi aplicado em GCP nem em apps/serviços do TAS.
Como testar
O script falha (exit ≠ 0) se qualquer verificação abaixo não passar:
transactionIdcom HTTP 200, exatamente 1 linhaHandling commandem todos os pods e exatamente 1*TransactionStartedEventno event store; cada agregado em um único pod (consistent hash).kill -9no JVM do trading-engine mais ocupado, pelo node (sem shutdown hook → sem deregistro), e ao mesmo temposcale --replicas=1compod-deletion-costpara o ReplicaSet remover o pod morto — senão o kubelet reinicia o container no mesmo IP e o JVM novo pode se re-registrar com o mesmo instance id antes do lease expirar (aconteceu numa rodada). Um watcher em background mede a evicção desde o kill e falha se o lease for re-registrado ou sumir em < 10 s (= deregistro, não crash).Ordens enviadas enquanto o Eureka ainda lista o pod morto, por ordem: HTTP 200 ⇔ exatamente 1 linha de log e 1
TransactionStartedEvent; qualquer outro status ⇔ 0 linhas e 0 eventos (evento persistido implica tratado; falha sem efeito colateral). Se um timeout HTTP chegasse depois de o comando ser tratado, o script falharia — não é aceito.scale --replicas=2: um pod novo entra no anel e as 40 ordens seguintes se dividem de novo entre os dois.TransactionStartedsão contados e qualquer valor ≠ 0 falha o script.apply(filtrado porapp.kubernetes.io/name notin (trader-app,trading-engine), que também seleciona objetos sem o label), o script confere quemysql-initdb,trader-app-configetrading-engine-configexistem antes do rollout do MySQL.Evidência
Rodada em cluster que não existia (sem
ESARCH_KIND_KEEP), no head deste PR, kind v0.24.0 / node v1.31.0:Saída (sem as linhas
created/Waiting for rolloutdo kubectl e o banner do kind):Mudança só em
ci/kind/verify-axon-routing.shdesde o head anterior (nenhum código Java);./mvnw -B test(Java 8, Maven 3.5.4) no head anterior: 171 testes, 0 falhas, 0 erros.Nesta rodada as 8 ordens da janela de evicção receberam HTTP 200 (roteadas ao sobrevivente). Numa rodada anterior 1 de 8 foi roteada ao pod morto: HTTP 500 após o timeout de conexão TCP (~2 min, o IP do pod já não existe), 0 linhas de log e 0 eventos — o caso “não tratado” acima. É o comportamento do
DistributedCommandBussem retry; umRetrySchedulernoCommandGatewayreduziria essa janela, fora do escopo deste passo.Observação: no kind single-node alguns starts de trader-app/trading-engine falham com
UnknownHostException: rabbitmq/mysql(CoreDNS sob carga de 4 JVMs) e o Kubernetes reinicia o container (colunaRESTARTS); okubectl port-forwarddo script se re-estabelece quando isso derruba o pod de destino. Não afeta o roteamento.Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/a98baf9b401546f9a23b947082d04865
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/a98baf9b401546f9a23b947082d04865?variant=devin
Requested by: @matthewguerra-cog