Keep Service ports added by other writers when the operator updates a Service

Abierto
#7,068 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, kubernetes

Línea de trabajo

Find the Service update path for MCPServer, MCPRemoteProxy, and VirtualMCPServer, along with the existing envtest coverage. Read how the operator currently builds and merges Service ports, then add envtest cases for preserving an extra port, dropping a same-number-and-protocol clash, and switching NodePort to ClusterIP. Done when operator ports come first, eligible unnamed or conflicting ports are dropped with Info logs, and kept ports have nodePort set to 0.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

needs-triage

When the operator updates the Service of an MCPServer, MCPRemoteProxy or VirtualMCPServer (for example after a session affinity change, or when the auth server TLS listener is turned on), it replaces the whole port list with the ports it generates. Anything another writer put in that list is lost: an appProtocol set on the http port for a Gateway or load balancer, or extra ports such as a metrics port.

Labels and annotations are already merged rather than replaced, because other controllers write to these Services (GKE NEG adds annotations, for example). Ports could follow the same rule. The drift check for Services only looks at the ports the operator owns, so this concerns the update path only.

Proposed behaviour when the operator updates the port list:

  • The operator's own ports (http, and https-auth when the listener is on) come first, in order, built from the desired state.
  • Other ports are kept in their existing order.
  • A kept port is dropped only if it clashes with an operator port, meaning the same number and the same protocol. Kubernetes allows TCP and UDP on the same number, so matching on the number alone is too broad.
  • A kept port with no name is dropped, because a Service with more than one port needs every port named.
  • nodePort is sent as 0 on every port, including the kept ones. An explicit value breaks changing a VirtualMCPServer Service from NodePort to ClusterIP, because the API server rejects a nodePort on a ClusterIP Service. The API server keeps an already allocated NodePort when an update leaves it out.
  • Log at Info level when a port is dropped, so the loss is visible.

A version of this was written while reviewing the "Expose auth server TLS listener port in operator" pull request (https://github.com/stacklok/toolhive/pull/7065). It was taken out to keep that change to one logical change. When this is picked up, it needs envtest cases for an extra port surviving an update, a clash being dropped, and the NodePort to ClusterIP switch.

Lenguaje dominante
Go
Estrellas
2.3k
Forks
326
Merge medio
1 d 6 h
PR fusionados (30 d)
158

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stacklok/toolhive

Todos los issues de stacklok/toolhive

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.