Skip to content

fix(kibana): align template standards#679

Open
mberlofa wants to merge 3 commits into
mainfrom
fix/kibana-template-standards
Open

fix(kibana): align template standards#679
mberlofa wants to merge 3 commits into
mainfrom
fix/kibana-template-standards

Conversation

@mberlofa

@mberlofa mberlofa commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep the Helm test hook under templates/tests/ so helm test renders and executes it, with explicit unittest coverage for the hook pod.
  • Add networkPolicy.extraEgress and keep NOTES sections numbered.
  • Make the default install self-contained with bundled HelmForge Elasticsearch so k3d/default installs are functional.
  • Make Kibana CI values k3d-safe with short bundled Elasticsearch names and IPv4-compatible dual-stack validation.
  • Disable the embedded Elastic APM agent by default to avoid noisy startup APM output and keep runtime logs clean.
  • Guard the wait init container so secured external Elasticsearch does not render an unauthenticated busybox probe.

Related

Validation

  • helm template test charts/kibana | rg -n "helm.sh/hook|test-connection" (hook rendered from templates/tests/test-connection.yaml)
  • helm unittest charts/kibana (28 tests, 3 suites)
  • make template-standards-check CHART=kibana
  • node scripts/charts/validate-chart.js --chart kibana --no-k3d
  • make validate-chart CHART=kibana TIMEOUT=1200 (FULLY VALIDATED, 22 layers)
  • make site-sync-check CHART=kibana passed with required site updates present
  • make release-check REPO=charts passed with expected GR-077 release warning
  • make attribution-check REPO=charts passed

Summary by CodeRabbit

  • New Features

    • Kibana now defaults to embedded (bundled) Elasticsearch.
    • Added support for networkPolicy.egress.extraEgress to append additional egress rules.
  • Bug Fixes

    • Improved bundled vs. external Elasticsearch behavior with stricter validation for incompatible auth/TLS settings.
    • Updated the “wait for Elasticsearch” init-container rendering to follow the active Elasticsearch mode.
  • Documentation

    • Refreshed Elasticsearch guidance, production notes, and examples to reflect bundled-first defaults and external cluster setup.
  • Tests

    • Expanded rendering, routing, and validation test coverage for bundled vs. external scenarios.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Standards Check (GR-079) — PASS

Every changed chart fully passes standards-check.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 37e59550-ebd4-42b6-9cf7-9faffcc9d7a2

📥 Commits

Reviewing files that changed from the base of the PR and between c722948 and 3e0d8e8.

📒 Files selected for processing (25)
  • charts/kibana/README.md
  • charts/kibana/ci/bundled-elasticsearch-values.yaml
  • charts/kibana/ci/default-values.yaml
  • charts/kibana/ci/dual-stack-values.yaml
  • charts/kibana/ci/external-secrets-values.yaml
  • charts/kibana/ci/gateway-api-values.yaml
  • charts/kibana/ci/ingress-values.yaml
  • charts/kibana/ci/k3d-values.yaml
  • charts/kibana/ci/network-policy-values.yaml
  • charts/kibana/ci/persistence-values.yaml
  • charts/kibana/ci/security-values.yaml
  • charts/kibana/ci/servicemonitor-values.yaml
  • charts/kibana/ci/wolfi-values.yaml
  • charts/kibana/docs/elasticsearch.md
  • charts/kibana/examples/bundled-elasticsearch.yaml
  • charts/kibana/examples/production.yaml
  • charts/kibana/templates/NOTES.txt
  • charts/kibana/templates/_helpers.tpl
  • charts/kibana/templates/deployment.yaml
  • charts/kibana/templates/networkpolicy.yaml
  • charts/kibana/tests/config_test.yaml
  • charts/kibana/tests/deployment_test.yaml
  • charts/kibana/tests/routing_test.yaml
  • charts/kibana/values.schema.json
  • charts/kibana/values.yaml
💤 Files with no reviewable changes (1)
  • charts/kibana/examples/bundled-elasticsearch.yaml
✅ Files skipped from review due to trivial changes (5)
  • charts/kibana/ci/persistence-values.yaml
  • charts/kibana/ci/servicemonitor-values.yaml
  • charts/kibana/examples/production.yaml
  • charts/kibana/ci/bundled-elasticsearch-values.yaml
  • charts/kibana/docs/elasticsearch.md
🚧 Files skipped from review as they are similar to previous changes (18)
  • charts/kibana/ci/gateway-api-values.yaml
  • charts/kibana/ci/security-values.yaml
  • charts/kibana/ci/k3d-values.yaml
  • charts/kibana/ci/default-values.yaml
  • charts/kibana/ci/dual-stack-values.yaml
  • charts/kibana/templates/deployment.yaml
  • charts/kibana/ci/ingress-values.yaml
  • charts/kibana/templates/networkpolicy.yaml
  • charts/kibana/tests/routing_test.yaml
  • charts/kibana/ci/wolfi-values.yaml
  • charts/kibana/ci/network-policy-values.yaml
  • charts/kibana/README.md
  • charts/kibana/templates/_helpers.tpl
  • charts/kibana/templates/NOTES.txt
  • charts/kibana/tests/config_test.yaml
  • charts/kibana/values.schema.json
  • charts/kibana/values.yaml
  • charts/kibana/tests/deployment_test.yaml

📝 Walkthrough

Walkthrough

The Kibana chart now defaults to bundled Elasticsearch, updates bundled and external Elasticsearch documentation and examples, aligns CI and tests with the new wiring, and adds optional networkPolicy.extraEgress rendering with schema and test coverage.

Changes

Bundled Elasticsearch default and validation

Layer / File(s) Summary
Defaults and validation
charts/kibana/values.yaml, charts/kibana/templates/_helpers.tpl, charts/kibana/templates/deployment.yaml
bundledElasticsearch.enabled and waitForElasticsearch.enabled default to true, helper logic gates the Elasticsearch wait init container, and bundled-mode validation rejects incompatible auth or TLS settings.
Docs and NOTES output
charts/kibana/README.md, charts/kibana/docs/elasticsearch.md, charts/kibana/examples/*.yaml, charts/kibana/templates/NOTES.txt
README, Elasticsearch docs, examples, and NOTES output switch to bundled-first guidance and external Elasticsearch setup details.
CI values wiring
charts/kibana/ci/*.yaml
CI values files replace external Elasticsearch blocks with bundled Elasticsearch overrides and update related secret references and service settings.
Bundled and external mode tests
charts/kibana/tests/config_test.yaml, charts/kibana/tests/deployment_test.yaml, charts/kibana/tests/routing_test.yaml
Tests cover bundled defaults, external opt-out, wait-for behavior, validation failures, and hook rendering.

Network policy extra egress support

Layer / File(s) Summary
extraEgress schema and rendering
charts/kibana/values.schema.json, charts/kibana/values.yaml, charts/kibana/templates/networkpolicy.yaml, charts/kibana/tests/routing_test.yaml
networkPolicy.extraEgress is added to the schema and defaults, rendered into NetworkPolicy egress, and verified in routing tests.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • helmforgedev/charts#641: Adds the same networkPolicy.egress.extraEgress rendering path and related validation/test coverage.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to the Kibana chart changes but too vague to identify the main update clearly. Use a more specific title, e.g. mention bundled Elasticsearch, NOTES formatting, and networkPolicy extraEgress changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/kibana-template-standards

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🟢 Security Scan: kibana

Framework Score
MITRE + NSA + SOC2 89.090904%

✅ Security posture acceptable.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review


P2 Badge Keep Helm test hooks under templates

This hook was moved to the chart-root tests/ directory, but Helm does not render hook manifests from there; I verified with helm install --dry-run=client that a chart with only tests/root-test.yaml reports TEST SUITE: None. In this repository tests/ is used by helm-unittest suites, so packaging this Pod here leaves helm test with no rendered test hook despite the README still instructing users to run it.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread charts/kibana/values.yaml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
charts/kibana/values.yaml (1)

146-148: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

extraEnv default is now a non-empty array — full-replace footgun.

Helm list values fully replace rather than merge. Any user who sets their own extraEnv (e.g., to add proxy vars) will silently drop ELASTIC_APM_ACTIVE: "false", undoing the intended default of suppressing APM startup noise, with no warning.

Consider either documenting this override caveat inline, or rendering this env var unconditionally from a dedicated boolean (e.g., apm.enabled: false) merged in the deployment template so it survives extraEnv overrides.

💡 Minimal mitigation: warn in the comment
+# -- NOTE: Setting your own `extraEnv` replaces this list entirely (Helm lists
+# do not merge). Re-add `ELASTIC_APM_ACTIVE: "false"` if you override this value.
 extraEnv:
   - name: ELASTIC_APM_ACTIVE
     value: "false"
🤖 Prompt for 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.

In `@charts/kibana/values.yaml` around lines 146 - 148, The default extraEnv entry
for ELASTIC_APM_ACTIVE is a list value that gets fully replaced by user
overrides, so the suppression setting can be lost when consumers set their own
extraEnv. Update the Kibana values/template around extraEnv to avoid this
footgun: either document inline that extraEnv is a full-replace override and
users must re-add ELASTIC_APM_ACTIVE, or move this setting to a dedicated
boolean-driven render path in the deployment template so the ELASTIC_APM_ACTIVE
env var is always emitted independently of extraEnv.
charts/kibana/ci/external-secrets-values.yaml (1)

12-23: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

All three encryption-key remoteRefs now resolve to the same fake value.

xpack-security-encryption-key, xpack-reporting-encryption-key, and xpack-encrypted-saved-objects-encryption-key all reference key: test/password, so any accidental swap between secretKey targets would go undetected by this CI scenario since the resulting values are identical either way.

🤖 Prompt for 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.

In `@charts/kibana/ci/external-secrets-values.yaml` around lines 12 - 23, The
three encryption-key entries in the external-secrets values are all mapped to
the same remoteRef value, which makes secretKey swaps impossible to detect in
CI. Update the data entries in the helmforge-fake-store configuration so
xpack-security-encryption-key, xpack-reporting-encryption-key, and
xpack-encrypted-saved-objects-encryption-key each resolve to distinct fake
remoteRef keys, keeping the same structure but using unique values to validate
the wiring.
🤖 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/kibana/ci/security-values.yaml`:
- Around line 2-3: The Kibana CI values no longer cover the secured
external-Elasticsearch path, since only bundled mode remains in the CI configs.
Update the CI values setup by restoring one scenario that uses the external
Elasticsearch flow with hosts, tls, and auth settings, and keep it separate from
the bundled-elasticsearch case. Use the existing CI values files, especially
external-secrets-values and the bundled-elasticsearch override, to reintroduce
the real secured external cluster coverage.

---

Nitpick comments:
In `@charts/kibana/ci/external-secrets-values.yaml`:
- Around line 12-23: The three encryption-key entries in the external-secrets
values are all mapped to the same remoteRef value, which makes secretKey swaps
impossible to detect in CI. Update the data entries in the helmforge-fake-store
configuration so xpack-security-encryption-key, xpack-reporting-encryption-key,
and xpack-encrypted-saved-objects-encryption-key each resolve to distinct fake
remoteRef keys, keeping the same structure but using unique values to validate
the wiring.

In `@charts/kibana/values.yaml`:
- Around line 146-148: The default extraEnv entry for ELASTIC_APM_ACTIVE is a
list value that gets fully replaced by user overrides, so the suppression
setting can be lost when consumers set their own extraEnv. Update the Kibana
values/template around extraEnv to avoid this footgun: either document inline
that extraEnv is a full-replace override and users must re-add
ELASTIC_APM_ACTIVE, or move this setting to a dedicated boolean-driven render
path in the deployment template so the ELASTIC_APM_ACTIVE env var is always
emitted independently of extraEnv.
🪄 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 Plus

Run ID: 91ea2d57-6818-4c85-8f59-504d4163527d

📥 Commits

Reviewing files that changed from the base of the PR and between 47bc2fc and c144961.

📒 Files selected for processing (25)
  • charts/kibana/README.md
  • charts/kibana/ci/bundled-elasticsearch-values.yaml
  • charts/kibana/ci/default-values.yaml
  • charts/kibana/ci/dual-stack-values.yaml
  • charts/kibana/ci/external-secrets-values.yaml
  • charts/kibana/ci/gateway-api-values.yaml
  • charts/kibana/ci/ingress-values.yaml
  • charts/kibana/ci/k3d-values.yaml
  • charts/kibana/ci/network-policy-values.yaml
  • charts/kibana/ci/persistence-values.yaml
  • charts/kibana/ci/security-values.yaml
  • charts/kibana/ci/servicemonitor-values.yaml
  • charts/kibana/ci/wolfi-values.yaml
  • charts/kibana/docs/elasticsearch.md
  • charts/kibana/examples/bundled-elasticsearch.yaml
  • charts/kibana/examples/production.yaml
  • charts/kibana/templates/NOTES.txt
  • charts/kibana/templates/_helpers.tpl
  • charts/kibana/templates/networkpolicy.yaml
  • charts/kibana/tests/config_test.yaml
  • charts/kibana/tests/deployment_test.yaml
  • charts/kibana/tests/routing_test.yaml
  • charts/kibana/tests/test-connection.yaml
  • charts/kibana/values.schema.json
  • charts/kibana/values.yaml
💤 Files with no reviewable changes (1)
  • charts/kibana/examples/bundled-elasticsearch.yaml

Comment thread charts/kibana/ci/security-values.yaml
@mberlofa mberlofa force-pushed the fix/kibana-template-standards branch from c722948 to 3e0d8e8 Compare July 5, 2026 12:36
@mberlofa

mberlofa commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the still-valid CodeRabbit review-body notes:

  • charts/kibana/values.yaml: documented the Helm list replacement caveat for extraEnv, including the need to keep ELASTIC_APM_ACTIVE=false when overriding the list.
  • charts/kibana/ci/external-secrets-values.yaml: changed the three Kibana encryption-key remoteRef.key values to distinct fake-store keys so CI can catch key wiring swaps.
  • helmforge-ops: added the matching helmforge-fake-store fixtures and documented them (6f1e5f0). The local k3d fake store was also reapplied before validation.

Validation completed after the fix:

  • make validate-chart CHART=kibana TIMEOUT=1800 passed: kibana: FULLY VALIDATED (22 layers) including all GR-027 k3d scenarios and ci/external-secrets-values.yaml.
  • make release-check REPO=charts passed with only the expected GR-077 release warning.
  • make attribution-check REPO=charts passed.

These two notes were present in the CodeRabbit review summary body, not as separate resolvable review threads, so there was no additional thread ID to resolve for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant