So I've got the k8s plugin installed and I'm so excited to see cert-manager already included. I'm hoping to automate my letsencrypt setup and with a few yamls like ClusterIssuer and so on, I've got a secret populated with my own certificate via ACME. (So far nothing specific to OMV or k3s.)
However, I'm at a loss on how to configure Traefik to use my own secret (say my-cert-secret) instead of the builtin (selfsigned) default-tls-cert. Here's my thought process and lmk if I'm missing anything obvious.
Ideas / workarounds
First thing that came to mind is to use the certificate setting offered by OMV /#/services/k8s/settings . However, it reads from OMV config values, not a k8s secret. So I guess one way to do it is to add a Pod, mount my-cert-secret, mount a host file system directory, add a Bash script to write that secret into a file on OMV host, and then somehow run the update_cert script as root on host (with k3s added in deploy commands). And I'll also need some logic to detect that the secret has changed or a cron job. That seems to defeat the purpose of k8s and doesn't seem very config-driven. I may as well just do certbot on OMV host.
The second idea is to update the Traefik TLSStore to point to my-cert-secret in addition / instead of default-tls-cert. According to Traefik, I need to update the one named default but I quickly found out that it is part of a "Auto-Deploying Manifest" managed by k3s, generated by OMV. This means if I were to make my own modifications, it will be lost on restart / file change. While I can definitely override the SALT stack or add a .skip file, I'd be stuck maintaining my own version of /var/lib/rancher/k3s/server/manifests/openmediavault-traefik.yaml, which contains more than just the TLSStore itself. (A similar idea is to overwrite the builtin Certificate resource and point it to my own issuerRef. But the containing file has even more things such as the cert-manager Helm Chart installation.)
Suggestions
I understand that the plugin announcement says "Users who want to customize their Kubernetes environment are not the target of this plugin", but does it really require so much customization to run ACME within k8s itself, or am I on the wrong path? If this use case is worth supporting, I'd suggest some changes to OMV to unblock it, in the order of increasing complexity:
1. Expose an env var override for issuerRef.name, defined here. Say call it OMV_K8S_DEFAULT_TLS_CERT_ISSUER, or
2. Put the TLSStore or Certificate in a separate YAML file and give it an explicit name, so users can skip / SALT-override it as needed, or
3. Expose an env var to add more certificate secretNames to TLSStore, similar to how OMV_K8S_TRAEFIK_PORTS adds more ports, or
4. Fully-fledged LetsEncrypt (ACME) support, maybe as a recipe (fwiw, I see commented-out code for letsencrypt, so maybe it's on the roadmap)
I think any of the above will solve the use case but I'm not sure which ones aligns the most with the OMV project goal. #4 may be appealing but it involves configuring DNS-provider-specific settings, cert-manager plugins / webhooks, and username / passwords. I'll leave it for the project maintainers to decide but if anyone's open to starting small, I'm happy to contribute PRs for #1 or #2.