Skip to content
Closed
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
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
6 changes: 0 additions & 6 deletions data/data/libvirt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,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"
}
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
18 changes: 8 additions & 10 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,7 +63,6 @@ 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,
Expand Down Expand Up @@ -113,7 +111,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