Skip to content

Commit

Permalink
chore(deps): bump kong/kubernetes-configuration to v1.1.0 (#1071)
Browse files Browse the repository at this point in the history
Co-authored-by: Patryk Małek <patryk.malek@konghq.com>
  • Loading branch information
czeslavo and pmalek authored Jan 23, 2025
1 parent 22fe1dc commit c78c3a5
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 27 deletions.
4 changes: 2 additions & 2 deletions controller/konnect/kongpluginbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (b *KongPluginBindingBuilder) WithPluginRef(pluginName string) *KongPluginB
// WithControlPlaneRef sets the control plane reference of the KongPluginBinding.
// NOTE: Users have to ensure that the ControlPlaneRef that's set here
// is the same across all the KongPluginBinding targets.
func (b *KongPluginBindingBuilder) WithControlPlaneRef(ref *configurationv1alpha1.ControlPlaneRef) *KongPluginBindingBuilder {
func (b *KongPluginBindingBuilder) WithControlPlaneRef(ref configurationv1alpha1.ControlPlaneRef) *KongPluginBindingBuilder {
b.binding.Spec.ControlPlaneRef = ref
return b
}
Expand All @@ -58,7 +58,7 @@ func (b *KongPluginBindingBuilder) WithControlPlaneRef(ref *configurationv1alpha
// NOTE: Users have to ensure that the ControlPlaneRef that's set here
// is the same across all the KongPluginBinding targets.
func (b *KongPluginBindingBuilder) WithControlPlaneRefKonnectNamespaced(name string) *KongPluginBindingBuilder {
b.binding.Spec.ControlPlaneRef = &configurationv1alpha1.ControlPlaneRef{
b.binding.Spec.ControlPlaneRef = configurationv1alpha1.ControlPlaneRef{
Type: configurationv1alpha1.ControlPlaneRefKonnectNamespacedRef,
KonnectNamespacedRef: &configurationv1alpha1.KonnectNamespacedRef{
Name: name,
Expand Down
12 changes: 1 addition & 11 deletions controller/konnect/ops/ops_kongroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func kongRouteToSDKRouteInput(
) sdkkonnectcomp.RouteInput {
r := sdkkonnectcomp.RouteInput{
Destinations: route.Spec.KongRouteAPISpec.Destinations,
Headers: kongRouteHeadersToSDK(route.Spec.Headers),
Headers: route.Spec.Headers,
Hosts: route.Spec.KongRouteAPISpec.Hosts,
HTTPSRedirectStatusCode: route.Spec.KongRouteAPISpec.HTTPSRedirectStatusCode,
Methods: route.Spec.KongRouteAPISpec.Methods,
Expand Down Expand Up @@ -139,13 +139,3 @@ func getKongRouteForUID(

return getMatchingEntryFromListResponseData(sliceToEntityWithIDPtrSlice(resp.Object.Data), r)
}

// kongRouteHeadersToSDK converts KongRoute headers to Konnect SDK headers.
// It's a simple conversion from map[string]string to map[string][]string - the format expected by Konnect SDK.
// TODO: Support multiple header values in KongRoute CRD.
// https://github.com/Kong/kubernetes-configuration/issues/234
func kongRouteHeadersToSDK(headers map[string]string) map[string][]string {
return lo.MapEntries(headers, func(k, v string) (string, []string) {
return k, []string{v}
})
}
5 changes: 1 addition & 4 deletions controller/konnect/reconciler_controlplaneref.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ func getControlPlaneRef[T constraints.SupportedKonnectEntityType, TEnt constrain
}
return mo.Some(*e.Spec.ControlPlaneRef)
case *configurationv1alpha1.KongPluginBinding:
if e.Spec.ControlPlaneRef == nil {
return none
}
return mo.Some(*e.Spec.ControlPlaneRef)
return mo.Some(e.Spec.ControlPlaneRef)
case *configurationv1alpha1.KongUpstream:
if e.Spec.ControlPlaneRef == nil {
return none
Expand Down
2 changes: 1 addition & 1 deletion controller/konnect/reconciler_kongplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (r *KongPluginReconciler) Reconcile(ctx context.Context, req ctrl.Request)
WithGenerateName(kongPlugin.Name + "-").
WithNamespace(kongPlugin.Namespace).
WithPluginRef(kongPlugin.Name).
WithControlPlaneRef(&configurationv1alpha1.ControlPlaneRef{
WithControlPlaneRef(configurationv1alpha1.ControlPlaneRef{
Type: configurationv1alpha1.ControlPlaneRefKonnectNamespacedRef,
KonnectNamespacedRef: &configurationv1alpha1.KonnectNamespacedRef{
Name: cpNN.Name,
Expand Down
4 changes: 2 additions & 2 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ to make the code generation required for Kubernetes CRDs work.
| Field | Description |
| --- | --- |
| `destinations` _Destinations array_ | A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields "ip" (optionally in CIDR range notation) and/or "port". |
| `headers` _object (keys:string, values:string)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `headers` _object (keys:string, values:string array)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `hosts` _string array_ | A list of domain names that match this Route. Note that the hosts value is case sensitive. |
| `https_redirect_status_code` _[HTTPSRedirectStatusCode](#httpsredirectstatuscode)_ | The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. |
| `methods` _string array_ | A list of HTTP methods that match this Route. |
Expand Down Expand Up @@ -1244,7 +1244,7 @@ KongRouteSpec defines spec of a Kong Route.
| `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this KongRoute is associated with. Route can either specify a ControlPlaneRef and be 'serviceless' route or specify a ServiceRef and be associated with a Service. |
| `serviceRef` _[ServiceRef](#serviceref)_ | ServiceRef is a reference to a Service this KongRoute is associated with. Route can either specify a ControlPlaneRef and be 'serviceless' route or specify a ServiceRef and be associated with a Service. |
| `destinations` _Destinations array_ | A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields "ip" (optionally in CIDR range notation) and/or "port". |
| `headers` _object (keys:string, values:string)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `headers` _object (keys:string, values:string array)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `hosts` _string array_ | A list of domain names that match this Route. Note that the hosts value is case sensitive. |
| `https_redirect_status_code` _[HTTPSRedirectStatusCode](#httpsredirectstatuscode)_ | The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. |
| `methods` _string array_ | A list of HTTP methods that match this Route. |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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.1
github.com/kong/kubernetes-configuration v1.0.7-0.20250120092720-c985e30e5dd8
github.com/kong/kubernetes-configuration v1.1.0
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
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
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.0.7-0.20250120092720-c985e30e5dd8 h1:SOex4KtF+p+D+hipv461M2Ueu4qQGBf8C5H1cuK1xfo=
github.com/kong/kubernetes-configuration v1.0.7-0.20250120092720-c985e30e5dd8/go.mod h1:YzSyKf/Dg1TIPkVlzSHofk/RGchuDzpxBivfPDkQ2Do=
github.com/kong/kubernetes-configuration v1.1.0 h1:zCj7QlOiZgwQ2wSNlVNR0K6Z+plXTalfihtDzLXQWzs=
github.com/kong/kubernetes-configuration v1.1.0/go.mod h1:Z9Yo8DyBe/4zw/cgoSYafqHzuviKINVSq1b8D60F0u8=
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
4 changes: 2 additions & 2 deletions test/e2e/test_helm_install_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ func gatewayAndItsListenersAreProgrammedAssertion(gatewayLabelSelector string) f
if !assert.NotNil(c, gw) {
return
}
assert.True(c, gateway.IsProgrammed(gw))
assert.True(c, gateway.AreListenersProgrammed(gw))
assert.True(c, gateway.IsProgrammed(gw), "Gateway %q is not programmed: %s", client.ObjectKeyFromObject(gw), pretty.Sprint(gw))
assert.True(c, gateway.AreListenersProgrammed(gw), "Listeners of Gateway %q are not programmed: %s", client.ObjectKeyFromObject(gw), pretty.Sprint(gw))
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/integration/test_konnect_entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func TestKonnectEntities(t *testing.T) {
func(obj client.Object) {
kr := obj.(*configurationv1alpha1.KongRoute)
kr.Spec.KongRouteAPISpec.Paths = []string{"/kr-" + testID}
kr.Spec.Headers = map[string]string{
"KongTestHeader": "example.com",
kr.Spec.Headers = map[string][]string{
"KongTestHeader": {"example.com", "example.org"},
}
},
)
Expand Down

0 comments on commit c78c3a5

Please sign in to comment.