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

feature: add spec annotation flag #1046

Merged
merged 1 commit into from
Apr 7, 2018
Merged

feature: add spec annotation flag #1046

merged 1 commit into from
Apr 7, 2018

Conversation

Ace-Tang
Copy link
Contributor

@Ace-Tang Ace-Tang commented Apr 3, 2018

spec annotation flag pass all user defined runtime annotation to
runtime, note that whether the annotation will take effect depend
on your runtime inplement.

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

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@Ace-Tang
Copy link
Contributor Author

Ace-Tang commented Apr 3, 2018

Use this specify flag make the previous steps more simple.

  1. do not need to parse specify label format.
  2. do not need add more logic in hook.
  3. since hook or something need to transfer label to annontation, and this annotation need to be add into spec in setupAnnotations, we can simplely add annotation passed by flag spec-annotation in setupAnnotations.

@codecov-io
Copy link

codecov-io commented Apr 3, 2018

Codecov Report

Merging #1046 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1046      +/-   ##
==========================================
- Coverage   15.68%   15.64%   -0.04%     
==========================================
  Files         139      139              
  Lines        8499     8518      +19     
==========================================
  Hits         1333     1333              
- Misses       7066     7085      +19     
  Partials      100      100
Impacted Files Coverage Δ
daemon/mgr/spec_annotations.go 0% <0%> (ø) ⬆️
cli/container.go 35.16% <0%> (-1.62%) ⬇️
cli/common_flags.go 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f08833b...e3be267. Read the comment docs.

@allencloud allencloud changed the title featrue: add spec annotation flag feature: add spec annotation flag Apr 3, 2018
@yyb196
Copy link
Collaborator

yyb196 commented Apr 3, 2018

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Apr 3, 2018
@@ -108,6 +108,9 @@ type ContainerConfig struct {

// The working directory for commands to run in.
WorkingDir string `json:"WorkingDir,omitempty"`

// Annotations send to runtime spec.
SpecAnnotation map[string]string `json:"SpecAnnotation,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add this in swagger.yml.

@Ace-Tang
Copy link
Contributor Author

Ace-Tang commented Apr 3, 2018

do we need show SpecAnnotation in pouch inspect.

@allencloud
Copy link
Collaborator

do we need show SpecAnnotation in pouch inspect.

Yes, I think so. @Ace-Tang

@allencloud
Copy link
Collaborator

Please add some unit test for the function validateAnnotation and add integration test for the field.

apis/swagger.yml Outdated
@@ -1751,6 +1751,11 @@ definitions:
x-nullable: true
additionalProperties:
type: "string"
SpecAnnotation:
description: "nnotations send to runtime spec."
Copy link
Collaborator

@rudyfly rudyfly Apr 4, 2018

Choose a reason for hiding this comment

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

s/nnotations/annotations ?

@pouchrobot pouchrobot added size/L and removed size/M labels Apr 4, 2018
Copy link
Collaborator

@rudyfly rudyfly left a comment

Choose a reason for hiding this comment

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

See comments

@Ace-Tang
Copy link
Contributor Author

Ace-Tang commented Apr 4, 2018

@allencloud @rudyfly , has updated. About validate* functions test, I wanna add unit tests for these kind functions in other pr.

@allencloud allencloud dismissed their stale review April 4, 2018 06:30

dismiss

res.Assert(c, icmd.Success)
defer DelContainerForceMultyTime(c, name)

command.PouchRun("start", name).Assert(c, icmd.Success)
Copy link
Collaborator

@allencloud allencloud Apr 4, 2018

Choose a reason for hiding this comment

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

I think after start, we need to check these annotation as well with pouch inspect.

In addition , I think we need to inspect after create, and then start

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 has been done in test/cli_run_test.go

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, I do not think they are the same. They have called the same API, but in cli side, they called different code. Double check would be nicer to guarantee the code quality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Follow the previous logic, inspect test in doing in cli_run_test.go, not in start test, as I agree with you, this also related all test case in test/cli_start_test.go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh! I miss create test, this things should be done there too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated. @allencloud

@allencloud
Copy link
Collaborator

This pr will be related to pr #1041. If this is merged first, #1041 needs rebased. @HusterWan

@HusterWan
Copy link
Contributor

got it

spec annotation flag pass all user defined runtime annotation to
runtime, note that whether the annotation will take effect depend
on your runtime inplement.

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

LGTM, too.

@allencloud allencloud merged commit 3136664 into AliyunContainerService:master Apr 7, 2018
@Ace-Tang Ace-Tang deleted the annotation branch April 8, 2018 02:11
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/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants