kube-linter icon indicating copy to clipboard operation
kube-linter copied to clipboard

[FEATURE_REQUEST] validate that probe port match a existing port

Open jouve opened this issue 3 years ago • 0 comments

Description of the problem/feature request

when defining probes (liveness, readiness, startup) , the port can be specified as either an int or a string. In that case, the string must match the name of a port defined in ports.

I suggest a check to validate that when the probe port is a string, it matches one the port by name.

Additional context

in case of mismatch, the yaml is accepted by the kubernetes, but the probe will fail latter : Liveness probe errored: strconv.Atoi: parsing "xxx": invalid syntax

would be ok:

containers:
- ports:
  - containerPort: 1234
    name: probe
  livenessProbe:
    httpGet:
      port: probe

would be an error:

containers:
- ports:
  - containerPort: 1234
    name: probe
  livenessProbe:
    httpGet:
      port: foo

jouve avatar Nov 25 '22 15:11 jouve