config/sysinv/sysinv/sysinv/sysinv/cert_alarm
Sabeel Ansari 5c42dde784 Cert-Alarm token caching + other
Cert-alarm used to request new token for each file. This used to
result in token requests of 3-5 calls per execution. Incorporating
token caching from cert-mon service to reduce the number of requests.

Other changes include:
- Log level change in case of exceptions thrown from FM API. A
  condition where exception is thrown should not just log it at
  a warning level (so that it's not missed), but should have
  a more detailed/traceable log.
- Logic fix for raising alarm at right level. It was noticed that
  alarm was tagged as expired on the day before expiry. This changes
  to wait until the date has actually passed before the certificate
  is marked as expired.
- Safer call to use dict.get() in case of missing annotations of
  cert-manager Certificate resources.

Test Plan:
PASS: Verify that token caching reduces the number of calls
PASS: Verify that an exception thrown from FM API gets a more
      detailed log
PASS: Verify to make sure certificate expiry alarm waits
      until expiry date is passed before 'Expired' alarm is
      raised.
PASS: Verify that if Certificate CRD does not contain
      metadata.annotations, cert-alarm will handle the condition
      and create the annotations without error.

Story: 2008946
Task: 42852

Signed-off-by: Sabeel Ansari <Sabeel.Ansari@windriver.com>
Change-Id: Icfedfdadd43757c1375459e7ee4b4d3d97e8d02f
2021-10-13 16:36:15 -04:00
..
__init__.py Add cert-alarm service 2021-07-22 08:29:23 -04:00
audit.py Cert-Alarm token caching + other 2021-10-13 16:36:15 -04:00
certificate_alarm_manager.py Cert-Alarm audit 2021-09-24 11:44:40 -04:00
fm.py Cert-Alarm token caching + other 2021-10-13 16:36:15 -04:00
service.py Cert Alarm service 2021-08-23 16:37:19 -04:00
utils.py Cert-Alarm token caching + other 2021-10-13 16:36:15 -04:00