feat: set default mtu for gce platform

This PR is needed so that the eth0 device will have the proper mtu when
coming online in google cloud

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
This commit is contained in:
Spencer Smith 2019-07-17 17:54:27 -04:00 committed by Spencer Smith
parent 4a31b66850
commit c9f0dbbd4c

View File

@ -5,6 +5,7 @@
package googlecloud
import (
"github.com/talos-systems/talos/internal/pkg/network"
"github.com/talos-systems/talos/pkg/userdata"
)
@ -23,7 +24,26 @@ func (gc *GoogleCloud) Name() string {
// UserData implements the platform.Platform interface.
func (gc *GoogleCloud) UserData() (data *userdata.UserData, err error) {
return userdata.Download(GCUserDataEndpoint, userdata.WithHeaders(map[string]string{"Metadata-Flavor": "Google"}))
ud, err := userdata.Download(GCUserDataEndpoint, userdata.WithHeaders(map[string]string{"Metadata-Flavor": "Google"}))
if err != nil {
return nil, err
}
if ud.Networking == nil {
ud.Networking = &userdata.Networking{
OS: &userdata.OSNet{
Devices: []userdata.Device{
{
Interface: network.DefaultInterface,
DHCP: true,
MTU: 1460,
},
},
},
}
}
return ud, nil
}
// Prepare implements the platform.Platform interface and handles initial host preparation.