mirror of https://github.com/kubernetes/kops.git
gce: allow empty mode for shared Networks
This commit is contained in:
parent
e3c3671f76
commit
3caa61bd20
|
|
@ -116,6 +116,13 @@ func (_ *Network) CheckChanges(a, e, changes *Network) error {
|
|||
case "auto":
|
||||
case "custom":
|
||||
case "legacy":
|
||||
// Known
|
||||
|
||||
case "":
|
||||
// Treated as "keep existing", only allowed for shared mode
|
||||
if !fi.BoolValue(e.Shared) {
|
||||
return fmt.Errorf("must specify mode for (non-shared) Network")
|
||||
}
|
||||
|
||||
default:
|
||||
return fmt.Errorf("unknown mode %q for Network", e.Mode)
|
||||
|
|
@ -154,7 +161,11 @@ func (_ *Network) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Network) error {
|
|||
// the auto-create subnetworks default of "true". Explicitly send
|
||||
// the default value.
|
||||
network.ForceSendFields = []string{"AutoCreateSubnetworks"}
|
||||
|
||||
default:
|
||||
return fmt.Errorf("unhandled mode %q", e.Mode)
|
||||
}
|
||||
|
||||
op, err := t.Cloud.Compute().Networks().Insert(t.Cloud.Project(), network)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating Network: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue