Expose catalog-api under /catalog/v1, decoupled from the backend path
Public routes no longer leak classic-models-api's own /api/v1 prefix. request-transformer-advanced rewrites to the real backend path per route.
This commit is contained in:
@@ -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
|
||||
@@ -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/
|
||||
+14
-14
@@ -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/(?<productline>[^#?/]+)/$
|
||||
- ~/catalog/v1/productlines/(?<productline>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -73,7 +73,7 @@ spec:
|
||||
- PUT
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/productlines/(?<productline>[^#?/]+)/$
|
||||
- ~/catalog/v1/productlines/(?<productline>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -93,7 +93,7 @@ spec:
|
||||
- PATCH
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/productlines/(?<productline>[^#?/]+)/$
|
||||
- ~/catalog/v1/productlines/(?<productline>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -113,7 +113,7 @@ spec:
|
||||
- DELETE
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/productlines/(?<productline>[^#?/]+)/$
|
||||
- ~/catalog/v1/productlines/(?<productline>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -133,7 +133,7 @@ spec:
|
||||
- GET
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/productlines/(?<productline>[^#?/]+)/products/$
|
||||
- ~/catalog/v1/productlines/(?<productline>[^#?/]+)/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/(?<productcode>[^#?/]+)/$
|
||||
- ~/catalog/v1/products/(?<productcode>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -213,7 +213,7 @@ spec:
|
||||
- PUT
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/products/(?<productcode>[^#?/]+)/$
|
||||
- ~/catalog/v1/products/(?<productcode>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -233,7 +233,7 @@ spec:
|
||||
- PATCH
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/products/(?<productcode>[^#?/]+)/$
|
||||
- ~/catalog/v1/products/(?<productcode>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -253,7 +253,7 @@ spec:
|
||||
- DELETE
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/products/(?<productcode>[^#?/]+)/$
|
||||
- ~/catalog/v1/products/(?<productcode>[^#?/]+)/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
@@ -273,7 +273,7 @@ spec:
|
||||
- GET
|
||||
- OPTIONS
|
||||
paths:
|
||||
- ~/classic-models/api/v1/products/(?<productcode>[^#?/]+)/order-details/$
|
||||
- ~/catalog/v1/products/(?<productcode>[^#?/]+)/order-details/$
|
||||
strip_path: false
|
||||
tags:
|
||||
- catalog
|
||||
|
||||
Reference in New Issue
Block a user