Skip to content

probe validation errors get the wrong path when more than one handler is set #16817

Todo

Description

@Itx-Psycho0

/kind bug
/area API

What version of Knative?

main (b35495e)

Expected Behavior

if a probe has more than one handler and one of them is invalid, the error for that handler should point at that handler, e.g. spec.template.spec.containers[0].readinessProbe.httpGet.port

Actual Behavior

the path gets the other handler names glued on in front. with httpGet on a wrong port name + tcpSocket:

expected exactly one, got both: spec.template.spec.containers[0].readinessProbe.httpGet, spec.template.spec.containers[0].readinessProbe.tcpSocket
invalid value: wrong: spec.template.spec.containers[0].readinessProbe.tcpSocket.httpGet.port
Probe port must match container port

and if exec and grpc are set too it turns into readinessProbe.grpc.exec.httpGet.port

the cause is in validateProbe in pkg/apis/serving/k8s_validation.go, the ViaField("httpGet"), ViaField("tcpSocket"), ViaField("exec") and ViaField("grpc") are called on the result of errs.Also(...) so they get applied to every error collected so far, not just that handler's errors. same thing as #16790 but for probes

small extra thing in the same function: the "got both" error calls the grpc handler gRPC while the field is grpc (and the "got neither" error right below already says grpc)

Steps to Reproduce the Problem

  1. create a Service with a readiness probe that has httpGet with port: wrong and also tcpSocket: {}
  2. look at the error path above

found it while reading the code, reproduced with Service.Validate in a unit test, not on a cluster

Activity

  1. added
    kind/bug
    on Nov 25, 2026
  2. added
    area/API
    on Nov 25, 2026
  3. Itx-Psycho0 commented on Nov 25, 2026

    @Itx-Psycho0
    Author

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/APIkind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions