Skip to content

Conversation

@pritidesai
Copy link
Member

Changes

In the native Kubernetes sidecar model, sidecars are implemented as init containers with a RestartPolicy: Always, which means they run for the entire duration of the pod's lifecycle. However, the current Tekton sidecar log results implementation doesn't account for this behavior and exits after processing results, causing the container to restart repeatedly.

This PR enhances the sidecarlogresults binary to support Kubernetes native sidecars by:

  • Adding a new -kubernetes-sidecar-mode flag that, when enabled, prevents the sidecar from exiting after processing results
  • Implementing proper signal handling to ensure a graceful shutdown when the pod is terminated

A sample pipelineRun with DinD and task results:

Before:

kubectl get pod large-result-pipeline-run6pvd8-large-task-pod -o json | jq '.status.initContainerStatuses[] | {name: .name, exitCode: .state.terminated.exitCode, restartCount: .restartCount}'  

{
  "name": "prepare",
  "exitCode": 0,
  "restartCount": 0
}
{
  "name": "place-scripts",
  "exitCode": 0,
  "restartCount": 0
}
{
  "name": "sidecar-server",
  "exitCode": 0,
  "restartCount": 0
}
{
  "name": "sidecar-tekton-log-results",
  "exitCode": 0,
  "restartCount": 8
}

After:

kubectl get pod large-result-pipeline-rundnpvb-large-task-pod -o json | jq '.status.initContainerStatuses[] | {name: .name, exitCode: .state.terminated.exitCode, restartCount: .restartCount}'  

{
  "name": "prepare",
  "exitCode": 0,
  "restartCount": 0
}
{
  "name": "place-scripts",
  "exitCode": 0,
  "restartCount": 0
}
{
  "name": "sidecar-server",
  "exitCode": 0,
  "restartCount": 0
}
{
  "name": "sidecar-tekton-log-results",
  "exitCode": 0,
  "restartCount": 0
}

/kind bug

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Added signal handling to SidecarLog to support Kubernetes-native sidecar functionality, preventing repeated restarts of the init container.

@tekton-robot tekton-robot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 23, 2025
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 23, 2025
In the native Kubernetes sidecar model, sidecars are implemented as init
containers with a `RestartPolicy: Always`, which means they run for the entire
duration of the pod's lifecycle. However, the current Tekton sidecar log results
implementation doesn't account for this behavior and exits after processing
results, causing the container to restart repeatedly.

Signed-off-by: Priti Desai <[email protected]>
@pritidesai pritidesai force-pushed the log-results-k8s-native-sidecar branch from a57c0f8 to 785cb68 Compare October 24, 2025 22:28
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2025
@pritidesai
Copy link
Member Author

Thank you @vdemeester for approving this PR.

@afrittoli, @waveywaves, @twoGiants - I would appreciate it if you could review this PR as well.

I would like to have this PR included in the 1.6 release.

@pritidesai pritidesai added this to the v1.6.0 (LTS) milestone Oct 27, 2025
@waveywaves waveywaves self-assigned this Oct 28, 2025
@vdemeester
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 30, 2025
@tekton-robot tekton-robot merged commit fcba522 into tektoncd:main Oct 30, 2025
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants