RobotLB detection in cozy-lib reads a key nothing writes, so nodePorts are disabled on every cluster

Aberta
#4,795 0 comentários 1 reação 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
45/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
helm, kubernetes

Direção de pesquisa

Start with packages/library/cozy-lib/templates/_network.tpl and trace how cozy-lib.network.disableLoadBalancerNodePorts gets its values from _cluster, rendered in packages/core/platform/templates/apps.yaml. Compare the available cluster values with how RobotLB is enabled through bundles.enabledPackages; the issue proposes publishing the active load balancer or detecting its Package. Done means the helper uses a signal that exists in v1.6 and keeps nodePorts enabled for RobotLB services.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

kind/bug triage/needs-triage
What happens

cozy-lib.network.disableLoadBalancerNodePorts is meant to keep nodePorts allocated when RobotLB is the load balancer, because RobotLB cannot work without them. It never does: on every 1.6 cluster it returns true and nodePorts are switched off, RobotLB or not.

The detection reads a key that nothing writes any more.

packages/library/cozy-lib/templates/_network.tpl:

{{- define "cozy-lib.network.disableLoadBalancerNodePorts" }}
{{-   include "cozy-lib.loadCozyConfig" (list "" .) }}
{{-   $cozyConfig := index . "cozyConfig" }}
{{-   if not $cozyConfig }}
{{-     include "cozy-lib.network.defaultDisableLoadBalancerNodePorts" . }}
{{-   else }}
{{-     $enabledComponents := splitList "," ((index $cozyConfig.data "bundle-enable") | default "") }}
{{-     not (has "robotlb" $enabledComponents) }}
{{-   end }}
{{- end }}

loadCozyConfig does not load a ConfigMap, it aliases the platform values channel:

{{- $_ := set (index . 1) "cozyConfig" (dict "data" ((index . 1).Values._cluster | default dict)) }}

_cluster is rendered by packages/core/platform/templates/apps.yaml and carries root-host, bundle-name, solver, issuer-name, wildcard-secret-name, the dns01-* keys and so on. It has never carried bundle-enable, which is a 0.x ConfigMap key: git grep bundle-enable across the tree hits only this template, two changelogs and hack/migrate-to-version-1.0.sh. Nothing writes it.

So the else branch evaluates splitList "," "", which is [""], has "robotlb" [""] is false, and the helper returns true. The if not $cozyConfig branch would return true as well. Both paths disable nodePorts unconditionally.

Enabling RobotLB through bundles.enabledPackages as the Hetzner install guide documents has no effect on this, because that list never reaches _cluster under any spelling.

Why it matters

Six shipped applications gate allocateLoadBalancerNodePorts: false on this helper:

packages/apps/http-cache/templates/haproxy/service.yaml
packages/apps/mongodb/templates/external-svc.yaml
packages/apps/postgres/templates/external-svc.yaml
packages/apps/redis/templates/service.yaml
packages/apps/tcp-balancer/templates/service.yaml
packages/apps/vm-instance/templates/service.yaml

On a Hetzner cluster every one of them renders allocateLoadBalancerNodePorts: false, and RobotLB then skips the service: its README states that a port is only reachable through its nodePort, that ports without one are skipped, and that allocateLoadBalancerNodePorts: false is not supported. So exposing Postgres, Redis, MongoDB, a TCP balancer or a VM externally silently produces a Service that never gets an address.

The failure gives the operator nothing to work with. The chart renders, the HelmRelease goes Ready, the Service sits in <pending>, and the RobotLB logs do not mention the service at all, because it was filtered out before anything was attempted.

Suggested fix

The helper needs a signal that exists in 1.6. Two directions:

  1. Have the platform publish the active load balancer on the _cluster channel, the same way it publishes solver and issuer-name, and key the helper off that. It fits the existing mechanism and stays declarative.
  2. Failing that, detect RobotLB from something observable at render time, such as the presence of its Package, rather than from a values key that no longer exists.

Whichever way, the legacy bundle-enable arm should go, or at least stop being the only thing that can return false.

Environment

Cozystack v1.6.4, bare metal on Hetzner, RobotLB enabled through bundles.enabledPackages: [cozystack.hetzner-robotlb] with MetalLB disabled.

Linguagem predominante
Go
Estrelas
2.2k
Forks
209
Merge médio
2d 9h
PRs com merge (30d)
130

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de cozystack/cozystack

Todas as issues de cozystack/cozystack

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.