kubernetes-ingress-controller: Plugin annotations do not work with multiple hosts
Kong Ingress controller version: kong:0.13.1-centos
Kubernetes version (use kubectl version
):
v1.9.3
What happened:
I have an ingress with multiple host
matches on it (which turns into routes
in Kong) and have now added a handful of plugin annotations to it. This resulted in one of the routes receiving all but one of the plugins and the other route receiving the other.
What you expected to happen: All host/routes would have the plugins applied.
How to reproduce it (as minimally and precisely as possible):
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: add-request-id
config:
header_name: Request-ID
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-test
annotations:
correlation-id.plugin.konghq.com: add-request-id
spec:
rules:
- host: test1.com
http: &http_rules
paths:
- path: /mypath
backend:
serviceName: myservice
servicePort: 80
- host: test2.com
http: *http_rules
- host: test3.com
http: *http_rules
Apply the above and see that /routes
shows a unique id for each of the host
above and that /plugins
shows that each plugin appears only once and is bound to a single route_id
.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (14 by maintainers)
Commits related to this issue
- feat: reuse KongPlugin resources across ingress resources Problem: KongPlugin custom resource defines a Plugin in Kong. Currently, a KongPlugin resource exists for every Plugin entity in Kong. The sy... — committed to Kong/kubernetes-ingress-controller by hbagdi 6 years ago
- feat: reuse KongPlugin resources across ingress resources Problem: KongPlugin custom resource defines a Plugin in Kong. Currently, a KongPlugin resource exists for every Plugin entity in Kong. The... — committed to Kong/kubernetes-ingress-controller by hbagdi 6 years ago
- feat: reuse KongPlugin resources across ingress resources Problem: KongPlugin custom resource defines a Plugin in Kong. Currently, a KongPlugin resource exists for every Plugin entity in Kong. The... — committed to Kong/kubernetes-ingress-controller by hbagdi 6 years ago
Ah, that makes sense. I didn’t realize they’d actually be applied at the service level in kong. That might be more fitting for my use-case anyway from a logical perspective since each domain/entrypoint never uses different plugins.
You can’t reuse plugin configurations in services either but you can apply the plugin at the service level instead of route level using an annotation in the k8s service.
I’m sorry to say but you shouldn’t manage any resource manually in Kong when you’re using Kong as an Ingress controller. At this point, the only resort here is to temporarily create all
KongPlugin
resources. We will be trying to figure out an approach to make it possible to create global plugins via the ingress controller for the short term but in future,KongPlugin
resources will be reusable.@jaygorrell,
I can’t provide a timeline for this feature yet but this is something that would solve multiple problems.
Unfortunately no. There is no mechanism to apply global plugins via the ingress controller yet. Stay tuned, this might be a smaller problem to solve.