Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump sigs.k8s.io/gateway-api from v0.8.1 to v1.0.0 #8150

Merged
merged 9 commits into from
Nov 3, 2023
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Due to the shadowing [issue](https://github.com/kumahq/kuma/issues/2417) with ol
RBAC rules on the Prometheus inbound listener were blocking users from fully migrate to the new MeshTrafficPermission policy.
That's why we decided to discontinue TrafficPermission support on the Prometheus inbound listener starting 2.5.x.

### Gateway API

We support `v1` resources and `v1.0.0` of `gateway-api`. `v1beta1` resources are
still supported but support for these WILL be removed in a future release.

## Upgrade to `2.4.x`

### Configuration change
Expand Down
10 changes: 9 additions & 1 deletion deployments/charts/kuma/templates/gateway-class.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{{- if and .Values.experimental.gatewayAPI (.Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1beta1/GatewayClass") }}
{{- if and .Values.experimental.gatewayAPI (.Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/GatewayClass") }}
---
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: kuma
spec:
controllerName: "gateways.kuma.io/controller"
{{- else if and .Values.experimental.gatewayAPI (.Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1beta1/GatewayClass") }}
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ require (
go.opentelemetry.io/proto/otlp v1.0.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.26.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/net v0.17.0
golang.org/x/sys v0.13.0
golang.org/x/text v0.13.0
Expand All @@ -78,13 +78,13 @@ require (
k8s.io/apimachinery v0.28.3
k8s.io/client-go v0.28.3
k8s.io/klog/v2 v2.100.1
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
k8s.io/kubectl v0.28.3
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/controller-runtime v0.16.3
sigs.k8s.io/controller-tools v0.13.0
// When updating this also update version in: test/framework/k8s.go
sigs.k8s.io/gateway-api v0.8.1
sigs.k8s.io/gateway-api v1.0.1-0.20231102153103-51c32c3e070a
sigs.k8s.io/yaml v1.4.0
)

Expand Down Expand Up @@ -112,16 +112,16 @@ require (
github.com/docker/docker v24.0.7+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobuffalo/flect v1.0.2 // indirect
Expand Down Expand Up @@ -190,19 +190,19 @@ require (
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.0 // indirect
k8s.io/component-base v0.28.3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
)
59 changes: 29 additions & 30 deletions go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
kube_labels "k8s.io/apimachinery/pkg/labels"
kube_types "k8s.io/apimachinery/pkg/types"
kube_client "sigs.k8s.io/controller-runtime/pkg/client"
gatewayapi_v1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1beta1"

"github.com/kumahq/kuma/pkg/plugins/runtime/k8s/controllers/gatewayapi/common"
Expand Down Expand Up @@ -48,7 +49,7 @@ func findRouteListenerAttachment(

// From determines whether we are permitted to attach to this ParentRef
switch *ns.From {
case gatewayapi.NamespacesFromSelector:
case gatewayapi_v1.NamespacesFromSelector:
// TODO, the gateway controller/webhook should verify this isn't an
// error
selector, err := kube_meta.LabelSelectorAsSelector(ns.Selector)
Expand All @@ -61,13 +62,13 @@ func findRouteListenerAttachment(
} else {
listeners[l.Name] = Allowed
}
case gatewayapi.NamespacesFromSame:
case gatewayapi_v1.NamespacesFromSame:
if gateway.Namespace != routeNs.GetName() {
listeners[l.Name] = NotPermitted
} else {
listeners[l.Name] = Allowed
}
case gatewayapi.NamespacesFromAll:
case gatewayapi_v1.NamespacesFromAll:
listeners[l.Name] = Allowed
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
kube_runtime "k8s.io/apimachinery/pkg/runtime"
kube_client "sigs.k8s.io/controller-runtime/pkg/client"
kube_client_fake "sigs.k8s.io/controller-runtime/pkg/client/fake"
gatewayapi_v1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1beta1"

"github.com/kumahq/kuma/pkg/plugins/bootstrap/k8s"
Expand Down Expand Up @@ -299,16 +300,16 @@ var _ = Describe("NoMatchingParent support", func() {
var (
defaultNs = "default"
otherNs = "other"
fromAll = gatewayapi.NamespacesFromAll
fromSame = gatewayapi.NamespacesFromSame
fromAll = gatewayapi_v1.NamespacesFromAll
fromSame = gatewayapi_v1.NamespacesFromSame
gatewayGroup = gatewayapi.Group(gatewayapi.GroupName)
gatewayKind = gatewayapi.Kind("Gateway")
simpleHostname = gatewayapi.Hostname("simple.local")
anyTestHostname = gatewayapi.Hostname("*.wildcard.local")

listenerProgrammed = []kube_meta.Condition{
{
Type: string(gatewayapi.ListenerConditionProgrammed),
Type: string(gatewayapi_v1.ListenerConditionProgrammed),
Status: kube_meta.ConditionTrue,
},
}
Expand All @@ -318,7 +319,7 @@ var (
simpleListener = gatewayapi.Listener{
Name: simpleListenerName,
Port: gatewayapi.PortNumber(80),
Protocol: gatewayapi.HTTPProtocolType,
Protocol: gatewayapi_v1.HTTPProtocolType,
AllowedRoutes: &gatewayapi.AllowedRoutes{
Namespaces: &gatewayapi.RouteNamespaces{
From: &fromSame,
Expand All @@ -329,7 +330,7 @@ var (
wildcardListener = gatewayapi.Listener{
Name: wildcardListenerName,
Port: gatewayapi.PortNumber(80),
Protocol: gatewayapi.HTTPProtocolType,
Protocol: gatewayapi_v1.HTTPProtocolType,
Hostname: &anyTestHostname,
AllowedRoutes: &gatewayapi.AllowedRoutes{
Namespaces: &gatewayapi.RouteNamespaces{
Expand All @@ -342,7 +343,7 @@ var (
allNsListener = gatewayapi.Listener{
Name: allNsListenerName,
Port: gatewayapi.PortNumber(80),
Protocol: gatewayapi.HTTPProtocolType,
Protocol: gatewayapi_v1.HTTPProtocolType,
Hostname: &simpleHostname,
AllowedRoutes: &gatewayapi.AllowedRoutes{
Namespaces: &gatewayapi.RouteNamespaces{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
kube_handler "sigs.k8s.io/controller-runtime/pkg/handler"
kube_reconcile "sigs.k8s.io/controller-runtime/pkg/reconcile"
gatewayapi_v1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1beta1"

mesh_k8s "github.com/kumahq/kuma/pkg/plugins/resources/k8s/native/api/v1alpha1"
Expand Down Expand Up @@ -59,9 +60,9 @@ func (r *GatewayClassReconciler) Reconcile(ctx context.Context, req kube_ctrl.Re
}

if len(gateways.Items) > 0 {
controllerutil.AddFinalizer(class, gatewayapi.GatewayClassFinalizerGatewaysExist)
controllerutil.AddFinalizer(class, gatewayapi_v1.GatewayClassFinalizerGatewaysExist)
} else {
controllerutil.RemoveFinalizer(class, gatewayapi.GatewayClassFinalizerGatewaysExist)
controllerutil.RemoveFinalizer(class, gatewayapi_v1.GatewayClassFinalizerGatewaysExist)
}

if err := r.Update(ctx, class); err != nil {
Expand All @@ -78,9 +79,9 @@ func (r *GatewayClassReconciler) Reconcile(ctx context.Context, req kube_ctrl.Re

if condition == nil {
condition = &kube_meta.Condition{
Type: string(gatewayapi.GatewayClassConditionStatusAccepted),
Type: string(gatewayapi_v1.GatewayClassConditionStatusAccepted),
Status: kube_meta.ConditionTrue,
Reason: string(gatewayapi.GatewayClassReasonAccepted),
Reason: string(gatewayapi_v1.GatewayClassReasonAccepted),
}
}

Expand Down Expand Up @@ -111,9 +112,9 @@ func getParametersRef(
}

condition := kube_meta.Condition{
Type: string(gatewayapi.GatewayClassConditionStatusAccepted),
Type: string(gatewayapi_v1.GatewayClassConditionStatusAccepted),
Status: kube_meta.ConditionFalse,
Reason: string(gatewayapi.GatewayClassReasonInvalidParameters),
Reason: string(gatewayapi_v1.GatewayClassReasonInvalidParameters),
}

if parametersRef.Group != gatewayapi.Group(mesh_k8s.GroupVersion.Group) || parametersRef.Kind != "MeshGatewayConfig" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
kube_controllerutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
kube_handler "sigs.k8s.io/controller-runtime/pkg/handler"
kube_reconcile "sigs.k8s.io/controller-runtime/pkg/reconcile"
gatewayapi_v1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayapi "sigs.k8s.io/gateway-api/apis/v1beta1"

mesh_proto "github.com/kumahq/kuma/api/mesh/v1alpha1"
Expand Down Expand Up @@ -67,7 +68,7 @@ func (r *GatewayReconciler) Reconcile(ctx context.Context, req kube_ctrl.Request
return kube_ctrl.Result{}, nil
}

if !kube_apimeta.IsStatusConditionTrue(class.Status.Conditions, string(gatewayapi.GatewayClassConditionStatusAccepted)) {
if !kube_apimeta.IsStatusConditionTrue(class.Status.Conditions, string(gatewayapi_v1.GatewayClassConditionStatusAccepted)) {
return kube_ctrl.Result{}, nil
}

Expand Down
Loading