feat(system): add talos-log-collector package#3260
Conversation
📝 WalkthroughWalkthroughThis PR adds a ChangesTalos Log Collector Package
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Talos
participant Vector
participant VictoriaLogs
Talos->>Vector: Send JSON logs to 127.0.0.1:5170
Vector->>VictoriaLogs: POST compressed NDJSON to vlinsert-generic
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Trivy (0.69.3)Trivy execution failed: 2026-07-10T12:35:58Z FATAL Fatal error run error: fs scan error: scan error: scan failed: failed analysis: post analysis error: post analysis error: kubernetes scan error: fs filter error: fs filter error: walk error range error: stat smartylint.json: no such file or directory: range error: stat smartylint.json: no such file or directory 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 |
bddc1d5 to
cf184fe
Compare
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request adds the Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/system/talos-log-collector/tests/talos-log-collector_test.yaml (1)
88-102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding test coverage for ServiceAccount and CiliumNetworkPolicy.
The suite covers the receive/forward wiring well, but the ServiceAccount (disabled token automount) and CiliumNetworkPolicy (ingress restricted to host entity) are security-relevant templates with no test coverage. A separate test suite or expanded suite-level
templates:list would guard these against regression.💡 Suggested additional test cases
+ - it: "ServiceAccount has token automount disabled" + template: templates/serviceaccount.yaml + asserts: + - equal: + path: automountServiceAccountToken + value: false + + - it: "CiliumNetworkPolicy restricts ingress to host entity on listen port" + template: templates/networkpolicy.yaml + asserts: + - hasDocuments: + count: 1 + - matchRegex: + path: spec.ingresss[0].toPorts[0].ports[0].port + pattern: "5170"🤖 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 `@packages/system/talos-log-collector/tests/talos-log-collector_test.yaml` around lines 88 - 102, Add test coverage for the security-relevant templates that are currently untested: the ServiceAccount should assert token automount is disabled, and the CiliumNetworkPolicy should assert ingress is restricted to the host entity. Update the talos-log-collector test suite in talos-log-collector_test.yaml by either expanding the suite-level templates list or adding a separate suite that targets the ServiceAccount and CiliumNetworkPolicy templates, using their template names to keep the checks stable against refactors.
🤖 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 `@packages/system/talos-log-collector/README.md`:
- Around line 65-66: Update the resources table in README so the `resources.cpu`
entry matches `daemonset.yaml`: it is request-only, not request-and-limit. Keep
the `resources.memory` description unchanged, and make sure the wording for
`resources.cpu` reflects the actual behavior of the `resources` settings in
`packages/system/talos-log-collector/templates/daemonset.yaml`.
---
Nitpick comments:
In `@packages/system/talos-log-collector/tests/talos-log-collector_test.yaml`:
- Around line 88-102: Add test coverage for the security-relevant templates that
are currently untested: the ServiceAccount should assert token automount is
disabled, and the CiliumNetworkPolicy should assert ingress is restricted to the
host entity. Update the talos-log-collector test suite in
talos-log-collector_test.yaml by either expanding the suite-level templates list
or adding a separate suite that targets the ServiceAccount and
CiliumNetworkPolicy templates, using their template names to keep the checks
stable against refactors.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 35325edd-dd66-4e0f-9c52-c7e9ab51d4f9
📒 Files selected for processing (15)
Makefilepackages/core/platform/sources/talos-log-collector.yamlpackages/core/platform/templates/bundles/system.yamlpackages/system/talos-log-collector/Chart.yamlpackages/system/talos-log-collector/Makefilepackages/system/talos-log-collector/README.mdpackages/system/talos-log-collector/images/vector/Dockerfilepackages/system/talos-log-collector/templates/_helpers.tplpackages/system/talos-log-collector/templates/configmap.yamlpackages/system/talos-log-collector/templates/daemonset.yamlpackages/system/talos-log-collector/templates/networkpolicy.yamlpackages/system/talos-log-collector/templates/serviceaccount.yamlpackages/system/talos-log-collector/tests/talos-log-collector_test.yamlpackages/system/talos-log-collector/values.schema.jsonpackages/system/talos-log-collector/values.yaml
There was a problem hiding this comment.
Code Review
This pull request introduces the talos-log-collector package, which deploys a node-local Vector DaemonSet to collect Talos machine and kernel logs and forward them to VictoriaLogs. The feedback suggests using the dig function in the ConfigMap template to safely access .Values.global.target and avoid nil pointer errors, updating the PR scope to comply with the repository's conventional commit guidelines, and adding the CriticalAddonsOnly toleration to the DaemonSet to ensure proper scheduling on control-plane nodes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| victorialogs: | ||
| type: http | ||
| inputs: [tag] | ||
| uri: "http://vlinsert-generic.{{ .Values.global.target }}.svc:9481/insert/jsonline?_stream_fields=node,log_source,talos-service,facility&_msg_field=msg&_time_field=talos-time" |
There was a problem hiding this comment.
Directly accessing .Values.global.target can cause a nil pointer evaluation error if .Values.global is overridden or not defined in the parent chart or values. Using the Sprig dig function provides a safe fallback and prevents template rendering failures.
uri: "http://vlinsert-generic.{{ dig \"global\" \"target\" \"tenant-root\" .Values }}.svc:9481/insert/jsonline?_stream_fields=node,log_source,talos-service,facility&_msg_field=msg&_time_field=talos-time"| --- | ||
| apiVersion: cozystack.io/v1alpha1 | ||
| kind: PackageSource | ||
| metadata: | ||
| name: cozystack.talos-log-collector |
There was a problem hiding this comment.
The PR title and release note block use the scope system (e.g., feat(system): ...). According to the Cozystack Review Guidelines, system is not a valid scope. Please update the PR title and release note to use a valid scope, such as the package-specific scope talos-log-collector or platform.
References
- Each commit must follow Conventional Commits format:
type(scope): brief description. Valid scopes include package-specific scopes matching a directory underpackages/. (link)
| tolerations: | ||
| - effect: NoSchedule | ||
| operator: Exists | ||
| - effect: NoExecute | ||
| operator: Exists |
There was a problem hiding this comment.
For system-critical DaemonSets running on all nodes, it is recommended to explicitly tolerate the CriticalAddonsOnly taint. This ensures the log collector can schedule and run on control-plane nodes that have this taint applied.
tolerations:
- effect: NoSchedule
operator: Exists
- effect: NoExecute
operator: Exists
- key: CriticalAddonsOnly
operator: Existscf184fe to
0513194
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/system/talos-log-collector/templates/daemonset.yaml (1)
35-69: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider adding a liveness probe for the system-node-critical DaemonSet.
Without a
livenessProbe, Kubernetes cannot detect a hung Vector process. A TCP probe on the listen port is a minimal safeguard; enabling Vector's internal API for an HTTP health check would be more thorough.♻️ Suggested liveness probe
args: ["--config", "/etc/vector/vector.yaml"] + livenessProbe: + tcpSocket: + port: talos + initialDelaySeconds: 10 + periodSeconds: 30 env:🤖 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 `@packages/system/talos-log-collector/templates/daemonset.yaml` around lines 35 - 69, Add a livenessProbe to the DaemonSet container in the vector template so Kubernetes can detect a hung Vector process. Use the existing VECTOR listener port on the vector container (the same listenPort/hostPort target) and wire it into the containers spec near the current ports/resources settings. If you choose a more thorough check later, enable Vector’s internal API and switch to an HTTP health probe, but for now a TCP probe is the minimal fix.
🤖 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.
Nitpick comments:
In `@packages/system/talos-log-collector/templates/daemonset.yaml`:
- Around line 35-69: Add a livenessProbe to the DaemonSet container in the
vector template so Kubernetes can detect a hung Vector process. Use the existing
VECTOR listener port on the vector container (the same listenPort/hostPort
target) and wire it into the containers spec near the current ports/resources
settings. If you choose a more thorough check later, enable Vector’s internal
API and switch to an HTTP health probe, but for now a TCP probe is the minimal
fix.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ac821759-03db-45f1-81ad-6c592bafb079
📒 Files selected for processing (15)
Makefilepackages/core/platform/sources/talos-log-collector.yamlpackages/core/platform/templates/bundles/system.yamlpackages/system/talos-log-collector/Chart.yamlpackages/system/talos-log-collector/Makefilepackages/system/talos-log-collector/README.mdpackages/system/talos-log-collector/images/vector/Dockerfilepackages/system/talos-log-collector/templates/_helpers.tplpackages/system/talos-log-collector/templates/configmap.yamlpackages/system/talos-log-collector/templates/daemonset.yamlpackages/system/talos-log-collector/templates/networkpolicy.yamlpackages/system/talos-log-collector/templates/serviceaccount.yamlpackages/system/talos-log-collector/tests/talos-log-collector_test.yamlpackages/system/talos-log-collector/values.schema.jsonpackages/system/talos-log-collector/values.yaml
✅ Files skipped from review due to trivial changes (3)
- packages/system/talos-log-collector/templates/_helpers.tpl
- packages/system/talos-log-collector/values.yaml
- packages/system/talos-log-collector/README.md
🚧 Files skipped from review as they are similar to previous changes (7)
- packages/core/platform/sources/talos-log-collector.yaml
- packages/system/talos-log-collector/Chart.yaml
- packages/system/talos-log-collector/values.schema.json
- Makefile
- packages/system/talos-log-collector/images/vector/Dockerfile
- packages/core/platform/templates/bundles/system.yaml
- packages/system/talos-log-collector/tests/talos-log-collector_test.yaml
|
I think we should use already existing package monitoring-agents and add opt-in (default disabled) parameter to enable enpoints for accepting talos jsonlines logs. Additionaly, I don't think using vector is justified. It's another technology and possible new problems. On the other hand, using fluent-bit would be more straight-forward and we'd know what to expect. |
Add a node-local Vector DaemonSet that receives Talos machine and kernel logs (pushed via machine.logging over the node loopback) and forwards them to the tenant VictoriaLogs. Talos keeps its system and kernel logs inside the OS and does not expose them as host files, so the tail-based Fluent Bit in monitoring-agents never collects them. The receiver stays on the pod network so cluster DNS resolves the vlinsert service, and accepts Talos logs via a hostPort bound to hostIP 127.0.0.1, avoiding the host-network DNS breakage a hostNetwork receiver would hit. Shipped as an optional system package. Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
0513194 to
1fb4bcf
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (3)
packages/system/talos-log-collector/tests/talos-log-collector_test.yaml (2)
41-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTolerations test only covers NoSchedule; NoExecute is unverified.
The suite comment states "runs on every node (tolerate everything)" but the assertion only checks the
NoScheduletoleration. The DaemonSet template also includes aNoExecutetoleration. Adding an assertion for it would complete the coverage claim.♻️ Suggested additional assertion
- contains: path: spec.template.spec.tolerations content: effect: NoSchedule operator: Exists + - contains: + path: spec.template.spec.tolerations + content: + effect: NoExecute + operator: Exists🤖 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 `@packages/system/talos-log-collector/tests/talos-log-collector_test.yaml` around lines 41 - 51, Add an assertion to the “runs on every node and is node-critical” test verifying that the DaemonSet tolerations also include effect: NoExecute with operator: Exists, alongside the existing NoSchedule assertion.
20-27: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a digest-pinning assertion for the image.
The regex verifies the first-party repository but doesn't assert that the image is digest-pinned (
sha256:). Other system packages in the repo use patterns likevector:.+sha256:to enforce immutability without coupling to a specific digest. A separate assertion would guard against accidental non-pinned tags.Based on learnings, in the cozystack/cozystack repo it is acceptable and intentional for image-pin assertions to use tag/digest-agnostic regexes that verify digest pinning (e.g.,
:.+sha256:) rather than a specific full digest value.♻️ Suggested additional assertion
- it: "DaemonSet pulls the first-party vector image from the cozystack registry" template: templates/daemonset.yaml asserts: - isKind: of: DaemonSet - matchRegex: path: spec.template.spec.containers[0].image pattern: "^ghcr\\.io/cozystack/cozystack/vector:" + - matchRegex: + path: spec.template.spec.containers[0].image + pattern: "sha256:"🤖 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 `@packages/system/talos-log-collector/tests/talos-log-collector_test.yaml` around lines 20 - 27, Add a separate matchRegex assertion for spec.template.spec.containers[0].image in the DaemonSet test, using a pattern such as `:.+sha256:` to require a digest-pinned image while remaining independent of the specific digest.Source: Learnings
packages/system/talos-log-collector/templates/daemonset.yaml (1)
35-69: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider adding a liveness probe for hang detection.
No liveness probe is configured. If Vector hangs (e.g., deadlock or resource exhaustion), the pod stays
Runningbut silently stops collecting logs — particularly impactful for asystem-node-criticalDaemonSet. Enabling Vector's built-in health endpoint and adding an HTTP liveness probe is a small change with significant reliability benefit.💡 Proposed liveness probe addition
In
configmap.yaml, enable the Vector API (bound to loopback so it's not exposed to other pods):data_dir: /vector-data + api: + enabled: true + address: 127.0.0.1:52000 sources:In
daemonset.yaml, add the probe:args: ["--config", "/etc/vector/vector.yaml"] + livenessProbe: + httpGet: + path: /health + port: 52000 + host: 127.0.0.1 + initialDelaySeconds: 10 + periodSeconds: 30 env:🤖 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 `@packages/system/talos-log-collector/templates/daemonset.yaml` around lines 35 - 69, Add Vector’s built-in health API configuration to the chart’s configmap and add an HTTP liveness probe to the vector container in the DaemonSet, targeting the loopback API health endpoint and the configured listen port. Ensure the probe uses appropriate delay, timeout, and failure thresholds without exposing the API beyond the node.
🤖 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.
Nitpick comments:
In `@packages/system/talos-log-collector/templates/daemonset.yaml`:
- Around line 35-69: Add Vector’s built-in health API configuration to the
chart’s configmap and add an HTTP liveness probe to the vector container in the
DaemonSet, targeting the loopback API health endpoint and the configured listen
port. Ensure the probe uses appropriate delay, timeout, and failure thresholds
without exposing the API beyond the node.
In `@packages/system/talos-log-collector/tests/talos-log-collector_test.yaml`:
- Around line 41-51: Add an assertion to the “runs on every node and is
node-critical” test verifying that the DaemonSet tolerations also include
effect: NoExecute with operator: Exists, alongside the existing NoSchedule
assertion.
- Around line 20-27: Add a separate matchRegex assertion for
spec.template.spec.containers[0].image in the DaemonSet test, using a pattern
such as `:.+sha256:` to require a digest-pinned image while remaining
independent of the specific digest.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4f6d193b-785b-41b2-99cd-1df5f125107f
📒 Files selected for processing (15)
Makefilepackages/core/platform/sources/talos-log-collector.yamlpackages/core/platform/templates/bundles/system.yamlpackages/system/talos-log-collector/Chart.yamlpackages/system/talos-log-collector/Makefilepackages/system/talos-log-collector/README.mdpackages/system/talos-log-collector/images/vector/Dockerfilepackages/system/talos-log-collector/templates/_helpers.tplpackages/system/talos-log-collector/templates/configmap.yamlpackages/system/talos-log-collector/templates/daemonset.yamlpackages/system/talos-log-collector/templates/networkpolicy.yamlpackages/system/talos-log-collector/templates/serviceaccount.yamlpackages/system/talos-log-collector/tests/talos-log-collector_test.yamlpackages/system/talos-log-collector/values.schema.jsonpackages/system/talos-log-collector/values.yaml
✅ Files skipped from review due to trivial changes (6)
- packages/system/talos-log-collector/values.yaml
- packages/system/talos-log-collector/Chart.yaml
- packages/system/talos-log-collector/templates/_helpers.tpl
- Makefile
- packages/system/talos-log-collector/images/vector/Dockerfile
- packages/system/talos-log-collector/README.md
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/system/talos-log-collector/values.schema.json
- packages/core/platform/templates/bundles/system.yaml
- packages/core/platform/sources/talos-log-collector.yaml
What this PR does
Adds
talos-log-collector, an optional system package: a node-local VectorDaemonSet that receives Talos machine and kernel logs and forwards them to the
tenant VictoriaLogs (vlinsert), alongside the container/audit/event logs
already collected by monitoring-agents.
Talos keeps system and kernel (kmsg) logs inside the OS and does not write them
to a host file the Fluent Bit
tailinput could read, so these logs arecurrently never collected. Vector receives them over the node loopback
(Talos
machine.logging); on Talos v1.12machine.loggingalready forwardsthe runtime kernel (kmsg) stream as the
kernelservice, so no separateKmsgLogConfigis required for runtime kernel logs.Design notes:
extra config. Talos pushes to 127.0.0.1:5170; a
hostPortbound tohostIP: 127.0.0.1publishes that loopback socket into the pod via portmap,keeping the receiver off the host network (no node-wide pod exposure).
entity, so other pods cannot inject spoofed log lines.
bundles.enabledPackages): inert until eachTalos node is configured to push logs. Node-side setup is in the README.
Verified end-to-end on a Talos v1.12 dev cluster: service and kernel logs
(including DRBD kmsg) reach VictoriaLogs; pods run non-root with 0 restarts.
Release note
Summary by CodeRabbit