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 label matching for kubernetes ingests #363

Closed
pnegahdar opened this issue May 10, 2016 · 10 comments
Closed

Add label matching for kubernetes ingests #363

pnegahdar opened this issue May 10, 2016 · 10 comments
Labels

Comments

@pnegahdar
Copy link
Contributor

I want to add label (or annotation) matching to kubernetes. i.e

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: app_name
  labels:
     - traeffik/balancer-name: load-balancer-1
spec:
  rules:
  - host: news.site.com
    http:
      paths:
      - backend:
          serviceName: "app_service"
          servicePort:  80 

traefik --web --kubernetes --kubernetes.label-filter "traefik/balancer-name=load-balancer-1" would then ensure only those with that label join the balancer.

See: http://kubernetes.io/docs/user-guide/labels/#label-selectors

I know namespaces are currently supported but thats not fine-grained enough for most kube deploy systems. Thoughts on this?

@pnegahdar
Copy link
Contributor Author

Any thoughts on this?

@emilevauge
Copy link
Member

Hi @pnegahdar, sorry for the delay :)
I think that's a good idea! @samber is working on something similar: #311 (comment) and #342
Maybe you could exchange on this :)
We already began to use kubernetes annotation, then I would prefer to continue over using labels.
WDYT?
Thanks a lot for your help :)

@emilevauge emilevauge added the kind/enhancement a new or improved feature. label May 24, 2016
@errm
Copy link
Contributor

errm commented May 26, 2016

re: annotation vs labels I think that the way that k8s sees the distiction is:

  • labels are for things that you may want to do selection on - they are strictly validated to a particular subset of characters.
  • annotations are more a way of storing a random blob of data on to an api object, the validation is much looser.

I think labels is the way to go for this use case, as it would allow us to request the subset of ingresses we want from the apiserver without having to get them all and then filter client side.

@pnegahdar
Copy link
Contributor Author

I agree and seems like the kubernetes docs agree too: http://kubernetes.io/docs/user-guide/annotations/

@emilevauge
Copy link
Member

emilevauge commented May 26, 2016

You're right, I read the doc too quickly :) Let's go on labels !

@errm
Copy link
Contributor

errm commented Jun 23, 2016

@pnegahdar is this something that you are still working on?

@pnegahdar
Copy link
Contributor Author

Actually scheduled doing it today and tomorrow. Hoping to make the 1.0 cut.

@errm
Copy link
Contributor

errm commented Jul 10, 2016

@pnegahdar unless you already have some work in progress on this, I am thinking of picking this one up sometime next week...

@pnegahdar
Copy link
Contributor Author

@errm Wrote a starting implementation. A bit stuck on how to unit test sanely -- kubernetes has a somewhat complex label selector syntax (http://kubernetes.io/docs/user-guide/labels/) that is somewhat hard to effectively mock out.

@cameronattard
Copy link

Will this be included in an upcoming release?

@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants