Documentation
¶
Index ¶
- func CheckKubernetesCIDRs(sess *session.Session, existingVPCID, podCIDR, serviceCIDR string) error
- func CheckSubnetsAgainstExistingVPC(sess *session.Session, existingVPCID string, ...) error
- func GetDefaultSubnets(sess *session.Session, vpcCIDR string) ([]VPCSubnet, []VPCSubnet, error)
- func GetVPCSubnets(sess *session.Session, vpcID string) ([]VPCSubnet, []VPCSubnet, error)
- func PopulateCIDRs(sess *session.Session, existingVPCID string, ...) error
- func ValidateKubernetesCIDRs(vpcCIDR, podCIDR, serviceCIDR string) error
- func ValidateSubnets(vpcCIDR string, subnets []VPCSubnet) error
- type AwsBucket
- type Cluster
- type Config
- type ETCDInstance
- type SecretAssets
- type Status
- type Tag
- type VPCSubnet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckKubernetesCIDRs ¶
CheckKubernetesCIDRs validates an existing VPC, pod, and service CIDRs do not overlap.
func CheckSubnetsAgainstExistingVPC ¶
func CheckSubnetsAgainstExistingVPC(sess *session.Session, existingVPCID string, controllerSubnets, workerSubnets []VPCSubnet) error
CheckSubnetsAgainstExistingVPC dynamically checks that the proposed subnets are suitable with the given existing VPC and its subnets.
Do not call this method in unit tests. It makes API requests to AWS and requires credentials.
func GetDefaultSubnets ¶
GetDefaultSubnets partitions a CIDR into subnets
func GetVPCSubnets ¶
GetVPCSubnets returns the lists of existing subnets in the given VPC, that are suitable for controllers and workers nodes.
func PopulateCIDRs ¶
func PopulateCIDRs(sess *session.Session, existingVPCID string, publicSubnets, privateSubnets []VPCSubnet) error
PopulateCIDRs shoves some CIDRs into subnets when we know the IDs
func ValidateKubernetesCIDRs ¶
ValidateKubernetesCIDRs validates node, pod, and service CIDRs do not overlap. Leave vpcCIDR blank if it is unknown (i.e. bare-metal).
func ValidateSubnets ¶
ValidateSubnets statically validates for correct subnet format, inclusion in the VPC CIDR range, and non-overlapping subnets.
Types ¶
type AwsBucket ¶
type AwsBucket struct {
// contains filtered or unexported fields
}
type Cluster ¶
type Cluster struct {
ClusterName string
ControllerDomain string
Region string
StackBody string
StackURL string
}
func NewCloudFormation ¶
func (*Cluster) Deploy ¶
func (cb *Cluster) Deploy(sess *session.Session, tags []Tag) (*cloudformation.CreateStackOutput, error)
type Config ¶
type Config struct {
// Name of cloudformation stack
ClusterName string `json:"clusterName"`
// Region to deploy cluster in
Region string `json:"region"`
// CoreOS Channel - alpha/beta/stable
Channel string `json:"channel"`
// DNS name for Kubernetes Controller Load Balancer
// Must be contained within hosted zone
ControllerDomain string `json:"controllerDomain"`
// DNS name for Tectonic Load Balancer
// Must be contained within hosted zone
TectonicDomain string `json:"tectonicDomain"`
// ELBs and controllers should be 'internet-facing' or 'internal'
ELBScheme string `json:"elbScheme"`
// Hosted zone ID to add DNS records to
HostedZoneID string `json:"hostedZoneID"`
// CIDR for new VPC
VPCCIDR string `json:"vpcCIDR"`
// Existing VPC ID (leave blank to create new VPC)
VPCID string `json:"vpcID,omitempty"`
// OPTIONAL: Existing VPC route table to attach subnets to.
// (Leave blank to use main route table in existing VPC)
RouteTableID string `json:"routeTableID,omitempty"`
// List of subnets in VPC (new or existing) to spread controllers across.
ControllerSubnets []VPCSubnet `json:"controllerSubnets"`
// List of subnets in VPC (new or existing) to spread workers across.
WorkerSubnets []VPCSubnet `json:"workerSubnets"`
// ARN of KMS key used to encrypt secrets
KMSKeyARN string `json:"kmsKeyARN"`
// EC2 ssh key for instances (controller and worker)
KeyName string `json:"keyName"`
// EC2 etcd instance settings
ETCDCount int `json:"etcdCount"`
ETCDInstanceType string `json:"etcdInstanceType"`
ETCDRootVolumeType string `json:"etcdRootVolumeType"`
ETCDRootVolumeIOPS int `json:"etcdRootVolumeIOPS"`
ETCDRootVolumeSize int `json:"etcdRootVolumeSize"`
// External etcd client endpoint, e.g. etcd.example.com:2379
ExternalETCDClient string `json:"externalETCDClient"`
// EC2 controller instances
ControllerCount int `json:"controllerCount"`
ControllerInstanceType string `json:"controllerInstanceType"`
ControllerRootVolumeType string `json:"controllerRootVolumeType"`
ControllerRootVolumeIOPS int `json:"controllerRootVolumeIOPS"`
ControllerRootVolumeSize int `json:"controllerRootVolumeSize"`
// EC2 worker instances
WorkerCount int `json:"workerCount"`
WorkerInstanceType string `json:"workerInstanceType"`
WorkerRootVolumeType string `json:"workerRootVolumeType"`
WorkerRootVolumeIOPS int `json:"workerRootVolumeIOPS"`
WorkerRootVolumeSize int `json:"workerRootVolumeSize"`
PodCIDR string `json:"podCIDR"`
ServiceCIDR string `json:"serviceCIDR"`
// Cloudformation tags
Tags []Tag `json:"tags"`
// Userdata templates
ControllerTemplate *template.Template `json:"-"`
WorkerTemplate *template.Template `json:"-"`
EtcdTemplate *template.Template `json:"-"`
// Cloudformation stack template
StackTemplate *template.Template `json:"-"`
// Computed IPs for self-hosted Kubernetes
APIServiceIP net.IP
DNSServiceIP net.IP
// computed fields (set during initialize(), and/or overwritable after)
ETCDInstances []ETCDInstance
ETCDEndpoints string
ETCDInitialCluster string
APIServers string
SecureAPIServers string
AMI string
CreateControllerSubnets bool
CreateWorkerSubnets bool
HostedZoneName string
// Encoded assets
EncodedSecrets *compactSecretAssets
// Logical names of dynamic resources
VPCLogicalName string
// Reference strings for dynamic resources
VPCRef string
// Logical name for the VPC internet gateway
InternetGatewayLogicalName string
// Reference to an existing VPC internet gateway
InternetGatewayRef string
// Asset S3 location information
AssetsS3File string
AssetsS3Bucket string
}
Config: External configuration interface
func (*Config) SetComputed ¶
SetComputed populates computed fields and may make calls to AWS endpoints.
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
SetDefaults sets Config default values (idempotent).
type ETCDInstance ¶
type ETCDInstance struct {
// Nam of the ETCD instance
Name string
// DNS name addressing the EC2 Instance
DomainName string
// Subnet for this EC2 Instance
Subnet VPCSubnet
}
func PopulateETCDInstances ¶
func PopulateETCDInstances(clusterName, hostedZoneName string, subnets []VPCSubnet, count int) (instances []ETCDInstance, initialCluster, endpoints string)
PopulateETCDInstances initializes a slice of ETCDInstance, with the corresponding initial-cluster and endpoint variables.
type SecretAssets ¶
SecretAssets are secret assets as raw bytes.
type Status ¶
type Status struct {
Name string
ID string
StatusString string
Events []string
Resources []*cloudformation.StackResourceSummary
Ready bool
Error bool
}
type VPCSubnet ¶
type VPCSubnet struct {
// Identifier of the subnet if already existing
ID string `json:"id"`
// Logical name for this subnet
// ignored if existing
Name string `json:"name"`
// Availability zone for this subnet
// Max one subnet per availability zone
AvailabilityZone string `json:"availabilityZone"`
// CIDR for this subnet
// must be disjoint from other subnets
// must be contained by VPC CIDR
InstanceCIDR string `json:"instanceCIDR"`
}