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

Centralize more of the naming of GCE resources #70

Merged
merged 1 commit into from
Nov 6, 2017

Conversation

bowei
Copy link
Member

@bowei bowei commented Nov 4, 2017

  • Moves Namer out to its own source file.
  • Improve some of the logging in the unit test.
  • Lots of minor naming consistencies (look at the commits)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 4, 2017
@bowei bowei requested a review from nicksardo November 4, 2017 01:04
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 4, 2017
@bowei
Copy link
Member Author

bowei commented Nov 4, 2017

/assign @nikhiljindal

@bowei
Copy link
Member Author

bowei commented Nov 4, 2017

/assign @nicksardo

@@ -28,6 +28,15 @@ import (
)

const (
// A single target proxy/urlmap/forwarding rule is created per loadbalancer.
// Tagged with the namespace/name of the Ingress.
targetHTTPProxyPrefix = "k8s-tp"
Copy link
Contributor

Choose a reason for hiding this comment

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

How about further extracting "k8s" prefix as a const (similar to what negPrefix() does)?
That way resource names can be reused by kubemci by replacing the prefix "k8s" with "mci1".

Copy link
Member Author

Choose a reason for hiding this comment

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

sgtm -- on another PR though?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes doing in another PR sounds good. You can optionally add a TODO to track

// SetClusterName sets the UID/name of this cluster.
func (n *Namer) SetClusterName(name string) {
// SetCluster sets the UID/name of this cluster.
func (n *Namer) SetCluster(name string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesnt have to be a cluster name. It just needs to be a unique value. For ex: kubemci uses "load balancer" name instead of cluster name. How about keeping the name generic here?

Copy link
Member Author

Choose a reason for hiding this comment

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

SetUID?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes sg

Copy link
Member Author

Choose a reason for hiding this comment

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

done

func (n *Namer) NEGPrefix() string {
return fmt.Sprintf("k8s%s-%s", schemaVersionV1, n.GetClusterName())
func (n *Namer) negPrefix() string {
return fmt.Sprintf("k8s%s-%s", schemaVersionV1, n.Cluster())
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the k8s here be configurable?
Namer should probably take a prefix "k8s" and use that for all resources (similar to comment above about using k8s prefix for resource names).

@nikhiljindal
Copy link
Contributor

Thanks @bowei!
The changes look great. I have a few suggestions that will make it easier to share the namer with kubemci.
Would love to know if you think that is a viable goal.

@nicksardo
Copy link
Contributor

I'm so glad I don't have to look at FirewallName and FirewallSuffix anymore.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 6, 2017
- Make Namer.Truncate private
- Rename GetClusterName() to Cluster()
- Rename GetFirewallName => Firewall()
- More naming consistency cleanups
- BeName() -> Backend()
- BePort() -> BackendPortName()
- firewall_name -> name
- NEGName -> NEG
- IGName() -> InstanceGroup()
- FrSuffix -> FirewallRuleSuffix
- FrName -> FirewallRule
- Remove useless argument to FirewallRule
- All calls use FirewallRuleSuffix, push back into the method.
- SSLCertName -> SSLCert
- Remove stutter on ClusterName, FirewallName
- Reduce leakage of NEGPrefix (use IsNEG) from Namer
- Cluster() -> UID()
@bowei bowei merged commit 74bbb01 into kubernetes:master Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants