@@ -198,6 +198,63 @@ async fn dump_materialize_diagnostics(kubeconfig: &Path, namespace: &str, name:
198198 & [ "describe" , "pods" , "-n" , namespace] ,
199199 )
200200 . await ;
201+ run_section (
202+ "kubectl get networkpolicy (all namespaces)" ,
203+ kubeconfig,
204+ & [ "get" , "networkpolicy" , "-A" , "-o" , "yaml" ] ,
205+ )
206+ . await ;
207+ run_section (
208+ "kubectl get svc,endpoints (instance namespace)" ,
209+ kubeconfig,
210+ & [ "get" , "svc,endpoints" , "-n" , namespace, "-o" , "wide" ] ,
211+ )
212+ . await ;
213+
214+ // Probe environmentd:6876 from a pod scheduled into the operator namespace.
215+ // That pod inherits the same egress NetworkPolicies as the orchestratord, so
216+ // the curl exit / verbose output disambiguates the failure mode (timeout =>
217+ // NetworkPolicy or SG drop; refused => no listener; TLS error => cert
218+ // mismatch). Best-effort; if anything in the probe fails we just log and
219+ // move on.
220+ if let Ok ( resource_id) = run_cmd_output ( kubectl ( kubeconfig) . args ( [
221+ "get" ,
222+ & format ! ( "materialize/{name}" ) ,
223+ "-n" ,
224+ namespace,
225+ "-o" ,
226+ "jsonpath={.status.resourceId}" ,
227+ ] ) )
228+ . await
229+ && !resource_id. is_empty ( )
230+ {
231+ let target = format ! (
232+ "https://mz{resource_id}-environmentd-1.{namespace}.svc.cluster.local:6876/api/login"
233+ ) ;
234+ let probe_name = format ! ( "verify-probe-{resource_id}" ) ;
235+ println ! ( "\n >>> curl probe from operator namespace -> {target}" ) ;
236+ if let Err ( e) = run_cmd ( kubectl ( kubeconfig) . args ( [
237+ "run" ,
238+ & probe_name,
239+ "--rm" ,
240+ "--restart=Never" ,
241+ "-i" ,
242+ "--image=curlimages/curl:latest" ,
243+ "--namespace=materialize" ,
244+ "--command" ,
245+ "--" ,
246+ "curl" ,
247+ "-v" ,
248+ "-k" ,
249+ "--max-time" ,
250+ "15" ,
251+ & target,
252+ ] ) )
253+ . await
254+ {
255+ println ! ( "(probe failed: {e:#})" ) ;
256+ }
257+ }
201258
202259 println ! ( "\n --- end diagnostics ---" ) ;
203260}
0 commit comments