[Draft]: CSPL-3432:Add cert-manager Integration to Splunk Operator for Automatic TLS Certificate Management #1460
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request introduces cert-manager integration into the Splunk Operator, enabling automated TLS certificate provisioning and renewal for Splunk Pods. The changes allow users to specify whether they want to use:
csi.cert-manager.iodriver.By setting certain annotations on the Splunk Custom Resource (CR), operators can choose the appropriate method for their environment. The Splunk Operator then modifies the final Pod spec accordingly—injecting the cert-manager CSI volume or sidecar references.
Key Changes
Annotation-Based Approach
splunk.com/cert-managerthat can be set to either:"csi"– Use the cert-manager CSI driver to mount certificates."injector"(or"sidecar") – Use a sidecar container approach (or an external sidecar injector webhook).New Helper Functions
addCertManagerCsiVolume(...):csi.cert-manager.iodriver.readOnly: trueis set (required by cert-manager CSI).splunk.com/cert-secret-name,splunk.com/cert-issuer-name, etc. to populatevolumeAttributes(e.g.csi.cert-manager.io/secret-name,csi.cert-manager.io/issuer-name, etc.).VolumeMountfor/mnt/splunk/certificates(or any configured path) within the Splunk container.addCertManagerSidecarInjector(...)(oraddCertManagerSidecar(...)if manual injection):inotifywait) and triggers Splunk to reload on changes.Pod Template Updates
updateSplunkPodTemplateWithConfig(...), the Operator checks ifsplunk.com/cert-manageris set.Support for Key Reuse
reuse-private-key: "true"is detected, the Operator expectssecret-nameto be specified so the private key can be stored in a persistent Secret.Better Error Handling and Debug
issuerName,secretName) appear in the final Pod spec.How to Use
selfsigned-issuerorletsencrypt-prod.Testing
issuerName,secretName, andreadOnly: trueare correctly included in the generated Pod spec.splunk.com/cert-manager: "csi"successfully mounts a certificate fromcsi.cert-manager.ioand that reloading logic handles certificate updates.Additional Notes
/mnt/splunk/certificates(or their chosen mount path).