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

bugfix: missing merge some config from image #2156

Merged
merged 1 commit into from
Aug 27, 2018
Merged

bugfix: missing merge some config from image #2156

merged 1 commit into from
Aug 27, 2018

Conversation

Ace-Tang
Copy link
Contributor

add user, labels, stop signal and exposed ports config from image
config in create container.

Signed-off-by: Ace-Tang aceapril@126.com

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Aug 24, 2018
@codecov-io
Copy link

codecov-io commented Aug 24, 2018

Codecov Report

Merging #2156 into master will increase coverage by 0.03%.
The diff coverage is 83.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2156      +/-   ##
==========================================
+ Coverage   64.41%   64.45%   +0.03%     
==========================================
  Files         209      209              
  Lines       16669    16693      +24     
==========================================
+ Hits        10738    10760      +22     
- Misses       4603     4604       +1     
- Partials     1328     1329       +1
Flag Coverage Δ
#criv1alpha1test 32.95% <62.16%> (ø) ⬆️
#criv1alpha2test 33.64% <62.16%> (+0.08%) ⬆️
#integrationtest 39.33% <67.56%> (+0.06%) ⬆️
#unittest 24.01% <62.16%> (+0.16%) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_types.go 83.63% <100%> (+4.09%) ⬆️
daemon/mgr/container.go 56.8% <40%> (-0.12%) ⬇️
ctrd/image.go 77.19% <0%> (-1.76%) ⬇️
cri/v1alpha1/cri.go 63.36% <0%> (-0.35%) ⬇️
cri/v1alpha2/cri.go 64.34% <0%> (+0.33%) ⬆️
daemon/mgr/container_storage.go 50.93% <0%> (+0.93%) ⬆️

if err != nil {
return err
}

// If user specify the Entrypoint, no need to merge image's configuration.
// Otherwise use the image's configuration to fill it.
// If user specify the Entrypoint, no need to merge image's confuration.
Copy link
Contributor

Choose a reason for hiding this comment

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

confuration?

c.Config.WorkingDir = config.WorkingDir
c.Config.WorkingDir = imageConf.WorkingDir
}

Copy link
Contributor

Choose a reason for hiding this comment

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

missing volumes here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update and add.

@pouchrobot pouchrobot added size/XL and removed size/M labels Aug 24, 2018
}); err != nil {
return nil, err
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

put merge funtion before initContainerStorage, make mount points generate completely.

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

Thanks @Ace-Tang for adding the cases for that. But there still need you to update a little thing.

@@ -355,6 +355,18 @@ func (mgr *ContainerManager) Create(ctx context.Context, name string, config *ty
HostConfig: config.HostConfig,
}

// merge image's config into container
if err := container.merge(func() (ocispec.ImageConfig, error) {
img, err := mgr.Client.GetImage(ctx, config.Image)
Copy link
Contributor

Choose a reason for hiding this comment

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

no error check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should ask the one wrote for it, seems like a bug.

assert.NoError(err)

// sort slice

Copy link
Contributor

Choose a reason for hiding this comment

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

remove the empty line

1. add user, labels, stop signal and exposed ports config from image
config in create container.
2. put merge funtion before initContainerStorage, make mount points
generate completely.
3. fix not return error in merge funtion.

Signed-off-by: Ace-Tang <aceapril@126.com>
@fuweid
Copy link
Contributor

fuweid commented Aug 27, 2018

ping @YaoZengzeng and @starnop

could you help us to check this failure case? https://travis-ci.org/alibaba/pouch/jobs/420765951

• Failure [1.013 seconds]
[k8s.io] Security Context
/home/travis/gopath/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:72
  bucket
  /home/travis/gopath/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/security_context.go:280
    runtime should support RunAsUser [It]
    /home/travis/gopath/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/security_context.go:324
    The stdout output of execSync should be 1001
    
    Expected
        <string>: 
    to equal
        <string>: 1001

thanks

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@fuweid fuweid merged commit 10cb5da into AliyunContainerService:master Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants