diff --git a/kong/kustomization.yaml b/kong/kustomization.yaml index 60464a9..da79e6f 100644 --- a/kong/kustomization.yaml +++ b/kong/kustomization.yaml @@ -3,6 +3,8 @@ kind: Kustomization resources: - rest/service.yaml - rest/routes.yaml + - rest/path-rewrite.yaml + - rest/path-rewrite-bindings.yaml - rest/kongplugin.yaml - rest/rate-limiting.yaml - rest/proxy-cache.yaml diff --git a/kong/mcp/ai-mcp-proxy.yaml b/kong/mcp/ai-mcp-proxy.yaml index ceec121..87b8028 100644 --- a/kong/mcp/ai-mcp-proxy.yaml +++ b/kong/mcp/ai-mcp-proxy.yaml @@ -23,7 +23,7 @@ config: method: GET scheme: http host: ${REST_HOSTNAME} - path: /classic-models/api/v1/products/ + path: /catalog/v1/products/ - name: get-product description: Retrieves a single product by its product code. annotations: @@ -39,7 +39,7 @@ config: method: GET scheme: http host: ${REST_HOSTNAME} - path: /classic-models/api/v1/products/{productcode}/ + path: /catalog/v1/products/{productcode}/ parameters: - name: productcode in: path @@ -60,7 +60,7 @@ config: method: POST scheme: http host: ${REST_HOSTNAME} - path: /classic-models/api/v1/products/ + path: /catalog/v1/products/ request_body: required: true content: diff --git a/kong/rest/path-rewrite-bindings.yaml b/kong/rest/path-rewrite-bindings.yaml new file mode 100644 index 0000000..7cde16e --- /dev/null +++ b/kong/rest/path-rewrite-bindings.yaml @@ -0,0 +1,251 @@ +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-listproductlines-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-listproductlines + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-listproductlines +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-createproductline-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-createproductline + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-createproductline +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-getproductline-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-getproductline + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-getproductline +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-updateproductline-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-updateproductline + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-updateproductline +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-patchproductline-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-patchproductline + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-patchproductline +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-deleteproductline-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-deleteproductline + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-deleteproductline +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-listproductlineproducts-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-listproductlineproducts + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-listproductlineproducts +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-listproducts-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-listproducts + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-listproducts +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-createproduct-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-createproduct + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-createproduct +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-getproduct-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-getproduct + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-getproduct +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-updateproduct-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-updateproduct + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-updateproduct +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-patchproduct-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-patchproduct + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-patchproduct +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-deleteproduct-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-deleteproduct + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-deleteproduct +--- +apiVersion: configuration.konghq.com/v1alpha1 +kind: KongPluginBinding +metadata: + name: ${NAME}-catalog-api-rewrite-getproductorderdetails-binding + namespace: ${NAMESPACE} +spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: ${CONTROL_PLANE_REF_NAME} + pluginRef: + name: ${NAME}-catalog-api-rewrite-getproductorderdetails + targets: + routeRef: + group: configuration.konghq.com + kind: KongRoute + name: ${NAME}-catalog-api-getproductorderdetails diff --git a/kong/rest/path-rewrite.yaml b/kong/rest/path-rewrite.yaml new file mode 100644 index 0000000..15e7274 --- /dev/null +++ b/kong/rest/path-rewrite.yaml @@ -0,0 +1,139 @@ +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-listproductlines + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/productlines/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-createproductline + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/productlines/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-getproductline + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/productlines/$(uri_captures.productline)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-updateproductline + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/productlines/$(uri_captures.productline)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-patchproductline + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/productlines/$(uri_captures.productline)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-deleteproductline + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/productlines/$(uri_captures.productline)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-listproductlineproducts + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/productlines/$(uri_captures.productline)/products/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-listproducts + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/products/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-createproduct + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/products/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-getproduct + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/products/$(uri_captures.productcode)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-updateproduct + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/products/$(uri_captures.productcode)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-patchproduct + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/products/$(uri_captures.productcode)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-deleteproduct + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/products/$(uri_captures.productcode)/ +--- +apiVersion: configuration.konghq.com/v1 +kind: KongPlugin +metadata: + name: ${NAME}-catalog-api-rewrite-getproductorderdetails + namespace: ${NAMESPACE} +plugin: request-transformer-advanced +config: + replace: + uri: /classic-models/api/v1/products/$(uri_captures.productcode)/order-details/ diff --git a/kong/rest/routes.yaml b/kong/rest/routes.yaml index f17eb89..c9332dc 100644 --- a/kong/rest/routes.yaml +++ b/kong/rest/routes.yaml @@ -13,7 +13,7 @@ spec: - GET - OPTIONS paths: - - /classic-models/api/v1/productlines/ + - /catalog/v1/productlines/ strip_path: false tags: - catalog @@ -33,7 +33,7 @@ spec: - POST - OPTIONS paths: - - /classic-models/api/v1/productlines/ + - /catalog/v1/productlines/ strip_path: false tags: - catalog @@ -53,7 +53,7 @@ spec: - GET - OPTIONS paths: - - ~/classic-models/api/v1/productlines/(?[^#?/]+)/$ + - ~/catalog/v1/productlines/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -73,7 +73,7 @@ spec: - PUT - OPTIONS paths: - - ~/classic-models/api/v1/productlines/(?[^#?/]+)/$ + - ~/catalog/v1/productlines/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -93,7 +93,7 @@ spec: - PATCH - OPTIONS paths: - - ~/classic-models/api/v1/productlines/(?[^#?/]+)/$ + - ~/catalog/v1/productlines/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -113,7 +113,7 @@ spec: - DELETE - OPTIONS paths: - - ~/classic-models/api/v1/productlines/(?[^#?/]+)/$ + - ~/catalog/v1/productlines/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -133,7 +133,7 @@ spec: - GET - OPTIONS paths: - - ~/classic-models/api/v1/productlines/(?[^#?/]+)/products/$ + - ~/catalog/v1/productlines/(?[^#?/]+)/products/$ strip_path: false tags: - catalog @@ -153,7 +153,7 @@ spec: - GET - OPTIONS paths: - - /classic-models/api/v1/products/ + - /catalog/v1/products/ strip_path: false tags: - catalog @@ -173,7 +173,7 @@ spec: - POST - OPTIONS paths: - - /classic-models/api/v1/products/ + - /catalog/v1/products/ strip_path: false tags: - catalog @@ -193,7 +193,7 @@ spec: - GET - OPTIONS paths: - - ~/classic-models/api/v1/products/(?[^#?/]+)/$ + - ~/catalog/v1/products/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -213,7 +213,7 @@ spec: - PUT - OPTIONS paths: - - ~/classic-models/api/v1/products/(?[^#?/]+)/$ + - ~/catalog/v1/products/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -233,7 +233,7 @@ spec: - PATCH - OPTIONS paths: - - ~/classic-models/api/v1/products/(?[^#?/]+)/$ + - ~/catalog/v1/products/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -253,7 +253,7 @@ spec: - DELETE - OPTIONS paths: - - ~/classic-models/api/v1/products/(?[^#?/]+)/$ + - ~/catalog/v1/products/(?[^#?/]+)/$ strip_path: false tags: - catalog @@ -273,7 +273,7 @@ spec: - GET - OPTIONS paths: - - ~/classic-models/api/v1/products/(?[^#?/]+)/order-details/$ + - ~/catalog/v1/products/(?[^#?/]+)/order-details/$ strip_path: false tags: - catalog