ingress-nginx-helm/internal/ingress/controller
Thibault Jamet 1e66a54974
Add a certificate info metric (#8253)
When the ingress controller loads certificates  (new ones or following a
secret update), it performs a series of check to ensure its validity.

In our systems, we detected a case where, when the secret object is
compromised, for example when the certificate does not match the secret
key, different pods of the ingress controller are serving a different
version of the certificate.

This behaviour is due to the cache mechanism of the ingress controller,
keeping the last known certificate in case of corruption. When this
happens, old ingress-controller pods will keep serving the old one,
while new pods, by failing to load the corrupted certificates, would
use the default certificate, causing invalid certificates for its
clients.

This generates a random error on the client side, depending on the
actual pod instance it reaches.

In order to allow detecting occurences of those situations, add a metric
to expose, for all ingress controlller pods, detailed informations of
the currently loaded certificate.

This will, for example, allow setting an alert when there is a
certificate discrepency across all ingress controller pods using a query
similar to `sum(nginx_ingress_controller_ssl_certificate_info{host="name.tld"})by(serial_number)`

This also allows to catch other exceptions loading certificates (failing
to load the certificate from the k8s API, ...

Co-authored-by: Daniel Ricart <danielricart@users.noreply.github.com>

Co-authored-by: Daniel Ricart <danielricart@users.noreply.github.com>
2022-02-24 07:08:32 -08:00
..
config Add stream-snippet as a ConfigMap and Annotation option (#8029) 2021-12-23 11:46:30 -08:00
ingressclass Print warning only instead of error if no permission on ingressclass (#7578) 2021-10-10 12:48:37 -07:00
process Migrate to klog v2 2020-08-08 21:01:03 -04:00
store Do not validate ingresses with unknown ingress class in admission webhook endpoint. (#8221) 2022-02-06 12:28:51 -08:00
template Remove deprecated libraries, update other libs, add ci v1.23 (#8118) 2022-01-09 16:29:12 -08:00
certificate.go Fix verification of boilerplate, style and file headers 2017-12-03 13:58:23 -03:00
checker.go Remove deprecated libraries, update other libs, add ci v1.23 (#8118) 2022-01-09 16:29:12 -08:00
checker_test.go fix: use exponential backoff mechanism to listen on nginx.StatusPort 2021-05-13 15:02:11 +08:00
controller.go Add a certificate info metric (#8253) 2022-02-24 07:08:32 -08:00
controller_test.go Do not validate ingresses with unknown ingress class in admission webhook endpoint. (#8221) 2022-02-06 12:28:51 -08:00
endpoints.go getEndpoints uses service target port directly if it's a number and mismatch with port name in endpoint (#7393) 2021-09-07 11:15:16 -07:00
endpoints_test.go getEndpoints uses service target port directly if it's a number and mismatch with port name in endpoint (#7393) 2021-09-07 11:15:16 -07:00
location.go Release v1 (#7470) 2021-08-21 13:42:00 -07:00
nginx.go Add a certificate info metric (#8253) 2022-02-24 07:08:32 -08:00
nginx_test.go Update go version, modules and remove ioutil 2021-08-06 14:15:21 -03:00
status.go Refactor extraction of ingress pod details 2020-11-19 17:31:28 -03:00
tcp.go Release v1 (#7470) 2021-08-21 13:42:00 -07:00
util.go Release v1 (#7470) 2021-08-21 13:42:00 -07:00
util_test.go rename sysctlFSFileMax to rlimitMaxNumFiles to reflect what it actually does 2019-01-15 15:34:17 -05:00