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 degraphql entity support #1346

Open
mheap opened this issue Jul 23, 2024 · 1 comment
Open

Add degraphql entity support #1346

mheap opened this issue Jul 23, 2024 · 1 comment

Comments

@mheap
Copy link
Member

mheap commented Jul 23, 2024

Add support for configuring degraphql entities using Deck.

https://docs.konghq.com/hub/kong-inc/degraphql/#3-configure-degraphql-routes-on-the-service

This may require changes in go-database-reconciler too

@mheap
Copy link
Member Author

mheap commented Oct 29, 2024

The KIC team recently added generic support using KongCustomEntity for schemas added by plugins. I recommend reading https://docs.konghq.com/kubernetes-ingress-controller/latest/guides/services/custom-entity/ to see how it works.

The important part is:

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  namespace: default
  name: degraphql-example
plugin: degraphql
config:
  graphql_server_path: /v1/graphql
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongCustomEntity
metadata:
  namespace: default
  name: degraphql-route-example
spec:
  type: degraphql_routes
  fields:
    uri: "/contacts"
    query: "query{ contacts { name } }"
  controllerName: kong
  parentRef:
    group: "configuration.konghq.com"
    kind: "KongPlugin"
    name: "degraphql-example"

The spec.type field in the second config indicates the Kong entity name, and everything under fields is passed as the configuration.

This would translate to something similar to the following in deck:

plugin_entities:
  - plugin: my-degraphql-plugin
    entity: degraphql_routes
    fields:
      uri: "/contacts"
      query: "query{ contacts { name } }"
  - plugin: my-degraphql-plugin
    entity: degraphql_routes
    fields:
      uri: "/bookings"
      query: "query{ bookings { id, cost } }"
  - plugin: different-plugin
    entity: some-plugin-entity
    fields:
      foo: bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant