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

BackendService naming for NEG backend services & healthchecks #262

Merged
merged 5 commits into from
May 11, 2018

Conversation

nicksardo
Copy link
Contributor

@nicksardo nicksardo commented May 10, 2018

Continuation of #239

More changes:

  • Neg suffix hash uses the UID truncated to 8 chars.
  • Neg suffix hash input fields are separated by a delimiter
  • ServicePort now has an extension function to return the correct name.
  • namer.Backend is renamed to namer.IGBackend to prevent confusion between IG/NEG.

TODO in another PR:
Rewrite unit tests to not care what kind of serviceport their given.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 10, 2018
@nicksardo nicksardo requested review from rramkumar1 and freehan May 10, 2018 22:22
@@ -137,7 +137,7 @@ func (l *L7) checkUrlMap() (err error) {
if l.runtimeInfo.UrlMap == nil {
return fmt.Errorf("cannot create urlmap without internal representation")
}
defaultBackendName := l.namer.Backend(l.runtimeInfo.UrlMap.DefaultBackend.NodePort)
defaultBackendName := l.namer.IGBackend(l.runtimeInfo.UrlMap.DefaultBackend.NodePort)
Copy link
Contributor

Choose a reason for hiding this comment

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

How come you use IGBackend() directly here instead of ServicePort.BackendName()?

@nicksardo
Copy link
Contributor Author

Manual test looked good. Nice job @agau4779

@rramkumar1
Copy link
Contributor

Looks fine to me. Will leave @freehan to give LGTM.

Copy link
Contributor

@freehan freehan left a comment

Choose a reason for hiding this comment

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

just nits. LGTM

@@ -239,13 +247,13 @@ func (n *Namer) NameBelongsToCluster(name string) bool {
return components.ClusterName == clusterName || n.negBelongsToCluster(name)
}

// BeName constructs the name for a backend.
func (n *Namer) Backend(port int64) string {
// IGBackend constructs the name for a backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

comment: IGBackend constructs the name for a backend service targeting instance groups.

// negBelongsToCluster checks that the uid is present and a substring of the
// cluster uid, since the NEG naming schema truncates it to 8 characters.
// This is only valid for NEGs and Backends on NEG.
func (n *Namer) negBelongsToCluster(name string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: negNameBelongsToCluster?

comment: This is only valid for NEGs, BackendServices and Healthchecks for NEG

@nicksardo nicksardo force-pushed the backendsvc-naming branch from 5c1b13d to 06db5a4 Compare May 11, 2018 22:46
@nicksardo
Copy link
Contributor Author

Thanks for both of your reviews. Fixed comments.

@nicksardo nicksardo added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 11, 2018
@nicksardo nicksardo merged commit f6af412 into kubernetes:master May 11, 2018
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants