Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCE: Use network project id for firewall/route mgmt and zone listing #48560

Merged
merged 2 commits into from
Jul 8, 2017

Conversation

nicksardo
Copy link
Contributor

@nicksardo nicksardo commented Jul 6, 2017

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 6, 2017
@nicksardo
Copy link
Contributor Author

/assign @bowei
/sig network
/area platform/gce

@k8s-ci-robot k8s-ci-robot added sig/network Categorizes an issue or PR as relevant to SIG Network. area/platform/gce labels Jul 6, 2017
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Jul 6, 2017
Copy link
Member

@bowei bowei left a comment

Choose a reason for hiding this comment

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

Mostly comments about comments

@@ -132,6 +134,7 @@ type Config struct {
TokenURL string `gcfg:"token-url"`
TokenBody string `gcfg:"token-body"`
ProjectID string `gcfg:"project-id"`
NetworkProjectID string `gcfg:"network-project-id"`
Copy link
Member

Choose a reason for hiding this comment

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

might want to have a comment here why this is different than ProjectID

Copy link
Member

Choose a reason for hiding this comment

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

Add documentation about which objects are associated with instances vs network...

@@ -157,26 +160,38 @@ func (g *GCECloud) GetComputeService() *compute.Service {
// newGCECloud creates a new instance of GCECloud.
func newGCECloud(config io.Reader) (*GCECloud, error) {
apiEndpoint := ""
projectID, zone, err := getProjectAndZone()

// projectNumber is a project identifier known to be numeric
Copy link
Member

Choose a reason for hiding this comment

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

This comment is somewhat confusing. Probably should expand to something like:

// projectNumber is the numeric identifier. Note: there is also a unique string-based project identifier as well (see https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)

@@ -132,6 +134,7 @@ type Config struct {
TokenURL string `gcfg:"token-url"`
TokenBody string `gcfg:"token-body"`
ProjectID string `gcfg:"project-id"`
Copy link
Member

Choose a reason for hiding this comment

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

Add comment // ProjectID can either be the numeric or string-based unique identifier that starts with [a-z]

// Default networkProjectID to known network project number
networkProjectID := networkProjectNumber

// Rebuild the network URL
Copy link
Member

Choose a reason for hiding this comment

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

delete this comment?

networkProjectID = cfg.Global.NetworkProjectID
}

// Determine if cluster is on shared VPC network based off config
Copy link
Member

Choose a reason for hiding this comment

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

[minor] seems clearer:

... VPC network according to config

@@ -46,6 +46,8 @@ import (
const (
ProviderName = "gce"

defaultAPIEndpoint = "https://www.googleapis.com/compute/v1/"
Copy link
Member

Choose a reason for hiding this comment

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

[minor] looks a bit better below if leave off the trailing '/'

if err != nil {
return nil, mc.Observe(err)
}
return list.Items, mc.Observe(err)
}

func (gce *GCECloud) getRegionLink(region string) string {
return fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%v/regions/%v", gce.projectID, region)
return fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%v/regions/%v", gce.networkProjectID, region)
Copy link
Member

Choose a reason for hiding this comment

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

fix API endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

leaving to #48568

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 6, 2017
@nicksardo nicksardo force-pushed the gce-network-project branch 3 times, most recently from 741c5ea to c255635 Compare July 6, 2017 23:03
@sakshamsharma
Copy link
Contributor

#48574 uses gce.GetProjectID() which is to be removed by this PR. Please update that code as well, if it gets merged before this one. If this one gets merged first, I'll update the other one.

@nicksardo
Copy link
Contributor Author

/test pull-kubernetes-kubemark-e2e-gce

1 similar comment
@nicksardo
Copy link
Contributor Author

/test pull-kubernetes-kubemark-e2e-gce

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2017
@nicksardo
Copy link
Contributor Author

/assign @vishh

@lavalamp
Copy link
Member

lavalamp commented Jul 7, 2017

/approve

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lavalamp, nicksardo

Associated issue: 48515

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 48497, 48604, 48599, 48560, 48546)

@k8s-github-robot k8s-github-robot merged commit d4881dd into kubernetes:master Jul 8, 2017
gmarek added a commit to gmarek/kubernetes that referenced this pull request Jul 13, 2017
…k-project"

This reverts commit d4881dd, reversing
changes made to b5c4346.
krousey added a commit that referenced this pull request Jul 13, 2017
Revert "Merge pull request #48560 from nicksardo/gce-network-project"
aleksandra-malinowska pushed a commit to aleksandra-malinowska/kubernetes that referenced this pull request Jul 14, 2017
…k-project"

This reverts commit d4881dd, reversing
changes made to b5c4346.
@nicksardo nicksardo deleted the gce-network-project branch January 12, 2018 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/platform/gce cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/network Categorizes an issue or PR as relevant to SIG Network. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
7 participants