Skip to content
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

data/aws: Bump default instance type from t2.medium to t3.medium #724

Merged
merged 3 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/data/aws/bootstrap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variable "ignition" {

variable "instance_type" {
type = "string"
default = "t2.medium"
default = "t3.medium"
description = "The EC2 instance type for the bootstrap node."
}

Expand Down
56 changes: 3 additions & 53 deletions data/data/aws/variables-aws.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ EOF

variable "tectonic_aws_master_ec2_type" {
type = "string"
description = "Instance size for the master node(s). Example: `t2.medium`."
default = "t2.medium"
}
description = "Instance size for the master node(s). Example: `t3.medium`."

variable "tectonic_aws_worker_ec2_type" {
type = "string"
description = "Instance size for the worker node(s). Example: `t2.medium`."
default = "t2.medium"
# FIXME: get this wired up to the machine default
default = "t3.medium"
}

variable "tectonic_aws_ec2_ami_override" {
Expand All @@ -36,17 +32,6 @@ EOF
default = []
}

variable "tectonic_aws_worker_extra_sg_ids" {
description = <<EOF
(optional) List of additional security group IDs for worker nodes.

Example: `["sg-51530134", "sg-b253d7cc"]`
EOF

type = "list"
default = []
}

variable "tectonic_aws_vpc_cidr_block" {
type = "string"

Expand Down Expand Up @@ -149,28 +134,6 @@ Ignored if the volume type is not io1.
EOF
}

variable "tectonic_aws_worker_root_volume_type" {
type = "string"
default = "gp2"
description = "The type of volume for the root block device of worker nodes."
}

variable "tectonic_aws_worker_root_volume_size" {
type = "string"
default = "30"
description = "The size of the volume in gigabytes for the root block device of worker nodes."
}

variable "tectonic_aws_worker_root_volume_iops" {
type = "string"
default = "100"

description = <<EOF
The amount of provisioned IOPS for the root block device of worker nodes.
Ignored if the volume type is not io1.
EOF
}

variable "tectonic_aws_master_custom_subnets" {
type = "map"
default = {}
Expand Down Expand Up @@ -239,16 +202,3 @@ Example:
* Role Name = tectonic-installer
EOF
}

variable "tectonic_aws_worker_load_balancers" {
type = "list"
default = []

description = <<EOF
(optional) List of ELBs to attach all worker instances to.
This is useful for exposing NodePort services via load-balancers managed separately from the cluster.

Example:
* `["ingress-nginx"]`
EOF
}
10 changes: 0 additions & 10 deletions data/data/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ This applies only to cloud platforms.
EOF
}

variable "tectonic_worker_count" {
type = "string"
default = "3"

description = <<EOF
The number of worker nodes to be created.
This applies only to cloud platforms.
EOF
}

variable "tectonic_base_domain" {
type = "string"

Expand Down
7 changes: 0 additions & 7 deletions data/data/libvirt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ resource "libvirt_network" "tectonic_net" {
data.libvirt_network_dns_host_template.bootstrap.*.rendered,
data.libvirt_network_dns_host_template.masters.*.rendered,
data.libvirt_network_dns_host_template.etcds.*.rendered,
data.libvirt_network_dns_host_template.workers.*.rendered,
))}"]
}]

Expand Down Expand Up @@ -104,12 +103,6 @@ data "libvirt_network_dns_host_template" "etcds" {
hostname = "${var.tectonic_cluster_name}-etcd-${count.index}"
}

data "libvirt_network_dns_host_template" "workers" {
count = "${var.tectonic_worker_count}"
ip = "${var.tectonic_libvirt_worker_ips[count.index]}"
hostname = "${var.tectonic_cluster_name}"
}

data "libvirt_network_dns_srv_template" "etcd_cluster" {
count = "${var.tectonic_master_count}"
service = "etcd-server-ssl"
Expand Down
5 changes: 0 additions & 5 deletions data/data/libvirt/variables-libvirt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,3 @@ variable "tectonic_libvirt_master_ips" {
type = "list"
description = "the list of desired master ips. Must match tectonic_master_count"
}

variable "tectonic_libvirt_worker_ips" {
type = "list"
description = "the list of desired worker ips. Must match tectonic_worker_count"
}
2 changes: 1 addition & 1 deletion pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

func defaultAWSMachinePoolPlatform() awstypes.MachinePool {
return awstypes.MachinePool{
InstanceType: "t2.medium",
InstanceType: "t3.medium",
}
}

Expand Down
15 changes: 2 additions & 13 deletions pkg/tfvars/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ type MasterRootVolume struct {

// Worker converts worker related config.
type Worker struct {
CustomSubnets map[string]string `json:"tectonic_aws_worker_custom_subnets,omitempty"`
EC2Type string `json:"tectonic_aws_worker_ec2_type,omitempty"`
ExtraSGIDs []string `json:"tectonic_aws_worker_extra_sg_ids,omitempty"`
IAMRoleName string `json:"tectonic_aws_worker_iam_role_name,omitempty"`
LoadBalancers []string `json:"tectonic_aws_worker_load_balancers,omitempty"`
WorkerRootVolume `json:",inline"`
}

// WorkerRootVolume converts worker rool volume related config.
type WorkerRootVolume struct {
IOPS int `json:"tectonic_aws_worker_root_volume_iops,omitempty"`
Size int `json:"tectonic_aws_worker_root_volume_size,omitempty"`
Type string `json:"tectonic_aws_worker_root_volume_type,omitempty"`
CustomSubnets map[string]string `json:"tectonic_aws_worker_custom_subnets,omitempty"`
IAMRoleName string `json:"tectonic_aws_worker_iam_role_name,omitempty"`
}
15 changes: 1 addition & 14 deletions pkg/tfvars/libvirt/libvirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ type Libvirt struct {
Image string `json:"tectonic_os_image,omitempty"`
Network `json:",inline"`
MasterIPs []string `json:"tectonic_libvirt_master_ips,omitempty"`
WorkerIPs []string `json:"tectonic_libvirt_worker_ips,omitempty"`
BootstrapIP string `json:"tectonic_libvirt_bootstrap_ip,omitempty"`
}

Expand All @@ -29,7 +28,7 @@ type Network struct {
}

// TFVars fills in computed Terraform variables.
func (l *Libvirt) TFVars(masterCount int, workerCount int) error {
func (l *Libvirt) TFVars(masterCount int) error {
_, network, err := net.ParseCIDR(l.Network.IPRange)
if err != nil {
return fmt.Errorf("failed to parse libvirt network ipRange: %v", err)
Expand All @@ -55,18 +54,6 @@ func (l *Libvirt) TFVars(masterCount int, workerCount int) error {
}
}

if len(l.WorkerIPs) > 0 {
if len(l.WorkerIPs) != workerCount {
return fmt.Errorf("length of WorkerIPs doesn't match worker count")
}
} else {
if ips, err := generateIPs("worker", network, workerCount, 50); err == nil {
l.WorkerIPs = ips
} else {
return err
}
}

return nil
}

Expand Down
24 changes: 8 additions & 16 deletions pkg/tfvars/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type config struct {
Name string `json:"tectonic_cluster_name,omitempty"`
BaseDomain string `json:"tectonic_base_domain,omitempty"`
Masters int `json:"tectonic_master_count,omitempty"`
Workers int `json:"tectonic_worker_count,omitempty"`

IgnitionBootstrap string `json:"ignition_bootstrap,omitempty"`
IgnitionMaster string `json:"ignition_master,omitempty"`
Expand All @@ -42,15 +41,15 @@ func TFVars(cfg *types.InstallConfig, bootstrapIgn, masterIgn string) ([]byte, e
}

for _, m := range cfg.Machines {
var replicas int
if m.Replicas == nil {
replicas = 1
} else {
replicas = int(*m.Replicas)
}

switch m.Name {
case "master":
var replicas int
if m.Replicas == nil {
replicas = 1
} else {
replicas = int(*m.Replicas)
}

config.Masters += replicas
if m.Platform.AWS != nil {
config.AWS.Master = aws.Master{
Expand All @@ -64,16 +63,9 @@ func TFVars(cfg *types.InstallConfig, bootstrapIgn, masterIgn string) ([]byte, e
}
}
case "worker":
config.Workers += replicas
if m.Platform.AWS != nil {
config.AWS.Worker = aws.Worker{
EC2Type: m.Platform.AWS.InstanceType,
IAMRoleName: m.Platform.AWS.IAMRoleName,
WorkerRootVolume: aws.WorkerRootVolume{
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this why workers are now 16gb volumes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this why workers are now 16gb volumes?

This is just passing data to Terraform, and worker creation is via the cluster-API now. So I don't see a connection.

IOPS: m.Platform.AWS.EC2RootVolume.IOPS,
Size: m.Platform.AWS.EC2RootVolume.Size,
Type: m.Platform.AWS.EC2RootVolume.Type,
},
}
}
default:
Expand Down Expand Up @@ -113,7 +105,7 @@ func TFVars(cfg *types.InstallConfig, bootstrapIgn, masterIgn string) ([]byte, e
Image: cfg.Platform.Libvirt.DefaultMachinePlatform.Image,
MasterIPs: masterIPs,
}
if err := config.Libvirt.TFVars(config.Masters, config.Workers); err != nil {
if err := config.Libvirt.TFVars(config.Masters); err != nil {
return nil, errors.Wrap(err, "failed to insert libvirt variables")
}
if err := config.Libvirt.UseCachedImage(); err != nil {
Expand Down