cloud-init, tests: add functions to configure network data
Provide functions to configure the IP address, gateway, and DNS
of the guest VM via cloud-init's network data section.
@@ -270,6 +270,11 @@ const (
tmpPath = "/tmp/kubevirt.io/tests"
)
+const (
+ ipv6MasqueradeAddress = "fd10:0:2::2/120"
+ ipv6MasqueradeGateway = "fd10:0:2::1"
+)
+
type ProcessFunc func(event *k8sv1.Event) (done bool)
type ObjectEventWatcher struct {
@@ -2142,6 +2147,25 @@ func GetGuestAgentUserData() string {
`, ipv6UserDataString, GetUrl(GuestAgentHttpUrl), GetUrl(StressHttpUrl))
}
+func GetIPv6NetworkData(ipAddress string, gateway string, dnsServer string, searchDomains []string) string {
+ networkData := fmt.Sprintf(`
+version: 2
+ethernets:
+ eth0:
+ addresses: [ %s ]
+ dhcp4: true
+ gateway6: %s
+ nameservers:
+ addresses: [ %s ]
+ search: [ %s ]
+ `, ipAddress, gateway, dnsServer, strings.Join(searchDomains, " "))
+ return networkData
+}
+
+func getVMISeachDomains() []string {
+ return []string{"default.svc.cluster.local", "svc.cluster.local", "cluster.local"}
+}
+
func NewRandomVMIWithEphemeralDiskAndUserdata(containerImage string, userData string) *v1.VirtualMachineInstance {
vmi := NewRandomVMIWithEphemeralDisk(containerImage)
AddUserData(vmi, "disk1", userData)
