Skip to content

Sidecar container's status isn't propagated to Kservice #14567

@seongpyoHong

Description

@seongpyoHong

In what area(s)?

/area API

What version of Knative?

0.11.x

Expected Behavior

When I use multiple containers, one with no ports is not ready, Kservice also becomes Ready=False.

Actual Behavior

I use multiple containers, one with no ports is not ready.

$ kgp
NAME                                                       READY   STATUS             RESTARTS          AGE
failed-multi-container-00001-deployment-75675ff7fd-lswwl   2/3     CrashLoopBackOff   299 (4m54s ago)   25h

However, Kservice's Ready is True

$  k get ksvc
NAME                     URL                         LATESTCREATED                  LATESTREADY                    READY   REASON
failed-multi-container   https://<internal-domain>   failed-multi-container-00001   failed-multi-container-00001   True

Steps to Reproduce the Problem

Use this template.

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: failed-multi-container
spec:
  template:
    spec:
      containerConcurrency: 0
      containers:
      - image: <always-failed-container>
        name: failed-container
      - image: <success-container>
        name: success-container
        ports:
        - containerPort: 17123
          protocol: TCP
        readinessProbe:
          successThreshold: 1
          tcpSocket:
            port: 0
      timeoutSeconds: 300
  traffic:
  - latestRevision: true
    percent: 100

Question

Is there a reason to consider only containers with ports when calculating ContainerHealth Condition in Revision?

for _, status := range pod.Status.ContainerStatuses {
if status.Name == rev.Spec.GetContainer().Name {
if t := status.LastTerminationState.Terminated; t != nil {
logger.Infof("marking exiting with: %d/%s", t.ExitCode, t.Message)
if t.ExitCode == 0 && t.Message == "" {
// In cases where there is no error message, we should still provide some exit message in the status
rev.Status.MarkContainerHealthyFalse(v1.ExitCodeReason(t.ExitCode),
v1.RevisionContainerExitingMessage("container exited with no error"))
} else {
rev.Status.MarkContainerHealthyFalse(v1.ExitCodeReason(t.ExitCode), v1.RevisionContainerExitingMessage(t.Message))
}
} else if w := status.State.Waiting; w != nil && hasDeploymentTimedOut(deployment) {
logger.Infof("marking resources unavailable with: %s: %s", w.Reason, w.Message)
rev.Status.MarkResourcesAvailableFalse(w.Reason, w.Message)
}
break

I think checking the status of all containers that are not queue-proxy will solve this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/APIAPI objects and controllerskind/bugCategorizes issue or PR as related to a bug.triage/acceptedIssues which should be fixed (post-triage)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions