Git Product home page Git Product logo

Comments (9)

ABNER-1 avatar ABNER-1 commented on June 11, 2024

I attempted to reproduce it, but it passed. Can you still reproduce it now?

from kruise.

Colvin-Y avatar Colvin-Y commented on June 11, 2024

I attempted to reproduce it, but it passed. Can you still reproduce it now?

Yes, maybe because I use mac M1? I'm really confused, could u plz tell me ur environment?

Running tool: /opt/homebrew/bin/go test -timeout 30s -run ^TestMatchRegistryAuths$ github.com/openkruise/kruise/pkg/daemon/criruntime/imageruntime

--- FAIL: TestMatchRegistryAuths (0.00s)
    --- FAIL: TestMatchRegistryAuths/test4 (0.00s)
        /Users/bytedance/Profile/go_workspace/src/data-kruise/pkg/daemon/criruntime/imageruntime/helpers_test.go:117: convertToRegistryAuths failed
FAIL
FAIL	github.com/openkruise/kruise/pkg/daemon/criruntime/imageruntime	0.834s
FAIL

Env:

go version go1.19.13 darwin/arm64
go version go1.20.14 darwin/arm64

from kruise.

ABNER-1 avatar ABNER-1 commented on June 11, 2024

Hi, @Colvin-Y .
I successfully reproduced the issue and discovered that it fails on any PC without Docker installed.

The core code stack is:

credentialprovider.ReadDockerConfigJSONFile (config.go:146) k8s.io/kubernetes/pkg/credentialprovider
credentialprovider.ReadDockerConfigFile (config.go:171) k8s.io/kubernetes/pkg/credentialprovider
credentialprovider.(*defaultDockerConfigProvider).Provide (provider.go:79) k8s.io/kubernetes/pkg/credentialprovider
credentialprovider.(*CachingDockerConfigProvider).Provide (provider.go:103) k8s.io/kubernetes/pkg/credentialprovider
credentialprovider.(*providersDockerKeyring).Lookup (keyring.go:269) k8s.io/kubernetes/pkg/credentialprovider
credentialprovider.UnionDockerKeyring.Lookup (keyring.go:299) k8s.io/kubernetes/pkg/credentialprovider
<autogenerated>:2
secret.ConvertToRegistryAuths (parse.go:33) github.com/openkruise/kruise/pkg/util/secret
imageruntime.TestMatchRegistryAuths.func6 (helpers_test.go:112) github.com/openkruise/kruise/pkg/daemon/criruntime/imageruntime
testing.tRunner (testing.go:1689) testing
testing.(*T).Run.gowrap1 (testing.go:1742) testing
runtime.goexit (asm_arm64.s:1222) runtime
 - Async Stack Trace
testing.(*T).Run (testing.go:1742) testing

ReadDockerConfigJSONFile(nil) will return different results based on whether Docker is installed.

from kruise.

Colvin-Y avatar Colvin-Y commented on June 11, 2024

ReadDockerConfigJSONFile

Hi, @ABNER-1.
Thanks for your reply, but actually I've installed docker

➜  ~ cat ~/.docker/config.json
{
	"auths": {
	},
	"credsStore": "desktop",
	"currentContext": "desktop-linux"
}

And I've tried to print the result from function secret.ConvertToRegistryAuths(cs.GetSecrets(), repoToPull)

infos: [{echoserver test}]
--- FAIL: TestMatchRegistryAuths (0.00s)
    --- FAIL: TestMatchRegistryAuths/test4 (0.00s)
        helpers_test.go:120: convertToRegistryAuths failed
FAIL

What config should I check?

from kruise.

ABNER-1 avatar ABNER-1 commented on June 11, 2024

I plan to debug it again this weekend. However, if you'd like to take a crack at it, please feel free to do so. @Colvin-Y

from kruise.

Colvin-Y avatar Colvin-Y commented on June 11, 2024

I plan to debug it again this weekend. However, if you'd like to take a crack at it, please feel free to do so. @Colvin-Y

Thank u! I also plan to figure out what the whole test cases are doing. @ABNER-1

from kruise.

ABNER-1 avatar ABNER-1 commented on June 11, 2024

image

func readDockerConfigJSONFileFromBytes(contents []byte) (cfg DockerConfig, err error) {
	var cfgJSON DockerConfigJSON
	if err = json.Unmarshal(contents, &cfgJSON); err != nil {
		return nil, errors.New("error occurred while trying to unmarshal json")
	}
	cfg = cfgJSON.Auths
	return
}

The 'auths' value in docker/config.json will be regarded as authentication information for the public Docker registry. It should be disregarded in Test Case 4.

from kruise.

ABNER-1 avatar ABNER-1 commented on June 11, 2024

A simple solution in my opinion:
len(infos) != cs.Expect => len(infos) < cs.Expect
refer code:

if len(infos) != cs.Expect {

from kruise.

Colvin-Y avatar Colvin-Y commented on June 11, 2024

image

func readDockerConfigJSONFileFromBytes(contents []byte) (cfg DockerConfig, err error) {
	var cfgJSON DockerConfigJSON
	if err = json.Unmarshal(contents, &cfgJSON); err != nil {
		return nil, errors.New("error occurred while trying to unmarshal json")
	}
	cfg = cfgJSON.Auths
	return
}

The 'auths' value in docker/config.json will be regarded as authentication information for the public Docker registry. It should be disregarded in Test Case 4.

Got it! thx!

from kruise.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.