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

GCP forwarding rule/target proxy description field populated #757

Merged
merged 1 commit into from
Jun 4, 2019

Conversation

KatrinaHoffert
Copy link
Contributor

This is for issue #661.

The description are the same values as AWS uses in their Ingress.

Unit tests were updated. Can be viewed by creating an ingress and in Cloud Console, go to Network services > Load balancing > advanced view (description column). Note that the cluster name field is probably not the actual cluster name, but does identify the cluster (and instance group, etc).

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 24, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @KatrinaHoffert. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 24, 2019
@MrHohn
Copy link
Member

MrHohn commented May 24, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 24, 2019
@KatrinaHoffert
Copy link
Contributor Author

Oops. That was dumb.

/retest

defaultZone = "zone-a"
clusterName = "uid1"
ingressName = "test"
namespace = "namespace1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason why the namespace was changed from "default" to "namespace1"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it solely so that the tests were obvious in using the specified namespace. I was wary of the possibility of "default" being assumed somewhere (since, well, it's the default when no namespace is specified) and wanted the tests to be able to differentiate from that possibility.

pkg/loadbalancers/l7.go Outdated Show resolved Hide resolved
namespace := l.runtimeInfo.Ingress.ObjectMeta.Namespace
ingressName := l.runtimeInfo.Ingress.ObjectMeta.Name

return fmt.Sprintf(`{"kubernetes.io/cluster/%s": "owned", "kubernetes.io/namespace": "%s", "kubernetes.io/ingress-name":"%s"}`, clusterName, namespace, ingressName), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Couple points:

  1. I would substitute "kubernetes.io/cluster/%s" : "owned" with "kubernetes.io/cluster" : "[CLUSTER]"
  2. Let me get back to you ASAP on what all information we want in the description. I'm not sure yet if we want more / less / same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems reasonable. I was just trying to figure out what kinda metadata others might have. It doesn't seem documented anywhere I could find.

pkg/loadbalancers/loadbalancers_test.go Outdated Show resolved Hide resolved
@KatrinaHoffert
Copy link
Contributor Author

@rjnagal, have you seen my updates? Curious if there's anything more needed here.

Copy link
Contributor

@rramkumar1 rramkumar1 left a comment

Choose a reason for hiding this comment

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

I'm waiting to hear back on whether we want to use the tags (e.g kubernetes.io/namespace) you are using in the PR.

cc'd thockin@

pkg/loadbalancers/loadbalancers_test.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l7.go Outdated Show resolved Hide resolved
@rramkumar1 rramkumar1 requested a review from thockin May 30, 2019 21:56
namespace := l.runtimeInfo.Ingress.ObjectMeta.Namespace
ingressName := l.runtimeInfo.Ingress.ObjectMeta.Name

return fmt.Sprintf(`{"kubernetes.io/cluster": "%s", "kubernetes.io/namespace": "%s", "kubernetes.io/ingress-name":"%s"}`, clusterName, namespace, ingressName), nil
Copy link
Member

Choose a reason for hiding this comment

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

It'[s not clear to me what value cluster name will be ?

Copy link
Member

Choose a reason for hiding this comment

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

A few thoughts:

Service uses "namespace/name" for service-name -- why be different?

The use of "kubernetes.io" is suspect but historically we did it for Service so I guess this is not worse. The context is not really the domain of Kubernetes, so it's borderline but I won't complain.

Service doesn't have cluster name, but probably should. Hint hint.

%q is generally safer than "%s" in every way. Should be a no-op for this case, but a good habit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cluster name is probably not actually the cluster's name. It depends on if the GLBC was launched with the cluster name actually set (ie, the --cluster-uid flag). Of course, it's usually not and doesn't actually need to match the cluster's name. So that value is actually very likely just a UUID that groups the GLBC resources together. I didn't see a good way to get the actual cluster name. It's surprisingly tricky to get -- the only way I see is to utilize that we know the instance groups and query one of the instances to get the cluster-name custom metadata that we set. On GKE, GLBC could be instantiated with the cluster name passed in.

r.e. labels, I was initially looking at how GCE load balancers use kubernetes.io/service-name. But since ingresses aren't services, I had to do some research on how the heck that label was chosen without much luck and decided to use the same labels as AWS for their ingresses, assuming they got them from somewhere and that it at least follow precedent.

On services (well, load balancers specifically), they seem to have the cluster name available, so could easily be extended, too (that's something for another issue, though -- they're not even in this repo). I should look into if it's exposed somewhere accessible on the cluster. It's ctx.ComponentConfig.KubeCloudShared.ClusterName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The usage of %q has been resolved. I haven't changed the other parts pending the explanation being read.

@KatrinaHoffert KatrinaHoffert force-pushed the issue-661 branch 2 times, most recently from aebb8a4 to 08f0859 Compare May 31, 2019 22:24
@thockin
Copy link
Member

thockin commented May 31, 2019 via email

@KatrinaHoffert
Copy link
Contributor Author

Done @thockin.

Copy link
Contributor

@rramkumar1 rramkumar1 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Will officially lgtm after remaining comments are addressed. Thanks!

pkg/loadbalancers/l7.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l7.go Outdated Show resolved Hide resolved
pkg/loadbalancers/loadbalancers_test.go Outdated Show resolved Hide resolved
@KatrinaHoffert
Copy link
Contributor Author

@rramkumar1 done

@rramkumar1
Copy link
Contributor

@KatrinaHoffert Sorry one last thing, can you squash commits? There needs to be only one commit for this since its pretty small.

The description is akin to that used by load balancer services and sets
`ingress-name=namespace/name`. The forwarding rules and target proxies are
affected by this.
@KatrinaHoffert
Copy link
Contributor Author

Squashed @rramkumar1

@rramkumar1
Copy link
Contributor

/lgtm

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 4, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KatrinaHoffert, rramkumar1

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2019
@k8s-ci-robot k8s-ci-robot merged commit 436e099 into kubernetes:master Jun 4, 2019
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. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants