Skip to content

Commit

Permalink
gofmts files
Browse files Browse the repository at this point in the history
  • Loading branch information
x7upLime committed Dec 7, 2022
1 parent 5314b71 commit f4a5113
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,7 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
Expand Down
8 changes: 4 additions & 4 deletions pkg/drivers/kic/oci/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package oci
import (
"os/exec"
"strings"

"k8s.io/minikube/pkg/minikube/image"
)

Expand All @@ -17,16 +17,16 @@ func ArchiveToDriverCache(ociBin, path string) (string, error) {

// IsInCache
// searches in OCIBIN's cache for the IMG; returns true if found. no error handling
func IsImageInCache(ociBin, img string) (bool) {
func IsImageInCache(ociBin, img string) bool {
res, err := runCmd(exec.Command(ociBin, "images", "--format", "{{.Repository}}:{{.Tag}}@{{.Digest}}"))
if err != nil {
// only the docker binary seems to have this issue..
// the docker.io/ substring is cut from the output and formatting doesn't help
if ociBin == Docker {
img = image.TrimDockerIO(img)
}
if strings.Contains(res.Stdout.String(), img){

if strings.Contains(res.Stdout.String(), img) {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/kic/oci/download.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package oci

import (
"os/exec"
"bytes"
"os/exec"
)

func PullImage(ociBin, img string) (bytes.Buffer, error) {
Expand Down
12 changes: 5 additions & 7 deletions pkg/minikube/download/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ func ImageExistsInKicDriver(ociBin, img string) bool {
if inCache {
klog.Infof("Found %s in local KICdriver's cache, skipping pull", img)
return true
} else {
return false
}
return false
}

// ImageToCache
Expand Down Expand Up @@ -194,8 +193,8 @@ func parseImage(img string) (*name.Tag, name.Reference, error) {

// CacheToKICDriver
// loads a locally minikube-cached container image, to the KIC-driver's cache
func CacheToKicDriver(ociBin string, img string) (error) {
p := imagePathInMinikubeCache(img)
func CacheToKicDriver(ociBin string, img string) error {
p := imagePathInMinikubeCache(img)
resp, err := oci.ArchiveToDriverCache(ociBin, p)
klog.V(2).Infof("response: %s", resp)
return err
Expand All @@ -209,7 +208,7 @@ func ImageToKicDriver(ociBin, img string) error {
if err != nil {
return err
}

fileLock := filepath.Join(detect.KICCacheDir(), path.Base(img)+".d.lock")
fileLock = localpath.SanitizeCacheDir(fileLock)
releaser, err := lockDownload(fileLock)
Expand All @@ -219,13 +218,12 @@ func ImageToKicDriver(ociBin, img string) error {
if err != nil {
return err
}

if ImageExistsInKicDriver(ociBin, img) {
klog.Infof("%s exists in KicDriver, skipping pull", img)
return nil
}


if DownloadMock != nil {
klog.Infof("Mock download: %s -> daemon", img)
return DownloadMock(img, "daemon")
Expand Down
3 changes: 1 addition & 2 deletions pkg/minikube/node/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/download"
// "k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/image"
"k8s.io/minikube/pkg/minikube/localpath"
Expand Down Expand Up @@ -163,7 +162,7 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down
if err == nil {
klog.Infof("successfully loaded %s from cached tarball", img)
isFromCache = true
}
}

klog.Infof("Downloading %s to local KicDriver", img)
err = download.ImageToKicDriver(cc.Driver, img)
Expand Down

0 comments on commit f4a5113

Please sign in to comment.