Description
When looking at how IMC is configured, the current helm chart creates a configMap
object which has the following default values:
providers:
- name: UptimeRobot
apiKey: your-api-key
apiURL: https://google.com
alertContacts: some-alert-contacts
enableMonitorDeletion: true
monitorNameTemplate: "{{.Namespace}}-{{.IngressName}}"
# how often (in seconds) monitors should be synced to their Kubernetes resources (0 = disabled)
resyncPeriod: 0
# creationDelay is a duration string to add a delay before creating new monitor (e.g., to allow DNS to catch up first)
# https://golang.org/pkg/time/#ParseDuration
creationDelay: 0
Sourced from the data
attribute in values.yaml
which has the following default:
data:
config.yaml: |-
providers:
- name: UptimeRobot
apiKey: your-api-key
apiURL: https://google.com
alertContacts: some-alert-contacts
enableMonitorDeletion: true
monitorNameTemplate: "{{.Namespace}}-{{.IngressName}}"
# how often (in seconds) monitors should be synced to their Kubernetes resources (0 = disabled)
resyncPeriod: 0
# creationDelay is a duration string to add a delay before creating new monitor (e.g., to allow DNS to catch up first)
# https://golang.org/pkg/time/#ParseDuration
creationDelay: 0
This is not friendly to configure at all with an external values.yaml
file to define how you would like your installation of IMC to take place for a few reasons:
- Unless you support (or will support) multiple uptime checkers, setting the
providers
object (instead of the singularprovider
) inflicts unnecessary looping and configuration depth - The fact that the defaults are not generated from other elements contained in the chart is a tremendous oversight.
I would expect the values.yaml file to look something like this:
<THE REST OF THE VALUES FILE FROM /kubernetes/templates/chart/values.yaml.tmpl>
configFilePath: /etc/IngressMonitorController/config.yaml
provider:
name: UptimeRobot
apiKey: your-api-key
apiURL: https://google.com
alertContacts:
# For if you do not want to support "grouped" contacts
- [email protected]
- [email protected]
# For if you DO want to support "grouped" contacts
- groupName: Squad A
contacts:
- [email protected]
- [email protected]
# I am assuming here that the properties of resync period, creation delay, and monitor deletion SHOULD be configurable for each provider if you allow multiples.
enableMonitorDeletion: true
resyncPeriod: 0
creationDelay: 0
Then, instead of just writing out data.yaml
with some default presented in the values file, you read from this provider
attribute in a configMap or secret template in the actual Chart.
If you do it like this, it makes it monumentally easier for others to just specify the pieces of their values.yaml
files that they need to customize rather than having to struggle with in-line yaml string formatting in their values files (especially when fed through CLI).
Activity