Merge pull request #90061 from marosset/runtimehandler-image-spec-annotations

Add annotations to CRI ImageSpec objects
This commit is contained in:
Kubernetes Prow Robot
2020-05-18 16:29:36 -07:00
committed by GitHub
12 changed files with 888 additions and 329 deletions

View File

@@ -25,7 +25,7 @@ import (
"strings"
"time"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/remotecommand"
"k8s.io/client-go/util/flowcontrol"
@@ -47,7 +47,11 @@ type Version interface {
// value of a Container's Image field, but in the future it will include more detailed
// information about the different image types.
type ImageSpec struct {
// ID of the image.
Image string
// The annotations for the image.
// This should be passed to CRI during image pulls and returned when images are listed.
Annotations []Annotation
}
// ImageStats contains statistics about all the images currently available.
@@ -349,6 +353,8 @@ type Image struct {
RepoDigests []string
// The size of the image in bytes.
Size int64
// ImageSpec for the image which include annotations.
Spec ImageSpec
}
type EnvVar struct {

View File

@@ -25,7 +25,7 @@ import (
"sync"
"time"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/util/flowcontrol"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
@@ -300,6 +300,13 @@ func (f *FakeRuntime) PullImage(image kubecontainer.ImageSpec, pullSecrets []v1.
defer f.Unlock()
f.CalledFunctions = append(f.CalledFunctions, "PullImage")
if f.Err == nil {
i := kubecontainer.Image{
ID: image.Image,
Spec: image,
}
f.ImageList = append(f.ImageList, i)
}
return image.Image, f.Err
}