Skip to content

Commit

Permalink
chore(deps): bump github.com/Kong/sdk-konnect-go from 0.2.10 to 0.2.12 (
Browse files Browse the repository at this point in the history
#1163)

* chore(deps): bump github.com/Kong/sdk-konnect-go from 0.2.10 to 0.2.12

Bumps [github.com/Kong/sdk-konnect-go](https://github.com/Kong/sdk-konnect-go) from 0.2.10 to 0.2.12.
- [Release notes](https://github.com/Kong/sdk-konnect-go/releases)
- [Changelog](https://github.com/Kong/sdk-konnect-go/blob/main/RELEASE.md)
- [Commits](Kong/sdk-konnect-go@v0.2.10...v0.2.12)

---
updated-dependencies:
- dependency-name: github.com/Kong/sdk-konnect-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Adapt to sdk-konnect-go 0.2.12

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>

* make generate

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mattia Lavacca <lavacca.mattia@gmail.com>
  • Loading branch information
dependabot[bot] and mlavacca authored Feb 19, 2025
1 parent 87923c4 commit 85e7e0d
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 34 deletions.
51 changes: 30 additions & 21 deletions controller/konnect/ops/ops_kongroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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),
}
}
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion controller/konnect/ops/ops_kongroute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
27 changes: 25 additions & 2 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down Expand Up @@ -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. |
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.

<!-- konnect_extension description placeholder -->

| 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


Expand Down Expand Up @@ -3227,6 +3248,7 @@ KonnectConfiguration is the Schema for the KonnectConfiguration API.

_Appears in:_
- [KonnectCloudGatewayNetworkSpec](#konnectcloudgatewaynetworkspec)
- [KonnectExtensionSpec](#konnectextensionspec)
- [KonnectGatewayControlPlaneSpec](#konnectgatewaycontrolplanespec)

#### KonnectEntityStatus
Expand Down Expand Up @@ -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.<br /><br /> Known condition types are:<br /><br /> * "Programmed" |


Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
10 changes: 6 additions & 4 deletions test/envtest/konnect_entities_kongroute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 85e7e0d

Please sign in to comment.