Documentation
¶
Overview ¶
Package adapter contains the required logic for creating data structures used for feeding CloudFormation templates.
It follows the adapter pattern https://en.wikipedia.org/wiki/Adapter_pattern in the sense that it has the knowledge to transform a aws custom object into a data structure easily interpolable into the templates without any additional view logic.
There's a base template in `service/templates/cloudformation/guest/main.yaml` which defines the basic structure and includes the rest of templates that form the stack as nested templates. Those subtemplates should use a `define` action with the name that will be used to refer to them from the main template, as explained here https://golang.org/pkg/text/template/#hdr-Nested_template_definitions
Each adapter is related to one of these nested templates. It includes the data structure with all the values needed to interpolate in the related template and the logic required to obtain them, this logic is packed into functions called `hydraters`.
When extending the stack we will just need to: * Add the template file in `service/template/cloudformation/guest` and modify `service/template/cloudformation/main.yaml` to include the new template. * Add the adapter logic file in `service/resource/cloudformation/adapter` with the type definition and the Hydrater function to fill the fields (like asg.go or launch_configuration.go). * Add the new type to the Adapter type in `service/resource/cloudformation/adapter/adapter.go` and include the Hydrater function in the `hydraters` slice.
Index ¶
- func IsEmptyAmazonAccountID(err error) bool
- func IsInvalidConfig(err error) bool
- func IsMalformedAmazonAccountID(err error) bool
- func IsNotFound(err error) bool
- func IsTooFewResults(err error) bool
- func IsTooManyResults(err error) bool
- func IsWrongAmazonAccountIDLength(err error) bool
- func IsWrongType(err error) bool
- type APIWhitelist
- type Adapter
- type Config
- type Gateway
- type GuestAdapter
- type GuestIAMPoliciesAdapter
- type GuestInstanceAdapter
- type GuestInstanceAdapterCluster
- type GuestInstanceAdapterImage
- type GuestInstanceAdapterMaster
- type GuestInstanceAdapterMasterDockerVolume
- type GuestInstanceAdapterMasterEtcdVolume
- type GuestInstanceAdapterMasterInstance
- type GuestInstanceAdapterMasterLogVolume
- type GuestInternetGatewayAdapter
- type GuestInternetGatewayAdapterInternetGateway
- type GuestLoadBalancersAdapter
- type GuestLoadBalancersAdapterPortPair
- type GuestNATGatewayAdapter
- type GuestOutputsAdapter
- type GuestOutputsAdapterMaster
- type GuestOutputsAdapterMasterDockerVolume
- type GuestOutputsAdapterMasterInstance
- type GuestRecordSetsAdapter
- type GuestRouteTablesAdapter
- type GuestSecurityGroupsAdapter
- type GuestSubnetsAdapter
- type GuestVPCAdapter
- type Hydrater
- type NATRoute
- type RouteTableAssociation
- type RouteTableName
- type SmallCloudconfigConfig
- type StackState
- type Subnet
- type Whitelist
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsEmptyAmazonAccountID ¶
IsEmptyAmazonAccountID asserts emptyAmazonAccountIDError.
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func IsMalformedAmazonAccountID ¶
IsMalformedAmazonAccountID asserts malformedAmazonAccountIDError.
func IsTooFewResults ¶
IsTooFewResults asserts tooFewResultsError.
func IsTooManyResults ¶
IsTooManyResults asserts tooManyResultsError.
func IsWrongAmazonAccountIDLength ¶
IsWrongAmazonAccountIDLength asserts wrongAmazonAccountIDLengthError.
Types ¶
type APIWhitelist ¶
APIWhitelist defines guest cluster k8s public/private api whitelisting.
type Adapter ¶
type Adapter struct {
Guest GuestAdapter
}
type Config ¶
type Config struct {
APIWhitelist APIWhitelist
AWSRegion string
ControlPlaneAccountID string
ControlPlaneNATGatewayAddresses []*ec2.Address
ControlPlanePeerRoleARN string
ControlPlaneVPCID string
ControlPlaneVPCCidr string
CustomObject v1alpha1.Cluster
EncrypterBackend string
GuestAccountID string
InstallationName string
PublicRouteTables string
Route53Enabled bool
StackState StackState
TenantClusterAccountID string
TenantClusterKMSKeyARN string
TenantClusterAvailabilityZones []controllercontext.ContextSpecTenantClusterTCCPAvailabilityZone
}
type GuestAdapter ¶
type GuestAdapter struct {
IAMPolicies GuestIAMPoliciesAdapter
InternetGateway GuestInternetGatewayAdapter
Instance GuestInstanceAdapter
LoadBalancers GuestLoadBalancersAdapter
NATGateway GuestNATGatewayAdapter
Outputs GuestOutputsAdapter
RecordSets GuestRecordSetsAdapter
RouteTables GuestRouteTablesAdapter
SecurityGroups GuestSecurityGroupsAdapter
Subnets GuestSubnetsAdapter
VPC GuestVPCAdapter
}
type GuestIAMPoliciesAdapter ¶
type GuestIAMPoliciesAdapter struct {
ClusterID string
EC2ServiceDomain string
KMSKeyARN string
MasterRoleName string
MasterPolicyName string
MasterProfileName string
RegionARN string
S3Bucket string
}
func (*GuestIAMPoliciesAdapter) Adapt ¶
func (i *GuestIAMPoliciesAdapter) Adapt(cfg Config) error
type GuestInstanceAdapter ¶
type GuestInstanceAdapter struct {
Cluster GuestInstanceAdapterCluster
Image GuestInstanceAdapterImage
Master GuestInstanceAdapterMaster
}
func (*GuestInstanceAdapter) Adapt ¶
func (i *GuestInstanceAdapter) Adapt(config Config) error
type GuestInstanceAdapterCluster ¶
type GuestInstanceAdapterCluster struct {
ID string
}
type GuestInstanceAdapterImage ¶
type GuestInstanceAdapterImage struct {
ID string
}
type GuestInstanceAdapterMaster ¶
type GuestInstanceAdapterMaster struct {
AZ string
CloudConfig string
EncrypterBackend string
DockerVolume GuestInstanceAdapterMasterDockerVolume
EtcdVolume GuestInstanceAdapterMasterEtcdVolume
LogVolume GuestInstanceAdapterMasterLogVolume
Instance GuestInstanceAdapterMasterInstance
PrivateSubnet string
}
type GuestInstanceAdapterMasterEtcdVolume ¶
type GuestInstanceAdapterMasterEtcdVolume struct {
Name string
}
type GuestInstanceAdapterMasterLogVolume ¶
type GuestInstanceAdapterMasterLogVolume struct {
Name string
}
type GuestInternetGatewayAdapter ¶
type GuestInternetGatewayAdapter struct {
ClusterID string
InternetGateways []GuestInternetGatewayAdapterInternetGateway
}
func (*GuestInternetGatewayAdapter) Adapt ¶
func (a *GuestInternetGatewayAdapter) Adapt(cfg Config) error
type GuestLoadBalancersAdapter ¶
type GuestLoadBalancersAdapter struct {
APIElbHealthCheckTarget string
APIElbName string
APIInternalElbName string
APIElbPortsToOpen []GuestLoadBalancersAdapterPortPair
APIElbScheme string
APIInternalElbScheme string
APIElbSecurityGroupID string
EtcdElbHealthCheckTarget string
EtcdElbName string
EtcdElbPortsToOpen []GuestLoadBalancersAdapterPortPair
EtcdElbScheme string
EtcdElbSecurityGroupID string
ELBHealthCheckHealthyThreshold int
ELBHealthCheckInterval int
ELBHealthCheckTimeout int
ELBHealthCheckUnhealthyThreshold int
IngressElbHealthCheckTarget string
IngressElbName string
IngressElbPortsToOpen []GuestLoadBalancersAdapterPortPair
IngressElbScheme string
MasterInstanceResourceName string
PublicSubnets []string
PrivateSubnets []string
}
func (*GuestLoadBalancersAdapter) Adapt ¶
func (a *GuestLoadBalancersAdapter) Adapt(cfg Config) error
type GuestNATGatewayAdapter ¶
func (*GuestNATGatewayAdapter) Adapt ¶
func (a *GuestNATGatewayAdapter) Adapt(cfg Config) error
type GuestOutputsAdapter ¶
type GuestOutputsAdapter struct {
Master GuestOutputsAdapterMaster
OperatorVersion string
Route53Enabled bool
}
func (*GuestOutputsAdapter) Adapt ¶
func (a *GuestOutputsAdapter) Adapt(config Config) error
type GuestOutputsAdapterMaster ¶
type GuestOutputsAdapterMaster struct {
ImageID string
Instance GuestOutputsAdapterMasterInstance
DockerVolume GuestOutputsAdapterMasterDockerVolume
}
type GuestOutputsAdapterMasterDockerVolume ¶
type GuestOutputsAdapterMasterDockerVolume struct {
ResourceName string
}
type GuestRecordSetsAdapter ¶
type GuestRecordSetsAdapter struct {
BaseDomain string
EtcdDomain string
ClusterID string
MasterInstanceResourceName string
Route53Enabled bool
VPCRegion string
}
func (*GuestRecordSetsAdapter) Adapt ¶
func (a *GuestRecordSetsAdapter) Adapt(config Config) error
type GuestRouteTablesAdapter ¶
type GuestRouteTablesAdapter struct {
HostClusterCIDR string
PrivateRouteTableNames []RouteTableName
PublicRouteTableNames []RouteTableName
}
func (*GuestRouteTablesAdapter) Adapt ¶
func (r *GuestRouteTablesAdapter) Adapt(cfg Config) error
type GuestSecurityGroupsAdapter ¶
type GuestSecurityGroupsAdapter struct {
APIInternalELBSecurityGroupName string
APIInternalELBSecurityGroupRules []securityGroupRule
APIWhitelistEnabled bool
PrivateAPIWhitelistEnabled bool
MasterSecurityGroupName string
MasterSecurityGroupRules []securityGroupRule
IngressSecurityGroupName string
IngressSecurityGroupRules []securityGroupRule
EtcdELBSecurityGroupName string
EtcdELBSecurityGroupRules []securityGroupRule
}
func (*GuestSecurityGroupsAdapter) Adapt ¶
func (s *GuestSecurityGroupsAdapter) Adapt(cfg Config) error
type GuestSubnetsAdapter ¶
func (*GuestSubnetsAdapter) Adapt ¶
func (s *GuestSubnetsAdapter) Adapt(cfg Config) error
type GuestVPCAdapter ¶
type GuestVPCAdapter struct {
CidrBlock string
ClusterID string
InstallationName string
HostAccountID string
PeerVPCID string
PeerRoleArn string
Region string
RegionARN string
RouteTableNames []RouteTableName
}
func (*GuestVPCAdapter) Adapt ¶
func (v *GuestVPCAdapter) Adapt(cfg Config) error
type RouteTableAssociation ¶
type RouteTableName ¶
type SmallCloudconfigConfig ¶
type SmallCloudconfigConfig struct {
S3URL string
}
SmallCloudconfigConfig represents the data structure required for executing the small cloudconfig template.
type StackState ¶
type StackState struct {
Name string
DockerVolumeResourceName string
MasterImageID string
MasterInstanceType string
MasterInstanceResourceName string
MasterInstanceMonitoring bool
OperatorVersion string
}
TODO we copy this because of a circular import issue with the cloudformation resource. The way how the resource works with the adapter and how infromation is passed has to be reworked at some point. Just hacking this now to keep going and to keep the changes as minimal as possible.