-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
pkg/asset: Add asset for Master machines #491
pkg/asset: Add asset for Master machines #491
Conversation
@abhinavdahiya as promised |
pkg/asset/machines/aws/master.go
Outdated
ClusterName string | ||
AMIID string | ||
Tags map[string]string | ||
Region string |
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.
I think populating this will be more straightforward if we just add an AWSPlatform
property. You could even use DefaultMachinePlatform
instead of your current Machine
.
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.
You could even use DefaultMachinePlatform instead of your current Machine
that opens up the api to vpc, vpccidr block, which might not be ideal
You could even use DefaultMachinePlatform instead of your current Machine.
I don't think that would be correct, we need to account for 3 sources to create the machine.
- installer defaults for unfilled values in install config
- defaultmachineplatform
- machinepoolplatform
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.
that opens up the api to vpc, vpccidr block, which might not be ideal
So create a new type for the shared fields (region and tags, maybe also the AMI?)? You could also push tags and the AMI down into AWSMachinePoolPlatform
, although you'd want to leave a tags entry on AWSPlatform
for tagging non-machine resources. But I'd like to minimize the number of slightly-different phrasings of types in this space if possible.
You could even use
DefaultMachinePlatform
instead of your currentMachine
.I don't think that would be correct, we need to account for 3 sources to create the machine.
- installer defaults for unfilled values in install config
- defaultmachineplatform
- machinepoolplatform
Sorry, I was trying to suggest using the DefaultMachinePlatform
property on a local instance of the AWSPlatform
type. You could fill in that information using all of the usual install-config sources. I agree you don't want to use the install-config AWSPlatform.DefaultMachinePlatform
instance directly.
pkg/asset/machines/aws/zones.go
Outdated
"github.com/aws/aws-sdk-go/service/ec2" | ||
) | ||
|
||
// AvailabilityZones retrieves a list of availability zones for the given region |
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.
nit: this is missing a trailing period (docs).
pkg/asset/machines/aws/master.go
Outdated
resourceVersion: "" | ||
selfLink: "" | ||
items: | ||
{{- range $index,$instance := .Instances}} |
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.
$c.Instances
pkg/asset/machines/aws/zones.go
Outdated
|
||
func ec2Client(region string) (*ec2.EC2, error) { | ||
awsConfig := &aws.Config{Region: aws.String(region)} | ||
s, err := session.NewSession(awsConfig) |
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.
I think we should follow this pattern to create AWS sessions. For example, I can't see the govcloud-us
region or its availability zones.
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.
+1 for session.
/cc @flaper87 |
@abhinavdahiya @flaper87 I've checked this for OpenStack and it looks good to me. The deployment works just as it did before too so there's no breakage as far as I can see. |
6e9f774
to
9d913d2
Compare
9d913d2
to
c9bafcb
Compare
/test golint |
c9bafcb
to
586ad45
Compare
@abhinavdahiya @wking thank you for the review. Comments addressed. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, csrwng The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds ClusterK8sIO from e2dc955 (pkg/asset: add ClusterK8sIO, machines.Worker assets, 2018-10-15, openshift#468) and Master from 586ad45 (pkg/asset: Add asset for Master machines, 2018-10-18, openshift#491). Removes KubeCoreOperator from c9b0e2f (manifests: stop using kube core operator, 2018-10-08, openshift#420). Generated with: $ openshift-install graph | dot -Tsvg >docs/design/resource_dep.svg using: $ dot -V dot - graphviz version 2.30.1 (20170916.1124)
Master machine assets were introduced by openshift#491 to adopt instances generated by tf. There was never a follow up to leverage adoption for fatrther addon features. Unless there's a good reason to keep the adoption, this PR removes the machine API master awareness and assets generation
Generate resources for master machines that can be adopted by the Cluster API machine controller.