Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Maas instance plugin #411

Merged
merged 6 commits into from Feb 28, 2017
Merged

Maas instance plugin #411

merged 6 commits into from Feb 28, 2017

Conversation

YujiOshima
Copy link
Contributor

Support BareMetal deployment.
An Instance plugin for Canonical MaaS node.
#398

Signed-off-by: Yuji Oshima <yuji.oshima0x3fd@gmail.com>
Signed-off-by: Yuji Oshima <yuji.oshima0x3fd@gmail.com>
Signed-off-by: Yuji Oshima <yuji.oshima0x3fd@gmail.com>
@codecov-io
Copy link

codecov-io commented Feb 23, 2017

Codecov Report

Merging #411 into master will decrease coverage by -1.07%.
The diff coverage is 43.92%.

@@            Coverage Diff             @@
##           master     #411      +/-   ##
==========================================
- Coverage   62.91%   61.85%   -1.07%     
==========================================
  Files          62       64       +2     
  Lines        3613     3827     +214     
==========================================
+ Hits         2273     2367      +94     
- Misses       1089     1172      +83     
- Partials      251      288      +37
Impacted Files Coverage Δ
examples/instance/maas/main.go 0% <0%> (ø)
examples/instance/maas/instance.go 48.7% <48.7%> (ø)

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 291de15...dea4488. Read the comment docs.

@chungers
Copy link
Contributor

@YujiOshima - nice work. Just a general question... does MAAS support the notion of detachable disk / volumes? At least with the AWS plugin at https://github.com/docker/infrakit.aws it understands the Attachment of type ebs. This ability is very interesting for cases of supporting stateful instances where attachable volumes store state and instances can come and go.

Does this model make sense for MAAS or for bare-metal where disks/volumes can be attached /detached from compute instances?

@YujiOshima
Copy link
Contributor Author

@chungers Thank you!
That's good idea and important function for common "Pet" use case in the on-premises ! I didn't test that use case, but I think It can be done with iSCSI.
I will try to support volume store along with other functions. Now MaaS plugin is very incomplete, should be enhanced step by step.

@Lennie
Copy link

Lennie commented Feb 23, 2017

In the meantime you could always use Docker volume plugin. For example just have 1 NFS share and create sub directories in your container when they don't exist yet. That way you don't need to request a share.

@YujiOshima
Copy link
Contributor Author

@Lennie Thank you for the comment. Only for docker swarm flavor and an app in the docker container, It is true. But for other flavor or outside of docker container (I don't know the specific use case, may be docker daemon config or something), you need Infrakit volume management.

@Lennie
Copy link

Lennie commented Feb 23, 2017

Just saying workarounds are possible if you need to deploy soon and can't wait. Or need something for a dev. env. on a laptop. Also just realized you can create NFS server as a docker container as well.

But would be great to have a proper option for MAAS. But also don't forget the dev. laptop.

@YujiOshima
Copy link
Contributor Author

@Lennie Thank you for a good point. Yes, we need to do a lot of things before volume management.
At first I think that we can restrict the scope to only docker swarm or vanilla flavor.

Set up nodes.

```
./setup-nodes.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file included in this PR? I don't see it. Would you mind including it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I update the Readme. Now I have only a simple document, but I will enhance it with the addition of functions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I was confused. This is a file from your repo... I see now, so there's no need to include this.

if err != nil {
return err
}
return ioutil.WriteFile(tagFile, encoded.Bytes(), 0666)
Copy link
Contributor

Choose a reason for hiding this comment

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

Files are written locally to store tags... is there a way in MAAS to tag resources and query by tags? https://docs.ubuntu.com/maas/2.1/en/intro-concepts#tags

If we can reduce amount of state we need store locally, the better. If there are ways to do tagging via the MAAS api, then we should consider making that change in a future PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that is a better implementation. This time we implemented it in a simple way that does not depend on the api version, but we will change the information to keep it in a robust way without duplication.

}

// DescribeInstances returns descriptions of all instances matching all of the provided tags.
func (m maasPlugin) DescribeInstances(tags map[string]string) ([]instance.Description, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment above -- is there a way in MAAS to query by tags of the nodes? Using files here is ok but we'd have to make sure these files are highly available.

@@ -0,0 +1,24 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is named .yml but the content is a JSON...

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..This is a mistake. Fixed.

Signed-off-by: Yuji Oshima <yuji.oshima0x3fd@gmail.com>
@chungers
Copy link
Contributor

chungers commented Feb 26, 2017

@YujiOshima - Before I can merge this PR, can you please add a few tests? You can look at the plugin_test.go in the terraform plugin as an example?

Also, once this PR is accepted, would you mind open an issue (and assign to yourself) on improving this plugin by using MAAS tagging API to implement the instance state persistence? I want to make sure that if we accept this PR, this plugin will continue to be improved and is useful for those learning to work with InfraKit. Thank you!

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/docker/docker/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "maas" git@github.com:YujiOshima/infrakit.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354523656
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

Signed-off-by: Yuji Oshima <yuji.oshima0x3fd@gmail.com>
@YujiOshima
Copy link
Contributor Author

@chungers Yeah! I added a few tests!

open an issue

Of course! I will do so soon. And I want to proceed while discussing.

@YujiOshima
Copy link
Contributor Author

I used a gomaasapi.testservice for test this plugin.
You can test using this for the basic function of MasS.

Copy link
Contributor

@chungers chungers left a comment

Choose a reason for hiding this comment

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

LGTM -- Let's get this merged in and we can start iterating on this. We can incubate this plugin in this repo and spin it off to a separate project when it's ready.

@chungers chungers merged commit c0f3d59 into docker-archive:master Feb 28, 2017
chungers pushed a commit to chungers/infrakit that referenced this pull request Sep 30, 2017
Added support for dynamic DDC generation
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants