younsl opened a new pull request, #462:
URL: https://github.com/apache/superset-kubernetes-operator/pull/462

   ## Summary
   
   When podTemplate.container.ports is set on the web server or the MCP server, 
the operator [moves the default 
probes](https://github.com/apache/superset-kubernetes-operator/blob/da4e569fa86d70b9c6c28f6bc8dcdf593b8eadde/internal/controller/deployment_builder.go#L240-L270),
 the 
[Service](https://kubernetes.io/docs/concepts/services-networking/service/) 
targetPort, and the NetworkPolicy port to the new port, as the [configuration 
guide](https://github.com/apache/superset-kubernetes-operator/blob/da4e569fa86d70b9c6c28f6bc8dcdf593b8eadde/docs/user-guide/configuration.md?plain=1#L1038)
 describes. The server process does not move. The web server runs 
[run-server.sh](https://github.com/apache/superset/blob/b2fd72559a7b4a51c62f1f02c8bd736fc7777af4/docker/entrypoints/run-server.sh#L30),
 which binds gunicorn to SUPERSET_PORT with a fallback of 8088, but the 
operator never sets SUPERSET_PORT. The [MCP server 
command](https://github.com/apache/superset-kubernetes-operator/blob/da4e569fa86d70b9c
 6c28f6bc8dcdf593b8eadde/internal/controller/component_resources.go#L172) has 
port 8088 written into it. So the process keeps listening on 8088 while the 
[probes](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/)
 and the Service target the new port. The pods restart in a loop, and the 
lifecycle stays in Restoring because it waits for the web server to become 
ready. This PR makes both servers listen on the resolved container port.
   
   ## Details
   
   - Web server: the operator sets SUPERSET_PORT when the resolved container 
port is not 8088. This is the same port that already drives 
SUPERSET_WEBSERVER_PORT in superset_config.py, the Service targetPort, and the 
probes.
   - MCP server: the default command now builds its port argument from the 
resolved container port.
   - With the default port nothing changes. No env var is added and the MCP 
command is the same, so existing Deployments do not roll on upgrade.
   - A command override on either component still replaces the default command, 
as before.
   - Unit test: TestReconcile_ContainerPortReachesServerBind covers the default 
and the override case for both components. It fails on main.
   - e2e: the journey test now overrides both ports and checks SUPERSET_PORT on 
the web server Deployment and the port in the MCP command.
   - Docs: the ports row in the configuration guide now says the first port 
also sets the listen port of the web and MCP servers.
   
   Verification: make lint-go (0 issues), make lint-md, make test-unit and make 
test-integration (all packages pass), go vet with the integration tag, a Kind 
reproduction with a real Superset 6.1.0-dev image, and the e2e suite on Kind 
against main and against this branch.
   
   <details>
   <summary>Kind reproduction with Superset 6.1.0-dev</summary>
   
   Setup: Kind cluster, the PostgreSQL and Valkey from 
config/samples/dev-dependencies.yaml, and this Superset resource:
   
   ```yaml
   spec:
     image:
       tag: 6.1.0-dev
     environment: Development
     webServer:
       podTemplate:
         container:
           ports:
             - name: http
               containerPort: 9090
     mcpServer:
       podTemplate:
         container:
           ports:
             - name: mcp
               containerPort: 9191
   ```
   
   Before the fix (operator built from main)
   
   Web server: gunicorn listens on 8088 and the startup probe on 9090 fails.
   
   ```
   [INFO] Listening at: http://0.0.0.0:8088 (14)
   Startup probe failed: Get "http://10.244.0.9:9090/health": dial tcp 
10.244.0.9:9090: connect: connection refused
   Container superset failed startup probe, will be restarted
   ```
   
   MCP server: the command keeps port 8088 and the liveness probe on 9191 fails.
   
   ```
   ["superset","mcp","run","--host","0.0.0.0","--port","8088"]
   Uvicorn running on http://0.0.0.0:8088 (Press CTRL+C to quit)
   Liveness probe failed: dial tcp 10.244.0.10:9191: connect: connection refused
   ```
   
   ```
   NAME                                     READY   STATUS             RESTARTS
   port-repro-mcp-server-796c568f7b-svm8d   0/1     CrashLoopBackOff   9
   port-repro-web-server-78c56cd658-c9jkp   0/1     Running            9
   ```
   
   Lifecycle phase: Restoring.
   
   After the fix (operator built from this branch, same cluster and resource)
   
   ```
   {"name":"SUPERSET_PORT","value":"9090"}
   [INFO] Listening at: http://0.0.0.0:9090 (14)
   
   ["superset","mcp","run","--host","0.0.0.0","--port","9191"]
   Uvicorn running on http://0.0.0.0:9191 (Press CTRL+C to quit)
   
   port-repro-web-server port=8088 targetPort=9090
   port-repro-mcp-server port=8088 targetPort=9191
   web /health via Service: 200
   ```
   
   ```
   NAME                                     READY   STATUS    RESTARTS
   port-repro-mcp-server-6bdcbdf9dd-h5qlm   1/1     Running   0
   port-repro-web-server-7f45b5454-nfxhj    1/1     Running   0
   ```
   
   Lifecycle phase: Complete.
   
   </details>
   
   <details>
   <summary>e2e result</summary>
   
   Before the fix (operator built from main, same e2e test): the new step times 
out because the web server Deployment gets no SUPERSET_PORT.
   
   ```
   [FAILED] Timed out after 60.024s.
   Expected
       <string>:
   to equal
       <string>: 9090
   FAIL! -- 15 Passed | 1 Failed | 0 Pending | 2 Skipped
   ```
   
   After the fix:
   
   ```
   Ran 18 of 18 Specs in 153.164 seconds
   SUCCESS! -- 18 Passed | 0 Failed | 0 Pending | 0 Skipped
   ok   github.com/apache/superset-kubernetes-operator/test/e2e 153.705s
   ```
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to