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

@@ -17,7 +17,7 @@ limitations under the License.
package kuberuntime
import (
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"k8s.io/klog/v2"
@@ -40,7 +40,8 @@ func (m *kubeGenericRuntimeManager) PullImage(image kubecontainer.ImageSpec, pul
return "", err
}
imgSpec := &runtimeapi.ImageSpec{Image: img}
imgSpec := toRuntimeAPIImageSpec(image)
creds, withCredentials := keyring.Lookup(repoToPull)
if !withCredentials {
klog.V(3).Infof("Pulling image %q without credentials", img)
@@ -80,7 +81,7 @@ func (m *kubeGenericRuntimeManager) PullImage(image kubecontainer.ImageSpec, pul
// GetImageRef gets the ID of the image which has already been in
// the local storage. It returns ("", nil) if the image isn't in the local storage.
func (m *kubeGenericRuntimeManager) GetImageRef(image kubecontainer.ImageSpec) (string, error) {
status, err := m.imageService.ImageStatus(&runtimeapi.ImageSpec{Image: image.Image})
status, err := m.imageService.ImageStatus(toRuntimeAPIImageSpec(image))
if err != nil {
klog.Errorf("ImageStatus for image %q failed: %v", image, err)
return "", err
@@ -107,6 +108,7 @@ func (m *kubeGenericRuntimeManager) ListImages() ([]kubecontainer.Image, error)
Size: int64(img.Size_),
RepoTags: img.RepoTags,
RepoDigests: img.RepoDigests,
Spec: toKubeContainerImageSpec(img),
})
}