RE: KongIngress resource all methods

In order to support all methods (GET, POST, PUT, DELETE, etc) using the KongIngress resource, should the methods section be omitted from the resource under route? I notice if methods is omitted then in the admin api when querying the /routes endpoint the methods section shows up as methods: null however when attempting to reach the service endpoint, there’s an error {"message":"no Route matched with those values"}

apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  annotations:
  name: kingress-resource
  namespace: namespace
proxy:
  connect_timeout: 60000
  path: /
  protocol: https
  read_timeout: 30000
  retries: 10
  write_timeout: 30000
route:
  preserve_host: false
  protocols:
     - https
  regex_priority: 0
  strip_path: true

Is there another way to support all routing methods without explicitly specifying each one? For example, is there an option like methods: ["*"] in order to support all the methods?

null for methods is same as *. Kong will then route based on another property, such as, host header or request path, or any other header.

I have continued to test the issue we were facing and possibly uncovered an issue.

If methods is not specified in route.methods in the KongIngress resource and you have multiple Ingress resources with the same host in spec.rules.host, take for example (blue.test.com), and assume (paths remain unique per host), then there is an error response {"message":"no Route matched with those values"} when trying to get to the endpoint in question through the kong proxy.

When methods is specified however I do not run into this problem.

Is this a known issue and is there any way around this without having to keep the hosts unique and without having specify methods explicitly? I appreciate your help, thank you

All you need for Kong to route traffic to each service is to have a unique Route in Kong. Unique is a combination of Host and Path (and method too if you want to do method based routing).

Could you share a concise Ingress resource which reproduces the problem that you are facing?

metadata:
  annotations:
    configuration.konghq.com: ingress-resource
    kubernetes.io/ingress.class: preview-space
  creationTimestamp: null
  generation: 1
  name: ingress-test
spec:
  rules:
  - host: blue.test.com
    http:
      paths:
       path: /endpoint/test
      - backend:
          serviceName: svc-test
          servicePort: 443
status:
  loadBalancer: {}

This is an example of how my Ingress looks. I am continuing to debug the issue.
I noticed once I removed the methods section altogether from all the associated KongIngress resources and they were all null in the admin-api /routes endpoint, I’m no longer getting the {"message":"no Route matched with those values"} (so far).

If methods (with GET & POST) is specified on KongIngress resources A,B,C and NOT specified on KongIngress resource D and assume that there are Ingress resources A, B, C, D with the same host blue.test.com but with unique paths, in this scenario it seems like I’m getting the no route matched error message.

However, if I remove methods from KongIngress resources A,B,C and keep everything else the same it seems like I’m not getting that error message any longer. I’m going to continue testing this and modify various things to see if I can gain any more certainty on this. Perhaps something else is contributing to this strange behavior.