Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/cloudprovider/provider/gce/cloudconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ import (
// fields are optional, that's why containing the ifs and the explicit newlines.
const cloudConfigTemplate = "[global]\n" +
"project-id = {{ .Global.ProjectID | iniEscape }}\n" +
"local-zone = {{ .Global.LocalZone | iniEscape }}\n"
"local-zone = {{ .Global.LocalZone | iniEscape }}\n" +
"multizone = {{ .Global.MultiZone }}\n" +
"regional = {{ .Global.Regional }}\n"

// GlobalOpts contains the values of the global section of the cloud configuration.
type GlobalOpts struct {
ProjectID string
LocalZone string
MultiZone bool
Regional bool
}

// CloudConfig contains only the section global.
Expand Down
6 changes: 5 additions & 1 deletion pkg/cloudprovider/provider/gce/cloudconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ func TestCloudConfigAsString(t *testing.T) {
Global: GlobalOpts{
ProjectID: "my-project-id",
LocalZone: "my-zone",
MultiZone: true,
Regional: true,
},
},
contents: "[global]\n" +
"project-id = \"my-project-id\"\n" +
"local-zone = \"my-zone\"\n",
"local-zone = \"my-zone\"\n" +
"multizone = true\n" +
"regional = true\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both of these? What's the difference between multi-zone and regional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between multi-zone and regional?

Referring to the docs:

  • multizone clusters: "A multi-zone cluster runs nodes in multiple zones within the same region. All nodes in a single-zone or multi-zone cluster are controlled by the same cluster master.
  • regional clusters: "Regional clusters distribute Kubernetes resources across multiple zones within a region. Regional cluster create three cluster masters across three zones and, by default, create nodes in three zones, or in as many zones as desired."

Do we need both of these?

And from the code in Kubernetes, if either multizone or regional is enabled, managedZones uses all zones. Multizone is mainly used only for this purpose, but regional is used a config for the gce instance interface.

I think we can remove multizone...but I'd like more eyes on this for confirming.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually thinking about it, adding the option to the config struct wont harm, even if we end up not using it

/lgtm
/approve

},
}

Expand Down