Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support network ipam for compose #652

Merged
merged 1 commit into from
Jan 4, 2022

Conversation

junnplus
Copy link
Member

Signed-off-by: ye.sijun junnplus@gmail.com

Fixes: #432
Thank #436

@AkihiroSuda AkihiroSuda added area/compose bug Something isn't working labels Dec 27, 2021
@AkihiroSuda AkihiroSuda added this to the v0.16.0 milestone Dec 27, 2021
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@fahedouch
Copy link
Member

fahedouch commented Dec 27, 2021

Thanks, LGTM on green CI

@AkihiroSuda
Copy link
Member

== RUN   TestComposeIPAMConfig
    compose_up_linux_test.go:322: projectName="nerdctl-compose-test2542743296"
    compose_up_linux_test.go:324: assertion failed: expression is false: res.ExitCode == exitCode: time="2021-12-27T09:47:25Z" level=info msg="Creating network nerdctl-compose-test2542743296_default"
        panic: reflect: call of reflect.Value.NumField on ptr Value
        goroutine 1 [running]:
        reflect.flag.mustBe(...)
        	/usr/local/go/src/reflect/value.go:223
        reflect.Value.NumField({0x10670a0, 0xc00059c880, 0x1290cf6})
        	/usr/local/go/src/reflect/value.go:1710 +0x8d
        github.com/containerd/nerdctl/pkg/reflectutil.UnknownNonEmptyFields({0x1062b60, 0xc00059c880}, {0xc0006df520, 0x2, 0x2})
        	/go/src/github.com/containerd/nerdctl/pkg/reflectutil/reflectutil.go:40 +0x23d
        github.com/containerd/nerdctl/pkg/composer.(*Composer).upNetwork(0xc0001aa2a0, {0x1599360, 0xc000114000}, {0xc0005fda10, 0x7})
        	/go/src/github.com/containerd/nerdctl/pkg/composer/up_network.go:57 +0x65b
        github.com/containerd/nerdctl/pkg/composer.(*Composer).Up(0xc0001aa2a0, {0x1599360, 0xc000114000}, {0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...)
        	/go/src/github.com/containerd/nerdctl/pkg/composer/up.go:44 +0xea
        main.composeUpAction(0xc000323400, {0xc000518fa0, 0x0, 0x1})
        	/go/src/github.com/containerd/nerdctl/cmd/nerdctl/compose_up.go:117 +0x53c
        github.com/spf13/cobra.(*Command).execute(0xc000323400, {0xc00003a0d0, 0x1, 0x1})
        	/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x60e
        github.com/spf13/cobra.(*Command).ExecuteC(0xc0001b7680)
        	/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3bc
        github.com/spf13/cobra.(*Command).Execute(...)
        	/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
        main.xmain()
        	/go/src/github.com/containerd/nerdctl/cmd/nerdctl/main.go:84 +0x9f
        main.main()
        	/go/src/github.com/containerd/nerdctl/cmd/nerdctl/main.go:67 +0x19
--- FAIL: TestComposeIPAMConfig (0.02s)

https://cirrus-ci.com/task/4883230380785664?logs=rootful_test#L215

@AkihiroSuda
Copy link
Member

--- PASS: TestComposeUpWithScale (0.53s)
=== RUN   TestComposeIPAMConfig
    compose_up_linux_test.go:324: projectName="nerdctl-compose-test2749460603"
    compose_up_linux_test.go:326: assertion failed: expression is false: res.ExitCode == exitCode: time="2021-12-27T10:48:36Z" level=info msg="Creating network nerdctl-compose-test2749460603_default"
        time="2021-12-27T10:48:37Z" level=info msg="Ensuring image ghcr.io/stargz-containers/alpine:3.13-org"
        time="2021-12-27T10:48:37Z" level=info msg="Creating container nerdctl-compose-test2749460603_foo_1"
        time="2021-12-27T10:48:37Z" level=fatal msg="failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: time=\"2021-12-27T10:48:37Z\" level=fatal msg=\"failed to call cni.Setup: plugin type=\\\"bridge\\\" failed (add): failed to set bridge addr: \\\"nerdctl1\\\" already has an IP address different from 10.1.100.1/24\"\nFailed to write to log, write /var/lib/nerdctl/1935db59/containers/nerdctl-test/0c6b3bc6622c1ec0cead5d768ad577f8d0347c0b0c74501c98aef03d85290411/oci-hook.createRuntime.log: file already closed: unknown"
        time="2021-12-27T10:48:37Z" level=fatal msg="error while creating container nerdctl-compose-test2749460603_foo_1: exit status 1"
--- FAIL: TestComposeIPAMConfig (0.24s)

https://cirrus-ci.com/task/4506924338118656?logs=rootful_test#L214

@fahedouch
Copy link
Member

fahedouch commented Jan 2, 2022

I think that problem come from the TestComposeUpWithScale test

defer base.ComposeCmd("-f", comp.YAMLFullPath(), "down", "-v").Run()

Scaled replicas are not removed with defer because they are not mentioned on docker-compose.yml but the svc itself is removed. This orphan cni config should make this error. I will try to test this tomorrow and make a fix to remove orphan container in the Compose svc

@junnplus junnplus force-pushed the compose-network-ipam branch 2 times, most recently from 0e2f189 to bfa0b85 Compare January 3, 2022 16:08
@AkihiroSuda
Copy link
Member

Please rebase

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Signed-off-by: ye.sijun <junnplus@gmail.com>
@AkihiroSuda AkihiroSuda merged commit 2b14c9e into containerd:master Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/compose bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compose ignores network settings
3 participants