-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add docker resource constraints for CPU and Memory #28
Conversation
@@ -34,9 +37,10 @@ type dockerHandle struct { | |||
doneCh chan struct{} | |||
} | |||
|
|||
func NewDockerDriver(logger *log.Logger) Driver { | |||
func NewDockerDriver(logger *log.Logger, config *config.Config) Driver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yo dawg I heard you like configs
@cbednarski the code looks good. So the reason we are threading the config into the drivers now is so that we can get the image name for the docker containers? |
@@ -59,17 +63,81 @@ func (d *DockerDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool | |||
return true, nil | |||
} | |||
|
|||
// containerOptionsForTask initializes a strcut needed to call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "strcut" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, should be "struct".
Small comments, otherwise 👍 |
@ryanuber No, the image name is provided through the task configuration. The driver configuration is tells the docker client which socket to use to connect to the docker daemon. By default this is a unix socket at I think it's inevitable that Docker and other drivers will need additional config options as we go. |
- Add validation that Resources.MemoryMB and Resources.CPU have non-zero values - Change log calls to use logger whenever possible - Change log format to add colon after driver.docker
Add docker resource constraints for CPU and Memory
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This encapsulates #23
This PR includes a basic implementation for Docker CPU and Memory constraints.
Also, the start container call is now implemented using a native go docker API client (fsouza/go-dockerclient).