diff --git a/controller/konnect/ops/ops_kongroute.go b/controller/konnect/ops/ops_kongroute.go
index 9fae16e56..0b526e5f0 100644
--- a/controller/konnect/ops/ops_kongroute.go
+++ b/controller/konnect/ops/ops_kongroute.go
@@ -29,11 +29,11 @@ func createRoute(
return errWrap
}
- if resp == nil || resp.Route == nil || resp.Route.ID == nil {
+ if resp == nil || resp.Route == nil || resp.Route.RouteJSON.ID == nil {
return fmt.Errorf("failed creating %s: %w", route.GetTypeName(), ErrNilResponse)
}
- route.SetKonnectID(*resp.Route.ID)
+ route.SetKonnectID(*resp.Route.RouteJSON.ID)
return nil
}
@@ -87,26 +87,30 @@ func kongRouteToSDKRouteInput(
route *configurationv1alpha1.KongRoute,
) sdkkonnectcomp.RouteInput {
r := sdkkonnectcomp.RouteInput{
- Destinations: route.Spec.KongRouteAPISpec.Destinations,
- Headers: route.Spec.Headers,
- Hosts: route.Spec.KongRouteAPISpec.Hosts,
- HTTPSRedirectStatusCode: route.Spec.KongRouteAPISpec.HTTPSRedirectStatusCode,
- Methods: route.Spec.KongRouteAPISpec.Methods,
- Name: route.Spec.KongRouteAPISpec.Name,
- PathHandling: route.Spec.KongRouteAPISpec.PathHandling,
- Paths: route.Spec.KongRouteAPISpec.Paths,
- PreserveHost: route.Spec.KongRouteAPISpec.PreserveHost,
- Protocols: route.Spec.KongRouteAPISpec.Protocols,
- RegexPriority: route.Spec.KongRouteAPISpec.RegexPriority,
- RequestBuffering: route.Spec.KongRouteAPISpec.RequestBuffering,
- ResponseBuffering: route.Spec.KongRouteAPISpec.ResponseBuffering,
- Snis: route.Spec.KongRouteAPISpec.Snis,
- Sources: route.Spec.KongRouteAPISpec.Sources,
- StripPath: route.Spec.KongRouteAPISpec.StripPath,
- Tags: GenerateTagsForObject(route, route.Spec.KongRouteAPISpec.Tags...),
+ RouteJSONInput: &sdkkonnectcomp.RouteJSONInput{
+ Destinations: route.Spec.KongRouteAPISpec.Destinations,
+ Headers: route.Spec.Headers,
+ Hosts: route.Spec.KongRouteAPISpec.Hosts,
+ HTTPSRedirectStatusCode: route.Spec.KongRouteAPISpec.HTTPSRedirectStatusCode,
+ Methods: route.Spec.KongRouteAPISpec.Methods,
+ Name: route.Spec.KongRouteAPISpec.Name,
+ PathHandling: route.Spec.KongRouteAPISpec.PathHandling,
+ Paths: route.Spec.KongRouteAPISpec.Paths,
+ PreserveHost: route.Spec.KongRouteAPISpec.PreserveHost,
+ Protocols: lo.Map(route.Spec.KongRouteAPISpec.Protocols, func(protocol sdkkonnectcomp.RouteWithoutParentsProtocols, _ int) sdkkonnectcomp.RouteJSONProtocols {
+ return sdkkonnectcomp.RouteJSONProtocols(protocol)
+ }),
+ RegexPriority: route.Spec.KongRouteAPISpec.RegexPriority,
+ RequestBuffering: route.Spec.KongRouteAPISpec.RequestBuffering,
+ ResponseBuffering: route.Spec.KongRouteAPISpec.ResponseBuffering,
+ Snis: route.Spec.KongRouteAPISpec.Snis,
+ Sources: route.Spec.KongRouteAPISpec.Sources,
+ StripPath: route.Spec.KongRouteAPISpec.StripPath,
+ Tags: GenerateTagsForObject(route, route.Spec.KongRouteAPISpec.Tags...),
+ },
}
if route.Status.Konnect != nil && route.Status.Konnect.ServiceID != "" {
- r.Service = &sdkkonnectcomp.RouteService{
+ r.RouteJSONInput.Service = &sdkkonnectcomp.RouteJSONService{
ID: sdkkonnectgo.String(route.Status.Konnect.ServiceID),
}
}
@@ -137,5 +141,10 @@ func getKongRouteForUID(
return "", fmt.Errorf("failed listing %s: %w", r.GetTypeName(), ErrNilResponse)
}
- return getMatchingEntryFromListResponseData(sliceToEntityWithIDPtrSlice(resp.Object.Data), r)
+ return getMatchingEntryFromListResponseData(
+ sliceToEntityWithIDPtrSlice(
+ lo.Map(resp.Object.Data, func(route sdkkonnectcomp.Route, _ int) sdkkonnectcomp.RouteJSON {
+ return *route.RouteJSON
+ }),
+ ), r)
}
diff --git a/controller/konnect/ops/ops_kongroute_test.go b/controller/konnect/ops/ops_kongroute_test.go
index 0d9ae96a4..118bb491b 100644
--- a/controller/konnect/ops/ops_kongroute_test.go
+++ b/controller/konnect/ops/ops_kongroute_test.go
@@ -61,5 +61,5 @@ func TestKongRouteToSDKRouteInput_Tags(t *testing.T) {
"tag4",
"duplicate-tag",
}
- require.ElementsMatch(t, expectedTags, output.Tags)
+ require.ElementsMatch(t, expectedTags, output.RouteJSONInput.Tags)
}
diff --git a/docs/api-reference.md b/docs/api-reference.md
index 572da2e5b..aa58a0e43 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -1192,7 +1192,7 @@ to make the code generation required for Kubernetes CRDs work.
| `path_handling` _[PathHandling](#pathhandling)_ | Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior. |
| `paths` _string array_ | A list of paths that match this Route. |
| `preserve_host` _boolean_ | When matching a Route via one of the `hosts` domain names, use the request `Host` header in the upstream request headers. If set to `false`, the upstream `Host` header will be that of the Service's `host`. |
-| `protocols` _RouteProtocols array_ | An array of the protocols this Route should allow. See KongRoute for a list of accepted protocols. When set to only `"https"`, HTTP requests are answered with an upgrade error. When set to only `"http"`, HTTPS requests are answered with an error. |
+| `protocols` _RouteWithoutParentsProtocols array_ | An array of the protocols this Route should allow. See KongRoute for a list of accepted protocols. When set to only `"https"`, HTTP requests are answered with an upgrade error. When set to only `"http"`, HTTPS requests are answered with an error. |
| `regex_priority` _integer_ | A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same `regex_priority`, the older one (lowest `created_at`) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones). |
| `request_buffering` _boolean_ | Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. |
| `response_buffering` _boolean_ | Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. |
@@ -1225,7 +1225,7 @@ KongRouteSpec defines spec of a Kong Route.
| `path_handling` _[PathHandling](#pathhandling)_ | Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior. |
| `paths` _string array_ | A list of paths that match this Route. |
| `preserve_host` _boolean_ | When matching a Route via one of the `hosts` domain names, use the request `Host` header in the upstream request headers. If set to `false`, the upstream `Host` header will be that of the Service's `host`. |
-| `protocols` _RouteProtocols array_ | An array of the protocols this Route should allow. See KongRoute for a list of accepted protocols. When set to only `"https"`, HTTP requests are answered with an upgrade error. When set to only `"http"`, HTTPS requests are answered with an error. |
+| `protocols` _RouteWithoutParentsProtocols array_ | An array of the protocols this Route should allow. See KongRoute for a list of accepted protocols. When set to only `"https"`, HTTP requests are answered with an upgrade error. When set to only `"http"`, HTTPS requests are answered with an error. |
| `regex_priority` _integer_ | A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same `regex_priority`, the older one (lowest `created_at`) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones). |
| `request_buffering` _boolean_ | Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. |
| `response_buffering` _boolean_ | Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. |
@@ -3056,6 +3056,7 @@ Package v1alpha1 contains API Schema definitions for the konnect.konghq.com v1al
- [KonnectAPIAuthConfiguration](#konnectapiauthconfiguration)
- [KonnectCloudGatewayNetwork](#konnectcloudgatewaynetwork)
+- [KonnectExtension](#konnectextension)
- [KonnectGatewayControlPlane](#konnectgatewaycontrolplane)
### KonnectAPIAuthConfiguration
@@ -3091,6 +3092,26 @@ KonnectCloudGatewayNetwork is the Schema for the Konnect Network API.
+### KonnectExtension
+
+
+KonnectExtension is the Schema for the KonnectExtension API, and is intended to be referenced as
+extension by the DataPlane, ControlPlane or GatewayConfiguration APIs.
+If one of the above mentioned resources successfully refers a KonnectExtension, the underlying
+deployment(s) spec gets customized to include the konnect-related configuration.
+
+
+
+| Field | Description |
+| --- | --- |
+| `apiVersion` _string_ | `konnect.konghq.com/v1alpha1`
+| `kind` _string_ | `KonnectExtension`
+| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
+| `spec` _[KonnectExtensionSpec](#konnectextensionspec)_ | Spec is the specification of the KonnectExtension resource. |
+| `status` _[KonnectExtensionStatus](#konnectextensionstatus)_ | Status is the status of the KonnectExtension resource. |
+
+
+
### KonnectGatewayControlPlane
@@ -3227,6 +3248,7 @@ KonnectConfiguration is the Schema for the KonnectConfiguration API.
_Appears in:_
- [KonnectCloudGatewayNetworkSpec](#konnectcloudgatewaynetworkspec)
+- [KonnectExtensionSpec](#konnectextensionspec)
- [KonnectGatewayControlPlaneSpec](#konnectgatewaycontrolplanespec)
#### KonnectEntityStatus
@@ -3300,6 +3322,7 @@ KonnectGatewayControlPlaneStatus defines the observed state of KonnectGatewayCon
| `id` _string_ | ID is the unique identifier of the Konnect entity as assigned by Konnect API. If it's unset (empty string), it means the Konnect entity hasn't been created yet. |
| `serverURL` _string_ | ServerURL is the URL of the Konnect server in which the entity exists. |
| `organizationID` _string_ | OrgID is ID of Konnect Org that this entity has been created in. |
+| `konnectEndpoints` _[KonnectEndpoints](#konnectendpoints)_ | Endpoints defines the Konnect endpoints for the control plane. They are required by the DataPlane to be properly configured in Konnect and connect to the control plane. |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#condition-v1-meta) array_ | Conditions describe the current conditions of the KonnectGatewayControlPlane.
Known condition types are:
* "Programmed" |
diff --git a/go.mod b/go.mod
index db33e2e18..5455941ee 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@ go 1.24.0
retract v1.2.2
require (
- github.com/Kong/sdk-konnect-go v0.2.10
+ github.com/Kong/sdk-konnect-go v0.2.12
github.com/Masterminds/semver v1.5.0
github.com/cloudflare/cfssl v1.6.5
github.com/go-logr/logr v1.4.2
@@ -19,7 +19,7 @@ require (
github.com/google/go-containerregistry v0.20.3
github.com/google/uuid v1.6.0
github.com/gruntwork-io/terratest v0.48.2
- github.com/kong/kubernetes-configuration v1.1.1-0.20250217181409-44e5ddce290d
+ github.com/kong/kubernetes-configuration v1.1.1-0.20250219125458-b45dead920d4
github.com/kong/kubernetes-telemetry v0.1.8
github.com/kong/kubernetes-testing-framework v0.47.2
github.com/kong/semver/v4 v4.0.1
diff --git a/go.sum b/go.sum
index d1bd1f92f..4a2bb688b 100644
--- a/go.sum
+++ b/go.sum
@@ -18,8 +18,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
-github.com/Kong/sdk-konnect-go v0.2.10 h1:0uMDjZUyo4qjGPzpS9yisPUokIt6HHCz/tnjCIN43to=
-github.com/Kong/sdk-konnect-go v0.2.10/go.mod h1:xsmTIkBbmVyUh1nRFjQMOhxYIPDl+sMfmRmPuZHtwLE=
+github.com/Kong/sdk-konnect-go v0.2.12 h1:TjP+cqMLzY0fucHZlY9bxDQWWKJWsaL13EBO0luMzUE=
+github.com/Kong/sdk-konnect-go v0.2.12/go.mod h1:xsmTIkBbmVyUh1nRFjQMOhxYIPDl+sMfmRmPuZHtwLE=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
@@ -307,8 +307,8 @@ github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IX
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/kong/go-kong v0.63.0 h1:8ECLgkgDqON61qCMq/M0gTwZKYxg55Oy692dRDOOBiU=
github.com/kong/go-kong v0.63.0/go.mod h1:ma9GWnhkxtrXZlLFfED955HjVzmUojYEHet3lm+PDik=
-github.com/kong/kubernetes-configuration v1.1.1-0.20250217181409-44e5ddce290d h1:flivuqWBd5sTGna5Zj1Tn3NeuQgAyxFlhtWw+QOqxt8=
-github.com/kong/kubernetes-configuration v1.1.1-0.20250217181409-44e5ddce290d/go.mod h1:i+W8/uH8p+ECJdUKYTmwtq2TVycxvuGFbU25xK3aygs=
+github.com/kong/kubernetes-configuration v1.1.1-0.20250219125458-b45dead920d4 h1:cKGIpPM55LOJ2YEbbuKDj/OyJ4Zvz38c/gUJ/zi/JT8=
+github.com/kong/kubernetes-configuration v1.1.1-0.20250219125458-b45dead920d4/go.mod h1:bTJv/IsSCE9Ux+9RY9fEMCU9yehBWAvrSXc8iWx7OGo=
github.com/kong/kubernetes-telemetry v0.1.8 h1:nbtUmXW9xkzRO7dgvrgVrJZiRksATk4XHrqX+78g/5k=
github.com/kong/kubernetes-telemetry v0.1.8/go.mod h1:ZEQY/4DddKoe5XA7UTOIbdI/4d6ZRcrzh2ezRxnuyl0=
github.com/kong/kubernetes-testing-framework v0.47.2 h1:+2Z9anTpbV/hwNeN+NFQz53BMU+g3QJydkweBp3tULo=
diff --git a/test/envtest/konnect_entities_kongroute_test.go b/test/envtest/konnect_entities_kongroute_test.go
index d472c5a4b..41a48f1fa 100644
--- a/test/envtest/konnect_entities_kongroute_test.go
+++ b/test/envtest/konnect_entities_kongroute_test.go
@@ -66,13 +66,15 @@ func TestKongRoute(t *testing.T) {
mock.Anything,
cp.GetKonnectID(),
mock.MatchedBy(func(req sdkkonnectcomp.RouteInput) bool {
- return slices.Equal(req.Paths, []string{"/path"})
+ return slices.Equal(req.RouteJSONInput.Paths, []string{"/path"})
}),
).
Return(
&sdkkonnectops.CreateRouteResponse{
Route: &sdkkonnectcomp.Route{
- ID: lo.ToPtr(routeID),
+ RouteJSON: &sdkkonnectcomp.RouteJSON{
+ ID: lo.ToPtr(routeID),
+ },
},
},
nil,
@@ -105,8 +107,8 @@ func TestKongRoute(t *testing.T) {
mock.Anything,
mock.MatchedBy(func(req sdkkonnectops.UpsertRouteRequest) bool {
return req.RouteID == routeID &&
- slices.Equal(req.Route.Paths, []string{"/path"}) &&
- req.Route.PreserveHost != nil && *req.Route.PreserveHost == true
+ slices.Equal(req.Route.RouteJSONInput.Paths, []string{"/path"}) &&
+ req.Route.RouteJSONInput.PreserveHost != nil && *req.Route.RouteJSONInput.PreserveHost == true
}),
).
Return(&sdkkonnectops.UpsertRouteResponse{}, nil)