k8s.io/kubernetes@v1.29.3/pkg/kubelet/images/types.go (about) 1 /* 2 Copyright 2016 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package images 18 19 import ( 20 "context" 21 "errors" 22 23 v1 "k8s.io/api/core/v1" 24 runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1" 25 ) 26 27 var ( 28 // ErrImagePullBackOff - Container image pull failed, kubelet is backing off image pull 29 ErrImagePullBackOff = errors.New("ImagePullBackOff") 30 31 // ErrImageInspect - Unable to inspect image 32 ErrImageInspect = errors.New("ImageInspectError") 33 34 // ErrImagePull - General image pull error 35 ErrImagePull = errors.New("ErrImagePull") 36 37 // ErrImageNeverPull - Required Image is absent on host and PullPolicy is NeverPullImage 38 ErrImageNeverPull = errors.New("ErrImageNeverPull") 39 40 // ErrInvalidImageName - Unable to parse the image name. 41 ErrInvalidImageName = errors.New("InvalidImageName") 42 ) 43 44 // ImageManager provides an interface to manage the lifecycle of images. 45 // Implementations of this interface are expected to deal with pulling (downloading), 46 // managing, and deleting container images. 47 // Implementations are expected to abstract the underlying runtimes. 48 // Implementations are expected to be thread safe. 49 type ImageManager interface { 50 // EnsureImageExists ensures that image specified in `container` exists. 51 EnsureImageExists(ctx context.Context, pod *v1.Pod, container *v1.Container, pullSecrets []v1.Secret, podSandboxConfig *runtimeapi.PodSandboxConfig, podRuntimeHandler string) (string, string, error) 52 53 // TODO(ronl): consolidating image managing and deleting operation in this interface 54 }