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

kong ingress controller need support for multiple ports per service #335

Closed
zhigang opened this issue Jul 23, 2019 · 3 comments · Fixed by #404
Closed

kong ingress controller need support for multiple ports per service #335

zhigang opened this issue Jul 23, 2019 · 3 comments · Fixed by #404
Labels
area/feature New feature or request
Milestone

Comments

@zhigang
Copy link

zhigang commented Jul 23, 2019

Summary

Kong Ingress controller "0.5.0" not support for multiple ports per service.

Kong Ingress controller version
0.5.0

Kong version
1.2

Kubernetes version

Kubernetes Cluster version v1.10 (v1.10.12) - git (clean) commit c757b93cf034d49af3a3b8ecee3b9639a7a11df7 - platform linux/amd64

What happened

This is my ingress yaml , there have two ports need setting.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    configuration.konghq.com: need-strip-path
    kubernetes.io/ingress.class: kong
  labels:
    app: test-api
  name: test-api
  namespace: staging
spec:
  rules:
  - host: test.mydomain.com
    http:
      paths:
      - backend:
          serviceName: test-api
          servicePort: 5000
        path: /test-api
      - backend:
          serviceName: test-api
          servicePort: 5001
        path: /test-socket

kong ingress controller error:

E0722 12:39:24.220304       1 controller.go:125] unexpected failure updating Kong configuration:
error creating a valid state for Kong: duplicate upstream definitions found for: 'test-api.staging.svc'
W0722 12:39:24.220345       1 queue.go:113] requeuing staging/test-api, err error creating a valid state for Kong: duplicate upstream definitions found for: 'test-api.staging.svc'
@ismailbaskin
Copy link
Contributor

I think the upstream name should contain port number too.

@hbagdi hbagdi added the area/feature New feature or request label Aug 12, 2019
@provgregoryabdo
Copy link

This was working for me with the helm chart version 0.7.0. I have updated to 0.12.1 and now both ports are showing up in the target.

KongRDSDB=> select * from targets WHERE upstream_id = '214fd01a-4733-4dc4-bb06-123271a393d2';
                  id                  |         created_at         |             upstream_id              |       target       | weight | tags 
--------------------------------------+----------------------------+--------------------------------------+--------------------+--------+------
 5df98361-eb76-4ca0-b636-315969865f5f | 2019-08-13 21:24:45.16+00  | 214fd01a-4733-4dc4-bb06-123271a393d2 | 100.120.0.61:10020 |    100 | 
 6f6e09d0-4560-4a66-b7b4-bf56dc30ab3f | 2019-08-13 21:24:44.931+00 | 214fd01a-4733-4dc4-bb06-123271a393d2 | 100.120.0.61:8025  |    100 | 
(2 rows)

This obviously is causing issues, things supposed to got port 10020 are going to both 10020 and 8025 and things supposed to goto 8025 are going to both as well.

@hbagdi hbagdi added this to the 0.7.0 milestone Aug 28, 2019
rainest pushed a commit that referenced this issue Sep 17, 2019
Include the port in upstream names, such that the format is
serviceName.namespace.port.svc, e.g. fooserv.default.80.svc. This
correctly handles cases where a service exposes multiple ports, whereas
previously both would attempt the same upstream and conflict.

Fix #335
@provgregoryabdo
Copy link

Thanks so much @rainest ! Really looking forward to this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/feature New feature or request
Projects
None yet
4 participants