Skip to content

Add ImageCache for multi container support#7661

Merged
knative-prow-robot merged 5 commits intoknative:masterfrom
savitaashture:imageCache
Apr 29, 2020
Merged

Add ImageCache for multi container support#7661
knative-prow-robot merged 5 commits intoknative:masterfrom
savitaashture:imageCache

Conversation

@savitaashture
Copy link
Copy Markdown
Contributor

Fixes:
Parts of #5822 #3384

Proposed Changes

  • Added image cache changes to have cache for multiple containers

Result:

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

image cache

kubectl get images.caching.internal.knative.dev
NAME                                                              AGE
multicontainer-v1-cache-second                                    90s
multicontainer-v1-cachec0cb79286e5fb748b173d92990b0b9fe-user-co   90s
multicontainer-v1-cached3e27505a93cf979d4ed256e644bb629-user-co   90s

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 21, 2020
@knative-prow-robot knative-prow-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Apr 21, 2020
Copy link
Copy Markdown
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@savitaashture: 0 warnings.

Details

In response to this:

Fixes:
Parts of #5822 #3384

Proposed Changes

  • Added image cache changes to have cache for multiple containers

Result:

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

image cache

kubectl get images.caching.internal.knative.dev
NAME                                                              AGE
multicontainer-v1-cache-second                                    90s
multicontainer-v1-cachec0cb79286e5fb748b173d92990b0b9fe-user-co   90s
multicontainer-v1-cached3e27505a93cf979d4ed256e644bb629-user-co   90s

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features labels Apr 21, 2020
// MakeImageCache makes an caching.Image resources from a revision.
func MakeImageCache(rev *v1.Revision) *caching.Image {
image := rev.Status.DeprecatedImageDigest
func MakeImageCache(rev *v1.Revision, name string) *caching.Image {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we pass in containerName, imageDigest string to not need to iterate twice?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently passing only containerName not the digest
because here I don't get the digest value
when i do container.Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you iterate over status, you'd get both, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it modified.
Please take a look :)

}
}
if image == "" {
image = rev.Spec.GetContainer().Image
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong now?

Copy link
Copy Markdown
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

Copy link
Copy Markdown
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

Comment thread pkg/reconciler/revision/reconcile_resources.go

ns := rev.Namespace
imageName := resourcenames.ImageCache(rev)
_, err := c.imageLister.Images(ns).Get(imageName)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not updating the Image resource when the digest changes?

Comment thread pkg/reconciler/revision/reconcile_resources.go
Comment thread pkg/reconciler/revision/table_test.go Outdated
Comment thread pkg/reconciler/revision/table_test.go Outdated
Comment thread pkg/reconciler/revision/resources/imagecache.go Outdated
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on the affected files.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/revision/reconcile_resources.go 92.8% 92.7% -0.1

@savitaashture
Copy link
Copy Markdown
Contributor Author

@markusthoemmes @vagababov @dprotaso @mattmoor
PR is ready for another review

Thank you :)

Copy link
Copy Markdown
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 28, 2020
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, savitaashture

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

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 28, 2020
@savitaashture
Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@savitaashture
Copy link
Copy Markdown
Contributor Author

/retest

@knative-test-reporter-robot
Copy link
Copy Markdown

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-integration-tests pull-knative-serving-integration-tests
pull-knative-serving-integration-tests
pull-knative-serving-integration-tests
3/3

Automatically retrying due to test flakiness...
/test pull-knative-serving-integration-tests

@markusthoemmes
Copy link
Copy Markdown
Contributor

@googlebot rescan

@knative-prow-robot knative-prow-robot merged commit 0744ccb into knative:master Apr 29, 2020
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. area/API API objects and controllers area/test-and-release It flags unit/e2e/conformance/perf test issues for product features cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants