joe-elliott / cert-exporter

A Prometheus exporter that publishes cert expirations on disk and in Kubernetes secrets
Apache License 2.0
320 stars 87 forks source link

Add DaemonSet support #95

Closed jedrivisser closed 3 years ago

jedrivisser commented 3 years ago

A bit of a more invasive PR, so might need to work or end up rejected if it doesn't fit the idea you had, but it work on my projects

I basically added a kind value that switches between a DaemonSet and Deployment so I do not have to duplicate everything for a DaemonSet (kind of like ingress-nginx does), unfortunately that means i had to rename some values, which makes the values not backwards compatible.

I updated the labels to use cert-exporter.io/type: {{ kebabcase .Values.certManager.kind }} so I do not need separate sets for a DaemonSet and Deployment

Added a check to assert that the kind value is correct (certManager.assertValidKind)

The templated values before and after these changes still look the same:

diff cert-values-old.yaml cert-values-new.yaml
21d20
<
23d21
<
663c661
< # Source: cert-exporter/templates/deployment/service.yaml
---
> # Source: cert-exporter/templates/cert-manager/service.yaml
669d666
<
688c685
< # Source: cert-exporter/templates/deployment/deployment.yaml
---
> # Source: cert-exporter/templates/cert-manager/cert-manager.yaml