(WIP) Machine declaration #2422
base: master
Are you sure you want to change the base?
Conversation
I'm definitely interested. We can't merge it in right away for a variety of reasons, but maybe we can work together towards getting this in an experimental state and then refining it for 0.6.0. |
Yes, This PR is not intended to be merged. I intentionally kept it very basic to start the discussion. Need feedback for same.
|
What's the license on the vendored YAML parser?
My feeling is it should start limited in scope and grow outwardly from there if needed. To that extent, I think it should focus on defining specifications for machines to be created, and then updating the supported configuration (engine labels, swarm, etc.) via SSH if they exist already. Modification of driver parameters after create time should not be permitted. Therefore, I don't want to include any support for Compose or running containers in the first versions.
Ideally, all supported options in the file should be as close as possible to their CLI flag counterparts (using struct tag like ---
- name: test-host0
driver: virtualbox
driveropts:
boot2docker_url: "file:///tmp/boot2docker.iso"
engineoptions:
env:
- HTTP_PROXY="http://example.com:8080"
- HTTPS_PROXY="http://example.com:8080"
- NO_PROXY="192.168.99.101"
opts:
- cluster-advertise=eth1:3376
- cluster-store=consul://192.168.99.101:8500
swarm:
# isswarm is implied by presence of this key
master: true
discovery: consul://192.168.99.101:8500
- name: test-host1
driver: virtualbox
driveropts:
boot2docker_url: "file:///tmp/boot2docker.iso"
engine:
env:
- HTTP_PROXY="http://example.com:8080"
- HTTPS_PROXY="http://example.com:8080"
- NO_PROXY="192.168.99.101"
opts:
- cluster-advertise=eth1:2376
- cluster-store=consul://192.168.99.101:8500
swarm:
discovery: consul://192.168.99.101:8500 It's a bit tricky since I want to be as consistent with compose as we can, so e.g.
I'm not sure what you mean by this. Care to elaborate? |
https://github.com/cloudfoundry-incubator/candiedyaml is Apache 2.0 Licence. The reason why I chose, is usage of this parser in libcompose
I agree. Such features can be added later.
Can we use DockerAPI's. Currently working on a patch that will replace swarm provisioning using Docker API instead of go template based docker commands.
Fine, I will also go through both and come with config file specs.
Here idea was something similar to Before applying changes to host, yaml file can be tested (lint & vet) for possible errors and on success, It can be translated to machine-readable config, tagged with version. (Default action can be auto assigning incremental versions) Benefit of this approach are
|
Oh, awesome. You should make sure to take a look at master. We have vendored the |
I do agree this type of thing could potentially be very useful in the future, however I think for the first versions we should keep scope small and just have something which brings the system to the stated configuration. To get there we already have to:
|
Thanks for update, Will adapt
Fine, lets keep first version simple. And one doubt about execution of host creation.
|
716f345
to
d9b7855
Compare
The PR is updated with changes related to yaml file for review. For driveroptions, changes are done at client side (machine) not required in drivers. So drivers can interpret options, same way as they do currently.
---
- name: localvm3
driver: virtualbox
storage_path: ""
tls_ca_cert: ""
tls_ca_key: ""
tls_client_cert: ""
tls_client_key: ""
github_api_token: ""
native_ssh: false
driveroptions:
boot2docker_url: "file:///tmp/boot2docker.iso"
disk_size: 50000
host_dns_resolver: true
engineoptions:
opt:
- cluster-advertise=eth1:3376
- cluster-store=consul://192.168.99.101:8500
graph_dir: ""
env:
- HTTP_PROXY="http://example.com:8080"
- HTTPS_PROXY="http://example.com:8080"
- NO_PROXY="192.168.99.101"
ipv6: false
insecure_registry: []
label: []
selinux_enabled: false
registry_mirror: []
install_url: ""
swarmoptions:
addr: ""
discovery: consul://192.168.99.101:8500
master: true
host: ""
image: ""
strategy: ""
opt: [] |
d9b7855
to
30f009d
Compare
machines defined in config file to create/Modify Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
30f009d
to
f611070
Compare
Current state of PR.
Need code review. NOTE: provisioning fixed for boot2docker only. |
Just a quick touch base @kunalkushwaha : Because it's such a big feature, I think we are going to have to hold off on adding this until we do some more project planning and defining how it fits with Machine's future (as well as the future of other Docker tools). We'll keep you posted. |
@nathanleclaire Thanks for update :) |
This is draft code for review.
With reference to Issues #773, #2303, This code implements a very basic implementation of
docker-machine apply
command.With this path, One or more machines can be created at one go with
docker-machine apply
command.docker-machine create
command.Need your feedback and start discussion again, so these issues #773 & #2303 can be focused.
A sample yaml config file as below it understands.