Skip to content

Modify order of the revision ContainerStatus in sync with Spec #7658

@savitaashture

Description

@savitaashture

Describe the feature

Background:

For multi-container support a new field has been added to the revision status which is containerStatus

type ContainerStatuses struct {
	Name        string `json:"name,omitempty"`
        ImageDigest string `json:"imageDigest,omitempty"`
}

which contains information of name of a container and digest value of the image.

When we create a knative service with multiple containers

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: multicontainer
spec:
  template:
    metadata:
      name: multicontainer-v1
    spec:
      containers:
      - image: container-a:v2
        name: first
        ports:
        - containerPort: 8111
      - image: container-c:v2
        name: second
      - image: container-b:v2
        name: third

The containerStatus will be created as shown below

  containerStatuses:
  - imageDigest: index.docker.io/savita3020/container-b@sha256:74d60b674dbb0cbeac62bff23cbadcf5dc1963573010a232e7525d9adffe1c46
    name: third
  - imageDigest: index.docker.io/savita3020/container-c@sha256:d8ccbc9b1bb48d7cdff5d41fb0b4ff2e634f8acf2abf665a334269369a95816a
    name: second
  - imageDigest: index.docker.io/savita3020/container-a@sha256:1422a4e8a7a3bd6032081b53610ec0e982a515948001102eb0774b3c4a60f1bb
    name: first

So here the Spec part of containers not in sync with containerStatuses we can observe the name sequence are different.

Acceptance:
The containerStatuses should have the same order like Spec
like below
Spec:

    spec:
      containers:
      - image: container-a:v2
        name: first
        ports:
        - containerPort: 8111
      - image: container-c:v2
        name: second
      - image: container-b:v2
        name: third

ContainerStatus:

  containerStatuses:
  - imageDigest: index.docker.io/savita3020/container-a@sha256:1422a4e8a7a3bd6032081b53610ec0e982a515948001102eb0774b3c4a60f1bb
    name: first
  - imageDigest: index.docker.io/savita3020/container-c@sha256:d8ccbc9b1bb48d7cdff5d41fb0b4ff2e634f8acf2abf665a334269369a95816a
    name: second
  - imageDigest: index.docker.io/savita3020/container-b@sha256:74d60b674dbb0cbeac62bff23cbadcf5dc1963573010a232e7525d9adffe1c46
    name: third

For more info #7373 (comment)

/area API

/kind good-first-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/APIAPI objects and controllerskind/featureWell-understood/specified features, ready for coding.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions