Skip to content

Commit

Permalink
Remove the 'dns' options from libvirt
Browse files Browse the repository at this point in the history
This will allow the libvirt nodes to use the hypervisor's DNS instead of
having to hard code some upstream DNS server. Previously this was a
problem if your local machine pointed to the libvirt dnsmasq for DNS
resolution of the nodes. Any unknown address would cause an inifnite
loop. Now, the libvirt dnsmasq will respond that the name is unknown
instead of forwarding it to the hypervisor's DNS server.

Since i can't see a reason for the DNS option, I take it out. Now it
'just works'.
  • Loading branch information
eparis committed Sep 6, 2018
1 parent 1bdd57e commit 13a7dbb
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 41 deletions.
1 change: 0 additions & 1 deletion examples/tectonic.libvirt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ libvirt:
network:
name: tectonic
ifName: tt0
dnsServer: 8.8.8.8
ipRange: 192.168.124.0/24
imagePath: /path/to/image

Expand Down
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
6 changes: 3 additions & 3 deletions steps/infra/libvirt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ resource "libvirt_network" "tectonic_net" {
"${var.tectonic_libvirt_ip_range}",
]

dns_forwarder {
address = "${var.tectonic_libvirt_resolver}"
}
dns = [{
local_only = true,
}]

dns_host = ["${flatten(list(
data.libvirt_network_dns_host_template.bootstrap.*.rendered,
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

0 comments on commit 13a7dbb

Please sign in to comment.