Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Add amazon EC2 Provider to IaaS #111

Merged
merged 5 commits into from
Jul 25, 2018
Merged

Add amazon EC2 Provider to IaaS #111

merged 5 commits into from
Jul 25, 2018

Conversation

gtsalles
Copy link
Contributor

@gtsalles gtsalles commented Jul 24, 2018

This PR adds support for usage of EC2 from AWS to gofn, simply instantiating a new provider with secret and access keys.

Example to verify execution:
https://github.com/gofn/gofn/tree/improvements/aws_ec2/examples/amazonec2

ref #54

driverOpts.Values["swarm-strategy"] = "spread"
driverOpts.Values["swarm-discovery"] = ""
driverOpts.Values["swarm-master"] = false
driver.SetConfigFromFlags(&driverOpts)

Choose a reason for hiding this comment

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

Error return value of driver.SetConfigFromFlags is not checked

@codecov-io
Copy link

codecov-io commented Jul 24, 2018

Codecov Report

Merging #111 into master will decrease coverage by 1.64%.
The diff coverage is 41.89%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #111      +/-   ##
=========================================
- Coverage   53.55%   51.9%   -1.65%     
=========================================
  Files           5       6       +1     
  Lines         450     524      +74     
=========================================
+ Hits          241     272      +31     
- Misses        185     228      +43     
  Partials       24      24
Impacted Files Coverage Δ
iaas/amazonec2/amazonec2.go 41.89% <41.89%> (ø)

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 1ab1b51...7ad2a61. Read the comment docs.

Copy link
Member

@avelino avelino left a comment

Choose a reason for hiding this comment

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

README.md on examples/amazonec2, I believe it's a place to explain how to use

It would be important to create for the other examples too

driverOpts.Values[f.String()] = false
}
}
// TODO: receive this configs to remove hard coded values
Copy link
Member

Choose a reason for hiding this comment

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

why have this todo ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not the ideal scenario to have this configurations hard coded, instead, we should receive them as parameters, or (my preferred option) get the default values just like the docker-machine binary uses when creating a machine via cli, but honestly, I wasn't able to replicate this behavior.

driverOpts.Values[f.String()] = false
}
}
// TODO: receive this configs to remove hard coded values
Copy link
Member

Choose a reason for hiding this comment

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

you can implement functional option pattern so this values can be override easier. An exemple https://github.com/nuveo/storing/blob/master/awss3/awss3.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.

I don't think I need to override this values, the better approach is just replicate the same default values that docker-machine uses. Right now, they are hard coded, the ideal would be retrieve them somehow, maybe something like the driver.GetCreateFlags() method, but retrieving the swarm values.

@gtsalles gtsalles requested a review from avelino July 25, 2018 17:27
Copy link

@jtemporal jtemporal left a comment

Choose a reason for hiding this comment

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

LGTM

@avelino avelino merged commit 2d4967f into master Jul 25, 2018
@avelino avelino deleted the improvements/aws_ec2 branch July 25, 2018 19:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants