github.com/openshift/installer@v1.4.17/pkg/asset/machines/machineconfig/ipv6.go (about) 1 package machineconfig 2 3 import ( 4 "fmt" 5 6 igntypes "github.com/coreos/ignition/v2/config/v3_2/types" 7 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 8 9 mcfgv1 "github.com/openshift/api/machineconfiguration/v1" 10 "github.com/openshift/installer/pkg/asset/ignition" 11 ) 12 13 // ForDualStackAddresses creates the MachineConfig to tell kernel to configure the IP addresses with DHCP and DHCPV6. 14 func ForDualStackAddresses(role string) (*mcfgv1.MachineConfig, error) { 15 ignConfig := igntypes.Config{ 16 Ignition: igntypes.Ignition{ 17 Version: igntypes.MaxVersion.String(), 18 }, 19 } 20 21 rawExt, err := ignition.ConvertToRawExtension(ignConfig) 22 if err != nil { 23 return nil, err 24 } 25 26 return &mcfgv1.MachineConfig{ 27 TypeMeta: metav1.TypeMeta{ 28 APIVersion: mcfgv1.SchemeGroupVersion.String(), 29 Kind: "MachineConfig", 30 }, 31 ObjectMeta: metav1.ObjectMeta{ 32 Name: fmt.Sprintf("99-dual-stack-%s", role), 33 Labels: map[string]string{ 34 "machineconfiguration.openshift.io/role": role, 35 }, 36 }, 37 Spec: mcfgv1.MachineConfigSpec{ 38 Config: rawExt, 39 KernelArguments: []string{"ip=dhcp,dhcp6"}, 40 }, 41 }, nil 42 }