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

add lbName annotation #565

Closed
wants to merge 1 commit into from
Closed

add lbName annotation #565

wants to merge 1 commit into from

Conversation

agadelshin
Copy link
Contributor

this PR create feature for #369

I've created annotation "kubernetes.io/ingress.loadbalancer-name" to share LB between ingresses. Work still in progress, but it contains a lot of changes, so please look at this PR to control progress.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Dec 1, 2018
@k8s-ci-robot
Copy link
Contributor

Hi @pondohva. 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 Dec 1, 2018
@agadelshin
Copy link
Contributor Author

I still need to do smth with TLS configuration, but simple case with N ingresses with the same LB name in annotation works.

@agadelshin
Copy link
Contributor Author

@rramkumar1 are you OK with this? I decided to create annotation, because it's the simplest way to have shared LB name for ingresses.

I think I need to create some logging to point out users with the same hostname or with the same static IP in different ingresses to this feature.


func pathRuleExists(pathRules []*compute.PathRule, path string, service string) bool {
for _, pr := range pathRules {
//if pr.Service == service && slice.ContainsString(pr.Paths, path, nil) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

can't find how I can translate backend name like "global/backendServices/k8s-be-30002--aaaaa" to k8s service name

@agadelshin
Copy link
Contributor Author

/assign @rramkumar1

could you please help me with this? I'm kinda stuck to make a decision

@rramkumar1
Copy link
Contributor

rramkumar1 commented Dec 7, 2018

@pondohva Annotation seems like the only sensible way to do this. I'm taking a look now at your implementation

Will leave comments in my review on the areas you are stuck

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pondohva
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: rramkumar1

If they are not already assigned, you can assign the PR to them by writing /assign @rramkumar1 in a comment when ready.

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

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.

@pondohva Made a first pass. A couple high level points:

  1. I'm not clear where the actual merging happens. Is that still a WIP?

  2. I would suggest breaking down this problem into two sections. The first is the "origin" LB. You can think of this as the Ingress definition which "branches" are derived from. When you dequeue an "origin", you list all other Ingresses and find its "branches". Once you have each "branch", merge them all into the "origin" and then translate and sync the "origin" as you would normally.

@@ -54,6 +54,7 @@ type ControllerContext struct {
ControllerContextConfig

IngressInformer cache.SharedIndexInformer
SecretInformer cache.SharedIndexInformer
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to watch secrets?

pkg/loadbalancers/l7.go Outdated Show resolved Hide resolved
pkg/controller/controller.go Outdated Show resolved Hide resolved
@agadelshin
Copy link
Contributor Author

@rramkumar1

  1. yes, sure.
  2. Thanks. I started to merge this in pkg/controller/controller.go:481, but I found that pass ingresslist instead of one ingress is not optimal decision. A lot of places in codebase expects 1 ingress in syncState. I'll think about this.

@agadelshin agadelshin changed the title [WIP] add lbName annotation add lbName annotation Dec 9, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 9, 2018
@agadelshin
Copy link
Contributor Author

agadelshin commented Dec 9, 2018

@rramkumar1 could you please look again? I'm not sure what I missed here. Can you give me some advice how can I test my changes? Usually I build docker image and setup GKE cluster to run some ingresses and check what happens, but I believe it's not optimal.

@agadelshin
Copy link
Contributor Author

BTW, I haven't tested it yet, just run go test.

@rramkumar1
Copy link
Contributor

@pondohva I'm still having trouble understanding how your changes would even work. In particular, I don't see any sort of merging logic. Can you please explain your approach?

@agadelshin
Copy link
Contributor Author

@rramkumar1 I merged urlmap only in https://github.com/kubernetes/ingress-gce/pull/565/files#diff-3c862eb54a8e0e161b534e0c67e5379eR520.

this ingresses:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: basic-ingress1
  annotations:
    kubernetes.io/ingress.class: "gce"
    kubernetes.io/ingress.loadbalancer-name: "abc"
spec:
  rules:
  - host: host.example.com
    http:
      paths:
      - backend:
          serviceName: web
          servicePort: 8080
        path: /web1
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: basic-ingress2
  annotations:
    kubernetes.io/ingress.class: "gce"
    kubernetes.io/ingress.loadbalancer-name: "abc"
spec:
  rules:
  - host: host.example.com
    http:
      paths:
      - backend:
          serviceName: web2
          servicePort: 8080
        path: /web2

result:

$ kubectl get ing
NAME             HOSTS              ADDRESS          PORTS     AGE
basic-ingress1   host.example.com   35.244.156.139   80        4m
basic-ingress2   host.example.com   35.244.156.139   80        4m

screenshot 2018-12-11 at 22 13 45

@agadelshin
Copy link
Contributor Author

@agadelshin
Copy link
Contributor Author

@rramkumar1 could you please review last changes? anything else to do?

@rramkumar1
Copy link
Contributor

@pondohva Sorry I was on vacation and haven't had much time to look at this.

Given that this is a big change I would like to spend some more time looking at it. I'll try to have some comments in a week or so.

@agadelshin
Copy link
Contributor Author

@rramkumar1 did you have some time to look at this PR? I'd like to implement this feature, but maybe I should rework smth?

@rramkumar1
Copy link
Contributor

rramkumar1 commented Mar 27, 2019

@pondohva Overall the PR seems to get the job done but my feeling is that the logic is going to be really flimsy and error prone.

I'll leave this PR open but for the time being I don't think we will move forward with it.

@k8s-ci-robot k8s-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Mar 27, 2019
@mcfedr
Copy link
Contributor

mcfedr commented Aug 23, 2019

@rramkumar1 This seems like an interesting concept, do you have any comments what it would take to move forward with it?

@bowei
Copy link
Member

bowei commented Feb 26, 2020

/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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 26, 2020
@k8s-ci-robot
Copy link
Contributor

@agadelshin: PR needs rebase.

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
Copy link
Contributor

@agadelshin: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-ingress-gce-test 0e03a55 link /test pull-ingress-gce-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@agadelshin
Copy link
Contributor Author

thank you @bowei for update. I’ll rebase PR and will try to figure out why tests failed.

Also I’d like to finalize it so if you have any suggestions how I can improve it, I’d appreciate.

@agadelshin
Copy link
Contributor Author

oh, well, it's almost 1.5 years later. I believe it will be safer and better for learning to rewrite it :)

@rramkumar1
Copy link
Contributor

@agadelshin I think you will find interest in the new Gateway APIs which are more tailored to solve this problem. I don't think we will be able to merge any form of this PR to this repo

https://github.com/kubernetes-sigs/service-apis

@agadelshin
Copy link
Contributor Author

@rramkumar1 got it! thank you, I'll look into Gateway APIs.

@agadelshin agadelshin closed this Apr 10, 2020
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. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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