Fix master key secret creation for ServiceMonitor compatibility#329
Fix master key secret creation for ServiceMonitor compatibility#329barskern wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThis PR updates the Meilisearch Helm template to broaden when and how the master key Kubernetes Secret is created. The rendering condition now includes cases where a master key is explicitly provided via environment values, and the data population logic prioritizes configured values over random generation. ChangesMaster Key Secret Template Logic
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@charts/meilisearch/templates/master-key-secret.yaml`:
- Around line 12-13: The Secret data value for MEILI_MASTER_KEY is not
base64-encoded; update the template in master-key-secret.yaml so the branch that
uses .Values.environment.MEILI_MASTER_KEY encodes it with the b64enc Helm
function (same approach as the random fallback that already uses "| b64enc"),
i.e., apply b64enc to .Values.environment.MEILI_MASTER_KEY in the
MEILI_MASTER_KEY data entry so Kubernetes receives valid base64 data.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bfbe1f0d-e3ea-4eb2-a287-cdd0f61b37bb
📒 Files selected for processing (1)
charts/meilisearch/templates/master-key-secret.yaml
The service monitor *REQUIRES* the kubernetes secret to be present to be able to query for the metrics, i.e. we should make the secret also when the `MEILI_MASTER_KEY` is used to pass the main secret.
92c937c to
cb2901e
Compare
Pull Request
Related issue
Fixes failing ServiceMonitor when
MEILI_MASTER_KEYis specified as the main secret.What does this PR do?
The service monitor REQUIRES the kubernetes secret to be present to be able to query for the metrics, i.e. we should make the secret also when the
MEILI_MASTER_KEYis used to pass the main secret.PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Fixed failing ServiceMonitor when MEILI_MASTER_KEY is provided via environment variables
This PR fixes a bug where the ServiceMonitor fails when the
MEILI_MASTER_KEYis supplied through environment variables rather than an existing Kubernetes Secret. The ServiceMonitor requires a Kubernetes Secret to be present to query metrics, but the secret was not being created in this scenario.Changes
charts/meilisearch/templates/master-key-secret.yaml
The Secret creation condition has been extended to account for environment-supplied master keys:
isProductionWithoutMasterKeyis true, but also when.Values.environment.MEILI_MASTER_KEYis set and.Values.auth.existingMasterKeySecretis not providedelse ifbranch (line 12) to populate the Secret data with the value from.Values.environment.MEILI_MASTER_KEYbefore falling back to generating a random keyThis ensures that the master key Secret is created whenever the ServiceMonitor needs it, allowing the ServiceMonitor to successfully authenticate and query metrics in all deployment configurations.