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

WIP: Remove the 'dns' options from libvirt #182

Closed
wants to merge 1 commit into from
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
3 changes: 1 addition & 2 deletions installer/pkg/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ var defaultCluster = Cluster{
},
Libvirt: libvirt.Libvirt{
Network: libvirt.Network{
DNSServer: libvirt.DefaultDNSServer,
IfName: libvirt.DefaultIfName,
IfName: libvirt.DefaultIfName,
},
},
Networking: Networking{
Expand Down
9 changes: 3 additions & 6 deletions installer/pkg/config/libvirt/libvirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
)

const (
// DefaultDNSServer is the default DNS server for libvirt.
DefaultDNSServer = "8.8.8.8"
// DefaultIfName is the default interface name for libvirt.
DefaultIfName = "osbr0"
)
Expand All @@ -26,10 +24,9 @@ type Libvirt struct {

// Network describes a libvirt network configuration.
type Network struct {
Name string `json:"tectonic_libvirt_network_name,omitempty" yaml:"name"`
IfName string `json:"tectonic_libvirt_network_if,omitempty" yaml:"ifName"`
DNSServer string `json:"tectonic_libvirt_resolver,omitempty" yaml:"dnsServer"`
IPRange string `json:"tectonic_libvirt_ip_range,omitempty" yaml:"ipRange"`
Name string `json:"tectonic_libvirt_network_name,omitempty" yaml:"name"`
IfName string `json:"tectonic_libvirt_network_if,omitempty" yaml:"ifName"`
IPRange string `json:"tectonic_libvirt_ip_range,omitempty" yaml:"ipRange"`
}

// TFVars fills in computed Terraform variables.
Expand Down
3 changes: 0 additions & 3 deletions installer/pkg/config/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ func (c *Cluster) validateLibvirt() []error {
if err := validate.PrefixError("libvirt network ifName", validate.NonEmpty(c.Libvirt.Network.IfName)); err != nil {
errs = append(errs, err)
}
if err := validate.PrefixError("libvirt network dnsServer", validate.IPv4(c.Libvirt.Network.DNSServer)); err != nil {
errs = append(errs, err)
}
errs = append(errs, c.validateOverlapWithPodOrServiceCIDR(c.Libvirt.Network.IPRange, "libvirt ipRange")...)
return errs
}
Expand Down
35 changes: 15 additions & 20 deletions installer/pkg/config/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,9 @@ func TestValidateLibvirt(t *testing.T) {
cluster: Cluster{
Libvirt: libvirt.Libvirt{
Network: libvirt.Network{
Name: "tectonic",
IfName: libvirt.DefaultIfName,
DNSServer: libvirt.DefaultDNSServer,
IPRange: "10.0.1.0/24",
Name: "tectonic",
IfName: libvirt.DefaultIfName,
IPRange: "10.0.1.0/24",
},
QCOWImagePath: fInvalid.Name(),
URI: "baz",
Expand All @@ -590,10 +589,9 @@ func TestValidateLibvirt(t *testing.T) {
cluster: Cluster{
Libvirt: libvirt.Libvirt{
Network: libvirt.Network{
Name: "tectonic",
IfName: libvirt.DefaultIfName,
DNSServer: libvirt.DefaultDNSServer,
IPRange: "10.0.1.0/24",
Name: "tectonic",
IfName: libvirt.DefaultIfName,
IPRange: "10.0.1.0/24",
},
QCOWImagePath: fValid.Name(),
URI: "baz",
Expand All @@ -606,10 +604,9 @@ func TestValidateLibvirt(t *testing.T) {
cluster: Cluster{
Libvirt: libvirt.Libvirt{
Network: libvirt.Network{
Name: "tectonic",
IfName: libvirt.DefaultIfName,
DNSServer: libvirt.DefaultDNSServer,
IPRange: "10.2.1.0/24",
Name: "tectonic",
IfName: libvirt.DefaultIfName,
IPRange: "10.2.1.0/24",
},
QCOWImagePath: fValid.Name(),
URI: "baz",
Expand All @@ -622,10 +619,9 @@ func TestValidateLibvirt(t *testing.T) {
cluster: Cluster{
Libvirt: libvirt.Libvirt{
Network: libvirt.Network{
Name: "tectonic",
IfName: libvirt.DefaultIfName,
DNSServer: libvirt.DefaultDNSServer,
IPRange: "x",
Name: "tectonic",
IfName: libvirt.DefaultIfName,
IPRange: "x",
},
QCOWImagePath: "foo",
URI: "baz",
Expand All @@ -638,10 +634,9 @@ func TestValidateLibvirt(t *testing.T) {
cluster: Cluster{
Libvirt: libvirt.Libvirt{
Network: libvirt.Network{
Name: "tectonic",
IfName: libvirt.DefaultIfName,
DNSServer: "foo",
IPRange: "192.168.0.1/24",
Name: "tectonic",
IfName: libvirt.DefaultIfName,
IPRange: "192.168.0.1/24",
},
QCOWImagePath: "foo",
URI: "baz",
Expand Down
1 change: 0 additions & 1 deletion installer/pkg/workflow/fixtures/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
],
"tectonic_ignition_worker": "worker.ign",
"tectonic_libvirt_network_if": "osbr0",
"tectonic_libvirt_resolver": "8.8.8.8",
"tectonic_master_count": 2,
"tectonic_cluster_name": "aws-basic",
"tectonic_networking": "canal",
Expand Down
10 changes: 6 additions & 4 deletions steps/topology/libvirt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ resource "libvirt_network" "tectonic_net" {
"${var.tectonic_libvirt_ip_range}",
]

dns_forwarder {
address = "${var.tectonic_libvirt_resolver}"
}

dns_host = ["${flatten(list(
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,
))}"]

dns = [
{
local_only = true
},
]

autostart = true
}

Expand Down
5 changes: 0 additions & 5 deletions steps/variables-libvirt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ variable "tectonic_libvirt_ip_range" {
description = "IP range for the libvirt machines"
}

variable "tectonic_libvirt_resolver" {
type = "string"
description = "the upstream dns resolver"
}

variable "tectonic_coreos_qcow_path" {
type = "string"
description = "path to a container linux qcow image"
Expand Down