Replies: 3 comments 8 replies
-
|
So if understood correctly the problem is the size of the table that holds the logs and KubeArchive failing to get those logs from the associated logging system, so it is kind of pointless and prone to confusing results. I think this could make sense and help reduce useless information. I would keep it just to the basic implementation, the advanced implementation look just as a series of ANDs/ORs. Where the examples are from? I don't see those values in the PodStatus: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodStatus |
Beta Was this translation helpful? Give feedback.
-
Why does the workload type even matter here? The container structure itself is independent of any workload. And why do we want to allow this to be configurable at all? Why not just only generate a log URL for a container if one of the following is true:
I believe this catches almost everything, but I think it might be safer to reverse the logic. So if none of these conditions are true, then there was definitely no log generated. I would suggest to just implement a solution and not allow users to configure it at all. We should be able to catch almost all conditions except for a couple of corner cases. In that case the only downs is a few URL for logs that don't exist. This is a better outcome that not creating URLs for those corner cases where logs do exist. |
Beta Was this translation helpful? Give feedback.
-
I am.
In this case, yes. We can still do this work to see if a log URL should be generated. But right now we have no idea if the links we are generating point to real logs. Any link. It's possible not a single one works. And this can be fixed if we check for the existence of the log. It could be an additional check.
I do not think this has to be true. First, Tekton Results is doing exactly this and I don't thinks it's impacting them negatively. This type of operation is exactly what the HTTP How we would do it in KubeArchive is up for debate. I would not add a wait to the archive itself, but rather make it some sort of separate process. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Problem Statement
Currently, KubeArchive creates a
log_urltable entry for every container defined in a Pod'sspec.containersandspec.initContainers. However, not all containers that appear in the spec actually run and produce logs.Example: Tekton Pipelines
In Tekton TaskRuns, steps execute sequentially but all step containers are created simultaneously by Kubernetes. When a TaskRun is cancelled:
From Kubernetes' perspective, all these containers have
state.terminated.startedAtbecause their container processes started, but only some actually executed their workload and produced logs.This results in
log_urlentries pointing to non-existent logs, creating a poor user experience when querying archived Pods.The Core Issue
There is no universal way to determine from Pod YAML alone whether a container produced logs. Different workload types (Tekton, Jobs, regular Pods) have different patterns for indicating "this container actually ran its workload."
Proposed Solution
Add a configurable CEL expression that determines whether to create a
log_urlentry for each container. This allows KubeArchive to remain generic while supporting customization for specific environments.Design Principles
Technical Design
Configuration
Add a new optional key to the
kubearchive-loggingConfigMap:The CEL expression:
status.containerStatuses[i]orstatus.initContainerStatuses[i])true= create log_url entry,false= skip)Default Behavior
If
LOG_URL_CONDITIONis not specified, use the current behavior:This creates entries for all containers that have started from Kubernetes' perspective (backward compatible).
Container Status Context
The CEL expression has access to the container status object structure:
Configuration Examples
Example 1: Tekton Environment
Only create log entries for containers that emitted Tekton's termination message with
StartedAt:Example 2: Runtime Threshold
Only create entries for containers that ran for more than 5 seconds:
Example 3: Success Only
Only create entries for containers that completed successfully:
Example 4: Non-waiting Containers
Skip containers that never started (still in waiting state):
Implementation Plan
Phase 1: Basic Implementation
Add
LOG_URL_CONDITIONsupport tocmd/sink/logs/logs.goModify
logurls.GenerateLogURLs()to accept an optional conditionfalseUpdate CEL evaluation context
Phase 2: Selector-Based Rules (Future Enhancement)
Support different conditions for different Pods based on labels/annotations:
This would be evaluated in order, using the first matching selector's condition.
Implementation Considerations
CEL Context Requirements
The current implementation passes the full Pod (
*unstructured.Unstructured) to CEL evaluation. We need to:status.containerStatusesandstatus.initContainerStatusesModified Flow
Current flow:
New flow:
Backward Compatibility
LOG_URL_CONDITIONis not specified, maintain current behaviorError Handling
LOG_URL_CONDITIONfails to compile: Log error and fall back to default behaviorTesting Strategy
Documentation Updates
Open Questions
Should we provide preset conditions? E.g., a built-in "tekton" mode users can reference instead of writing CEL?
Should condition failures be silent or visible? Should users be able to see which containers were filtered out?
Performance impact: How does per-container CEL evaluation impact Pod processing time at scale?
Alternative approach: Should we support checking the logging backend directly to verify logs exist before creating entries? (More accurate but adds latency and coupling)
Benefits
Related Work
Beta Was this translation helpful? Give feedback.
All reactions