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

Adds mem_limit support for conversion #414

Merged
merged 1 commit into from
Feb 22, 2017
Merged

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Feb 6, 2017

This commit adds mem_limit support. Taking the value from
docker-compose.yaml and converting it to it's associative value in
Kubernetes artifacts.

Closes (half) of
#267

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 6, 2017
ExposeService string `compose:"kompose.service.expose",bundle:""`
Stdin bool `compose:"stdin_open",bundle:""`
Tty bool `compose:"tty",bundle:""`
MemLimit yaml.MemStringorInt `compose:"mem_limit",bundle:""`
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this was gofmt fixing the indenting since yaml.MemStringorInt is longer than the other values. Only thing that's changed is the bottom.

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to have MemLimit as int here and convert it to in loader. This is how it is done for CPUShare and CPUQuota, it would be nice to have it in same way for this.

@cdrage
Copy link
Member Author

cdrage commented Feb 6, 2017

You can check this out if you wish @containscafeine

@surajssd
Copy link
Member

surajssd commented Feb 8, 2017

Docs remaining specifying what this is gonna do exactly in kubernetes like this will be only limits and for k8s requests folks could do it by hand.

or start using docker-compose v3. Because it has a way to define what is request and what is limit. But kompose has no support for v3 yet. source https://docs.docker.com/compose/compose-file/#/deploy

@cdrage
Copy link
Member Author

cdrage commented Feb 8, 2017

@surajssd

Yeah, we need docs that outline what is supported when converting from docker compose to kubernetes and how it's converted.

I don't think we should use v3 just yet, let's wait until libcompose supports it. Most people are just on v1/v2 right now :)

@cdrage
Copy link
Member Author

cdrage commented Feb 8, 2017

The doc can come in a different PR.

@surajssd
Copy link
Member

surajssd commented Feb 9, 2017

IMO doc should go in same PR otherwise it's hard to track later what is documented and what is not.

ExposeService string `compose:"kompose.service.expose",bundle:""`
Stdin bool `compose:"stdin_open",bundle:""`
Tty bool `compose:"tty",bundle:""`
MemLimit yaml.MemStringorInt `compose:"mem_limit",bundle:""`
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to have MemLimit as int here and convert it to in loader. This is how it is done for CPUShare and CPUQuota, it would be nice to have it in same way for this.

Network: []string{"network1", "network2"}, // not supported
Labels: nil,
Annotations: map[string]string{"abc": "def"},
CPUSet: "cpu_set", // not supported
Copy link
Member

Choose a reason for hiding this comment

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

comment here says "not supported" but compose supports CPU* no?

Copy link
Member

Choose a reason for hiding this comment

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

the value is accepted but nothing good is done about it!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. Values remain there for consistency across tests.

Copy link
Member

Choose a reason for hiding this comment

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

Ahh, OK than.
I just saw that we are loading into kobject, but didn't realise that we do nothing with it afterwords. That is confusing :-)

@cdrage
Copy link
Member Author

cdrage commented Feb 9, 2017

@kadel Can't comment on your other comment for some reason, but the reasoning for yaml.MemStringorInt is it that libcompsose has a built-in function for converting the values already which works beautifully.

For example: 10Mb, 10MB, 1e+7 or 100000 are all valid entries in docker-compose for mem_limit. These values automatically convert to Kubernetes without an issue. Hence the intOrString.

@cdrage
Copy link
Member Author

cdrage commented Feb 9, 2017

@cdrage
Copy link
Member Author

cdrage commented Feb 16, 2017

Hey @kadel we're you able to look at this again?

@kadel
Copy link
Member

kadel commented Feb 17, 2017

Ahh, sorry @cdrage I somehow missed your comments :-(

👍 OK than it makes sense.

LGTM

@kadel
Copy link
Member

kadel commented Feb 17, 2017

there are conflicts in compose.go :-( @surajssd updated it recently in #428

@cdrage
Copy link
Member Author

cdrage commented Feb 17, 2017

@kadel Yeah, I'm working on the Google doc in regards to conversion, so that'll come up soon :)

Yup! I'll rebase and ping you again.

@cdrage
Copy link
Member Author

cdrage commented Feb 21, 2017

Rebased, ready for another quick look-over / review! @kadel @surajssd @containscafeine

This commit adds mem_limit support. Taking the value from
docker-compose.yaml and converting it to it's associative value in
Kubernetes artifacts.

Closes (half) of
kubernetes#267
@kadel
Copy link
Member

kadel commented Feb 22, 2017

I've created issue so we doesn't forget to document this. #435

@kadel kadel merged commit 3488416 into kubernetes:master Feb 22, 2017
Copy link
Member

@surajssd surajssd left a comment

Choose a reason for hiding this comment

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

It seems like we missed out on the OpenShift functional tests here ?

@cdrage cdrage deleted the add-mem-limit branch March 30, 2017 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants