forked from openshift/installer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/types: Push platform-specific types (AWS, etc.) into subdirs
This decouples our platforms a bit and makes it easier to distinguish between platform-specific and platform-agnostic code. It also gives us much more compact struct names, since now we don't need to distinguish between many flavors of machine pool, etc. in a single package. I've also updated pkg/types/doc.go; pkg/types includes more than user-specified configuration since 78c3118 (pkg: add ClusterMetadata asset,type that can be used for destroy, 2018-09-25, openshift#324). I've also added OWNERS files for some OpenStack-specific directories that were missing them before. There's still more work to go in this direction (e.g. pushing default logic into subdirs), but this seems like a reasonable chunk.
- Loading branch information
Showing
30 changed files
with
343 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md | ||
# This file just uses aliases defined in OWNERS_ALIASES. | ||
|
||
approvers: | ||
- openstack-approvers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md | ||
# This file just uses aliases defined in OWNERS_ALIASES. | ||
|
||
approvers: | ||
- openstack-approvers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Package aws contains AWS-specific structures for installer | ||
// configuration and management. | ||
package aws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package aws | ||
|
||
// MachinePool stores the configuration for a machine pool installed | ||
// on AWS. | ||
type MachinePool struct { | ||
// Zones is list of availability zones that can be used. | ||
Zones []string `json:"zones,omitempty"` | ||
|
||
// AMIID defines the AMI that should be used. | ||
AMIID string `json:"amiID,omitempty"` | ||
|
||
// InstanceType defines the ec2 instance type. | ||
// eg. m4-large | ||
InstanceType string `json:"type"` | ||
|
||
// IAMRoleName defines the IAM role associated | ||
// with the ec2 instance. | ||
IAMRoleName string `json:"iamRoleName"` | ||
|
||
// EC2RootVolume defines the storage for ec2 instance. | ||
EC2RootVolume `json:"rootVolume"` | ||
} | ||
|
||
// Set sets the values from `required` to `a`. | ||
func (a *MachinePool) Set(required *MachinePool) { | ||
if required == nil || a == nil { | ||
return | ||
} | ||
|
||
if len(required.Zones) > 0 { | ||
a.Zones = required.Zones | ||
} | ||
if required.AMIID != "" { | ||
a.AMIID = required.AMIID | ||
} | ||
if required.InstanceType != "" { | ||
a.InstanceType = required.InstanceType | ||
} | ||
if required.IAMRoleName != "" { | ||
a.IAMRoleName = required.IAMRoleName | ||
} | ||
|
||
if required.EC2RootVolume.IOPS != 0 { | ||
a.EC2RootVolume.IOPS = required.EC2RootVolume.IOPS | ||
} | ||
if required.EC2RootVolume.Size != 0 { | ||
a.EC2RootVolume.Size = required.EC2RootVolume.Size | ||
} | ||
if required.EC2RootVolume.Type != "" { | ||
a.EC2RootVolume.Type = required.EC2RootVolume.Type | ||
} | ||
} | ||
|
||
// EC2RootVolume defines the storage for an ec2 instance. | ||
type EC2RootVolume struct { | ||
// IOPS defines the iops for the instance. | ||
IOPS int `json:"iops"` | ||
// Size defines the size of the instance. | ||
Size int `json:"size"` | ||
// Type defines the type of the instance. | ||
Type string `json:"type"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package aws | ||
|
||
// Metadata contains AWS metadata (e.g. for uninstalling the cluster). | ||
type Metadata struct { | ||
Region string `json:"region"` | ||
|
||
// Identifier holds a slice of filter maps. The maps hold the | ||
// key/value pairs for the tags we will be matching against. A | ||
// resource matches the map if all of the key/value pairs are in its | ||
// tags. A resource matches Identifier if it matches any of the maps. | ||
Identifier []map[string]string `json:"identifier"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package aws | ||
|
||
// Platform stores all the global configuration that all machinesets | ||
// use. | ||
type Platform struct { | ||
// Region specifies the AWS region where the cluster will be created. | ||
Region string `json:"region"` | ||
|
||
// UserTags specifies additional tags for AWS resources created for the cluster. | ||
UserTags map[string]string `json:"userTags,omitempty"` | ||
|
||
// DefaultMachinePlatform is the default configuration used when | ||
// installing on AWS for machine pools which do not define their own | ||
// platform configuration. | ||
DefaultMachinePlatform *MachinePool `json:"defaultMachinePlatform,omitempty"` | ||
|
||
// VPCID specifies the vpc to associate with the cluster. | ||
// If empty, new vpc will be created. | ||
// +optional | ||
VPCID string `json:"vpcID"` | ||
|
||
// VPCCIDRBlock | ||
// +optional | ||
VPCCIDRBlock string `json:"vpcCIDRBlock"` | ||
} |
Oops, something went wrong.