Skip to content

Conversation

@Ace-Tang
Copy link
Contributor

@Ace-Tang Ace-Tang commented Aug 13, 2018

support runtime args pass to pouchd, like:

{
    "runtimes": {
        "cc-runtime": {
            "path": "/usr/local/bin/cc-runtime",
            "runtimeArgs": [
                "--log=/var/log/cc-runtime.log",
                "--cc-config=/etc/clear-containers/configuration.toml"
        ]
    }
}

Signed-off-by: Ace-Tang [email protected]

Ⅰ. Describe what this PR did

support runtime args set in config.
CI test not suit for this case, since it depend on more runtimes. And the function can be verified in unit test.

Ⅱ. Does this pull request fix one issue?

fixes #2081
fixes #2094

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Aug 13, 2018

Codecov Report

Merging #2085 into master will decrease coverage by 0.07%.
The diff coverage is 57.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2085      +/-   ##
==========================================
- Coverage      65%   64.93%   -0.08%     
==========================================
  Files         209      210       +1     
  Lines       16227    16257      +30     
==========================================
+ Hits        10548    10556       +8     
- Misses       4370     4384      +14     
- Partials     1309     1317       +8
Flag Coverage Δ
#criv1alpha1test 33.38% <45.45%> (+0.01%) ⬆️
#criv1alpha2test 33.94% <45.45%> (-0.06%) ⬇️
#integrationtest 39.91% <45.45%> (+0.02%) ⬆️
#unittest 23.52% <24.24%> (-0.3%) ⬇️
Impacted Files Coverage Δ
daemon/mgr/container_types.go 81.39% <ø> (ø) ⬆️
daemon/daemon.go 58.15% <0%> (-0.64%) ⬇️
daemon/config/config.go 48.75% <100%> (+1.83%) ⬆️
daemon/mgr/container.go 55.56% <33.33%> (-0.28%) ⬇️
daemon/mgr/container_utils.go 83.44% <60%> (-1.74%) ⬇️
daemon/daemon_utils.go 62.5% <62.5%> (ø)
apis/server/utils.go 61.9% <0%> (-4.77%) ⬇️
ctrd/image.go 76.75% <0%> (-2.2%) ⬇️
cri/v1alpha2/cri.go 64.89% <0%> (-0.18%) ⬇️
... and 1 more

dataSlice = append(dataSlice, arg)
}

if err := ioutil.WriteFile(script, []byte(strings.Join(dataSlice, " ")), runtimeScriptPerm); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

All of the parameters should be passed to the runtime. Could you please add $@ to the script?

"path/filepath"
"strings"

"github.com/alibaba/pouch/apis/types"
Copy link
Collaborator

@allencloud allencloud Aug 13, 2018

Choose a reason for hiding this comment

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

I do not think a package in pkg should import package github.com/alibaba/pouch/apis/types. If we must do, I am afraid moving this package out of pkg is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, if need.

data := fmt.Sprintf("#!/bin/sh\n%s %s $@\n", r.Path, strings.Join(r.RuntimeArgs, " "))

if err := ioutil.WriteFile(script, []byte(data), runtimeScriptPerm); err != nil {
return fmt.Errorf("failed to create runtime script %s: %s", script, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In this place you directly return the error, while some data in pouchd has been changed, for example, runtimePaths.
In this case, do we need to revert the change of runtimePaths ? just double 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.

if fails here, daemon won't start.

Copy link
Collaborator

Choose a reason for hiding this comment

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

if fails here, daemon won't start.

Oh, that quite makes sense. Thanks.

return path
}

return runtime
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it does not exist, return the input runtime?
Will it influence the following code of the calling function GetPath ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

runtimePaths only keep runtime with path or args

@allencloud
Copy link
Collaborator

Can we add some integration test for this? @Ace-Tang

@Ace-Tang
Copy link
Contributor Author

@allencloud , CI test not suit for this case, since it depend on more runtimes.

support runtime args pass to pouchd, like
{
    "runtimes": {
        "cc-runtime": {
            "path": "/usr/local/bin/cc-runtime",
            "runtimeArgs": [
                "--log=/var/log/cc-runtime.log",
                "--cc-config=/etc/clear-containers/configuration.toml"
        ]
    }
}

Signed-off-by: Ace-Tang <[email protected]>
@Ace-Tang
Copy link
Contributor Author

@allencloud , updated, since runtime not suit for a single package, I move the code into daemon/mgr.

@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Aug 14, 2018
@allencloud allencloud merged commit a4ecf83 into AliyunContainerService:master Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pouch start fail cause unknown flag "path" in runtime config [feature request] support runtimeArgs of configuration

5 participants