diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/BUILD b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/BUILD index 5398ff8159bf..92534b83d8d1 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/BUILD +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/BUILD @@ -43,7 +43,6 @@ go_library( "//pkg/kubelet/cm:go_default_library", "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/dockershim/cm:go_default_library", - "//pkg/kubelet/dockershim/errors:go_default_library", "//pkg/kubelet/dockershim/libdocker:go_default_library", "//pkg/kubelet/leaky:go_default_library", "//pkg/kubelet/network:go_default_library", @@ -141,7 +140,6 @@ filegroup( srcs = [ ":package-srcs", "//pkg/kubelet/dockershim/cm:all-srcs", - "//pkg/kubelet/dockershim/errors:all-srcs", "//pkg/kubelet/dockershim/libdocker:all-srcs", "//pkg/kubelet/dockershim/remote:all-srcs", "//pkg/kubelet/dockershim/testing:all-srcs", diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/checkpoint_store.go b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/checkpoint_store.go index b8160bbd9bd6..34254d348846 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/checkpoint_store.go +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/checkpoint_store.go @@ -24,8 +24,6 @@ import ( "path/filepath" "regexp" "strings" - - "k8s.io/kubernetes/pkg/kubelet/dockershim/errors" ) const ( @@ -106,7 +104,7 @@ func (fstore *FileStore) Read(key string) ([]byte, error) { } bytes, err := ioutil.ReadFile(fstore.getCheckpointPath(key)) if os.IsNotExist(err) { - return bytes, errors.CheckpointNotFoundError + return bytes, fmt.Errorf("checkpoint is not found.") } return bytes, err } diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_checkpoint.go b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_checkpoint.go index 6ad1d794169f..18f9d2d0d53b 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_checkpoint.go +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_checkpoint.go @@ -23,7 +23,6 @@ import ( "path/filepath" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/kubelet/dockershim/errors" hashutil "k8s.io/kubernetes/pkg/util/hash" ) @@ -111,12 +110,14 @@ func (handler *PersistentCheckpointHandler) GetCheckpoint(podSandboxID string) ( //TODO: unmarhsal into a struct with just Version, check version, unmarshal into versioned type. err = json.Unmarshal(blob, &checkpoint) if err != nil { - glog.Errorf("Failed to unmarshal checkpoint %q. Checkpoint content: %q. ErrMsg: %v", podSandboxID, string(blob), err) - return &checkpoint, errors.CorruptCheckpointError + glog.Errorf("Failed to unmarshal checkpoint %q, removing checkpoint. Checkpoint content: %q. ErrMsg: %v", podSandboxID, string(blob), err) + handler.RemoveCheckpoint(podSandboxID) + return nil, fmt.Errorf("failed to unmarshal checkpoint") } if checkpoint.CheckSum != calculateChecksum(checkpoint) { - glog.Errorf("Checksum of checkpoint %q is not valid", podSandboxID) - return &checkpoint, errors.CorruptCheckpointError + glog.Errorf("Checksum of checkpoint %q is not valid, removing checkpoint", podSandboxID) + handler.RemoveCheckpoint(podSandboxID) + return nil, fmt.Errorf("checkpoint is corrupted") } return &checkpoint, nil } diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_sandbox.go b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_sandbox.go index 47220063e4a7..56bfc3598cf0 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_sandbox.go +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_sandbox.go @@ -30,7 +30,6 @@ import ( utilerrors "k8s.io/apimachinery/pkg/util/errors" runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" - "k8s.io/kubernetes/pkg/kubelet/dockershim/errors" "k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker" "k8s.io/kubernetes/pkg/kubelet/qos" "k8s.io/kubernetes/pkg/kubelet/types" @@ -193,20 +192,10 @@ func (ds *dockerService) StopPodSandbox(podSandboxID string) error { // actions will only have sandbox ID and not have pod namespace and name information. // Return error if encounter any unexpected error. if checkpointErr != nil { - if libdocker.IsContainerNotFoundError(statusErr) && checkpointErr == errors.CheckpointNotFoundError { + if libdocker.IsContainerNotFoundError(statusErr) { glog.Warningf("Both sandbox container and checkpoint for id %q could not be found. "+ "Proceed without further sandbox information.", podSandboxID) } else { - if checkpointErr == errors.CorruptCheckpointError { - // Remove the corrupted checkpoint so that the next - // StopPodSandbox call can proceed. This may indicate that - // some resources won't be reclaimed. - // TODO (#43021): Fix this properly. - glog.Warningf("Removing corrupted checkpoint %q: %+v", podSandboxID, *checkpoint) - if err := ds.checkpointHandler.RemoveCheckpoint(podSandboxID); err != nil { - glog.Warningf("Unable to remove corrupted checkpoint %q: %v", podSandboxID, err) - } - } return utilerrors.NewAggregate([]error{ fmt.Errorf("failed to get checkpoint for sandbox %q: %v", podSandboxID, checkpointErr), fmt.Errorf("failed to get sandbox status: %v", statusErr)}) @@ -494,13 +483,6 @@ func (ds *dockerService) ListPodSandbox(filter *runtimeapi.PodSandboxFilter) ([] checkpoint, err := ds.checkpointHandler.GetCheckpoint(id) if err != nil { glog.Errorf("Failed to retrieve checkpoint for sandbox %q: %v", id, err) - - if err == errors.CorruptCheckpointError { - glog.Warningf("Removing corrupted checkpoint %q: %+v", id, *checkpoint) - if err := ds.checkpointHandler.RemoveCheckpoint(id); err != nil { - glog.Warningf("Unable to remove corrupted checkpoint %q: %v", id, err) - } - } continue } result = append(result, checkpointToRuntimeAPISandbox(id, checkpoint)) diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_service.go b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_service.go index 745286038abf..d0614fc05cd6 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_service.go +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_service.go @@ -38,7 +38,6 @@ import ( kubecm "k8s.io/kubernetes/pkg/kubelet/cm" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" "k8s.io/kubernetes/pkg/kubelet/dockershim/cm" - "k8s.io/kubernetes/pkg/kubelet/dockershim/errors" "k8s.io/kubernetes/pkg/kubelet/network" "k8s.io/kubernetes/pkg/kubelet/network/cni" "k8s.io/kubernetes/pkg/kubelet/network/hostport" @@ -331,12 +330,7 @@ func (ds *dockerService) GetPodPortMappings(podSandboxID string) ([]*hostport.Po checkpoint, err := ds.checkpointHandler.GetCheckpoint(podSandboxID) // Return empty portMappings if checkpoint is not found if err != nil { - if err == errors.CheckpointNotFoundError { - glog.Warningf("Failed to retrieve checkpoint for sandbox %q: %v", podSandboxID, err) - return nil, nil - } else { - return nil, err - } + return nil, err } portMappings := make([]*hostport.PortMapping, 0, len(checkpoint.Data.PortMappings)) diff --git a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/testing/util.go b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/testing/util.go index 02195b0266ae..34bbb5303ef8 100644 --- a/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/testing/util.go +++ b/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/testing/util.go @@ -17,9 +17,8 @@ limitations under the License. package testing import ( + "fmt" "sync" - - "k8s.io/kubernetes/pkg/kubelet/dockershim/errors" ) // MemStore is an implementation of CheckpointStore interface which stores checkpoint in memory. @@ -44,7 +43,7 @@ func (mstore *MemStore) Read(key string) ([]byte, error) { defer mstore.Unlock() data, ok := mstore.mem[key] if !ok { - return nil, errors.CheckpointNotFoundError + return nil, fmt.Errorf("checkpoint is not found") } return data, nil }