From dc0795d63644f0bfaf8d855de6b1da92867f8f48 Mon Sep 17 00:00:00 2001 From: "Hayden A. James" Date: Tue, 30 Jun 2026 11:24:28 -0400 Subject: [PATCH] Support Gateway API 1.6.0 --- README.md | 61 ++++-- deploy/manifests/examples/tcproute-nlb.yaml | 2 +- deploy/manifests/examples/udproute-nlb.yaml | 4 +- go.mod | 82 +++---- go.sum | 200 ++++++++--------- internal/app/l4_controller_test.go | 45 ++-- internal/app/l4_route_model_helpers_test.go | 17 +- .../app/l4_route_model_integration_test.go | 56 +++-- internal/app/tcproute_model.go | 45 ++-- internal/app/tcproute_model_test.go | 193 +++++++++-------- internal/app/udproute_model.go | 45 ++-- internal/app/udproute_model_test.go | 201 +++++++++--------- internal/app/watches_model.go | 37 ++-- internal/app/watches_model_test.go | 83 ++++---- internal/k8s/start_manager.go | 9 +- internal/k8s/start_manager_test.go | 8 +- internal/services/k8sapi/client.go | 5 - .../k8sapi/mock_sub_resource_writer.go | 63 ++++++ 18 files changed, 615 insertions(+), 541 deletions(-) diff --git a/README.md b/README.md index 5df6bdf4..e78a2e18 100644 --- a/README.md +++ b/README.md @@ -7,20 +7,35 @@ Project status: **Beta** +## Supported Gateway API Resources + +Installing Gateway API v1.6.0 may install CRDs that this controller does not implement. +Unsupported resource kinds are ignored: the controller does not watch them, reconcile them, +update their status, or provision OCI resources for them. + +| Resource | Support | +| --- | --- | +| `GatewayClass` | Supported | +| `Gateway` | Supported | +| `HTTPRoute` | Supported on OCI Load Balancer | +| `GRPCRoute` | Supported on OCI Load Balancer | +| `TLSRoute` | Supported on OCI Load Balancer and OCI Network Load Balancer where OCI capabilities allow | +| `TCPRoute` | Supported on OCI Network Load Balancer | +| `UDPRoute` | Supported on OCI Network Load Balancer | +| `ReferenceGrant` | Supported for cross-namespace references used by supported routes and policies | +| `BackendTLSPolicy` | Supported for OCI Load Balancer backend TLS; OCI Network Load Balancer uses passthrough routing instead | +| `ListenerSet` | Not supported; ignored if installed | +| `XBackend`, `XBackendTrafficPolicy`, `XMesh` | Not supported; ignored if installed | + ## Getting Started -Install Gateway API CRDs. Choose one path: +Install Gateway API CRDs: ```sh -# Standard CRDs are enough for HTTPRoute / ALB usage. -kubectl apply --server-side=true \ - -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.1/standard-install.yaml - -# Or use experimental CRDs when enabling TCPRoute / UDPRoute / NLB usage. kubectl apply --server-side=true \ - -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.1/experimental-install.yaml + -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.6.0/standard-install.yaml ``` -The controller can run with only the standard CRDs. The experimental channel is required only for `TCPRoute` and `UDPRoute` support. -`TLSRoute` is available from the standard Gateway API CRDs. +The controller can run with only the standard CRDs. `HTTPRoute`, `GRPCRoute`, `TLSRoute`, +`TCPRoute`, `UDPRoute`, and `BackendTLSPolicy` are standard in Gateway API v1.6.0. Prepare API key and config file (use actual values): ```ini @@ -187,6 +202,8 @@ kubectl -n oke-gw delete httproute oke-gateway-example-server ## HTTPRoute matching +See [deploy/manifests/examples/serverroutes.yaml](./deploy/manifests/examples/serverroutes.yaml) for a complete HTTPRoute example. + Following match types are supported: - path: `PathPrefix` and `Exact` - header: `Exact` and `RegularExpression` @@ -216,23 +233,23 @@ See [deploy/manifests/examples/grpcroute.yaml](./deploy/manifests/examples/grpcr ## Backend TLS -`BackendTLSPolicy` configures TLS from OCI Load Balancer backend sets to backend Pods for ALB-backed `HTTPRoute`, `GRPCRoute`, and `TLSRoute` with `tls.mode: Terminate`. It is not supported for OCI Network Load Balancer routes. +`BackendTLSPolicy` configures TLS from OCI Load Balancer backend sets to backend Pods for OCI Load Balancer-backed `HTTPRoute`, `GRPCRoute`, and `TLSRoute` with `tls.mode: Terminate`. It is not supported for OCI Network Load Balancer routes. -OCI backend SSL validates the backend certificate chain but does not enforce hostname/SAN identity. Policies must explicitly set `oci.oraclecloud.com/backend-hostname-validation: Disabled`, and unsupported standard fields such as `subjectAltNames` are rejected. CA trust can come from `validation.caCertificateRefs`, from pre-managed OCI CA bundle OCIDs in `oci.oraclecloud.com/trusted-ca-bundle-ocids`, or both. +OCI backend SSL validates the backend certificate chain but does not enforce hostname/SAN identity. Policies must explicitly set `oci.oraclecloud.com/backend-hostname-validation: Disabled`, and unsupported standard fields such as `subjectAltNames` are rejected. CA trust can come from `validation.caCertificateRefs`, from pre-managed OCI CA bundle OCIDs in `oci.oraclecloud.com/trusted-ca-bundle-ocids`, or both. A policy may use pre-managed OCI CA bundle OCIDs without a ConfigMap CA reference. See [deploy/manifests/examples/backendtlspolicy.yaml](./deploy/manifests/examples/backendtlspolicy.yaml) for a complete example with a Gateway, HTTPRoute, Service, CA ConfigMap, and BackendTLSPolicy. ## TCPRoute And UDPRoute With OCI Network Load Balancer -Layer 4 support uses an existing OCI Network Load Balancer. The controller reconciles listeners, backend sets, and backends on the referenced NLB, but does not create or delete the NLB resource itself. +Layer 4 support uses an existing OCI Network Load Balancer. The controller reconciles listeners, backend sets, and backends on the referenced OCI Network Load Balancer, but does not create or delete the OCI Network Load Balancer resource itself. -Apply the NLB GatewayClass: +Apply the OCI Network Load Balancer GatewayClass: ```sh kubectl apply -f deploy/manifests/examples/gatewayclass-nlb.yaml ``` -Create a GatewayConfig that points to the existing NLB: +Create a GatewayConfig that points to the existing OCI Network Load Balancer: ```yaml apiVersion: oke-gateway-api.gemyago.github.io/v1 @@ -253,31 +270,35 @@ kubectl apply -n -f deploy/manifests/examples/tcproute-nlb.yaml kubectl apply -n -f deploy/manifests/examples/udproute-nlb.yaml ``` +See [deploy/manifests/examples/tcproute-nlb.yaml](./deploy/manifests/examples/tcproute-nlb.yaml) and [deploy/manifests/examples/udproute-nlb.yaml](./deploy/manifests/examples/udproute-nlb.yaml) for route examples. + OCI Network Load Balancer backend sets require health checks. For `UDPRoute`, set `oke-gateway-api.gemyago.github.io/nlb-udp-health-check-port` on each route to the TCP port the backend Pods expose for health checking. UDP health checks are not configured by this controller. -`GatewayConfig.spec.loadBalancerId` is shared with ALB usage. The GatewayClass determines whether the OCID is resolved through the OCI Load Balancer API or the OCI Network Load Balancer API. +`GatewayConfig.spec.loadBalancerId` is shared with OCI Load Balancer usage. The GatewayClass determines whether the OCID is resolved through the OCI Load Balancer API or the OCI Network Load Balancer API. ## TLSRoute `TLSRoute` supports two OCI-backed modes: -- OCI Load Balancer with `tls.mode: Terminate`: terminates TLS at the ALB and forwards to the backend Service port. Use `BackendTLSPolicy` when the backend connection should also use TLS. +- OCI Load Balancer with `tls.mode: Terminate`: terminates TLS at the OCI Load Balancer and forwards to the backend Service port. Use `BackendTLSPolicy` when the backend connection should also use TLS. - OCI Network Load Balancer with `tls.mode: Passthrough`: forwards encrypted TCP bytes to a backend that terminates TLS itself. -Unsupported combinations are rejected: ALB passthrough and NLB termination. OCI does not support SNI fanout for ALB TCP+SSL listeners or NLB TCP passthrough listeners, so only one effective `TLSRoute` can own a TLS listener. TLSRoute health checks use TCP on the resolved backend Service port. +Unsupported combinations are rejected: OCI Load Balancer passthrough and OCI Network Load Balancer termination. OCI does not support SNI fanout for OCI Load Balancer TCP+SSL listeners or OCI Network Load Balancer TCP passthrough listeners, so only one effective `TLSRoute` can own a TLS listener. TLSRoute health checks use TCP on the resolved backend Service port. + +See [deploy/manifests/examples/tlsroute-alb.yaml](./deploy/manifests/examples/tlsroute-alb.yaml) for OCI Load Balancer termination and [deploy/manifests/examples/tlsroute-nlb.yaml](./deploy/manifests/examples/tlsroute-nlb.yaml) for OCI Network Load Balancer passthrough. -Apply the ALB terminate example: +Apply the OCI Load Balancer terminate example: ```sh kubectl apply -n -f deploy/manifests/examples/gatewayconfig.yaml -kubectl apply -n -f deploy/manifests/examples/gatewayclass.yaml +kubectl apply -f deploy/manifests/examples/gatewayclass.yaml kubectl apply -n -f deploy/manifests/examples/tlsroute-alb.yaml ``` -Apply the NLB passthrough example: +Apply the OCI Network Load Balancer passthrough example: ```sh kubectl apply -n -f deploy/manifests/examples/gatewayconfig-nlb.yaml diff --git a/deploy/manifests/examples/tcproute-nlb.yaml b/deploy/manifests/examples/tcproute-nlb.yaml index f1765fc7..2cea9f8f 100644 --- a/deploy/manifests/examples/tcproute-nlb.yaml +++ b/deploy/manifests/examples/tcproute-nlb.yaml @@ -1,4 +1,4 @@ -apiVersion: gateway.networking.k8s.io/v1alpha2 +apiVersion: gateway.networking.k8s.io/v1 kind: TCPRoute metadata: name: rtmp diff --git a/deploy/manifests/examples/udproute-nlb.yaml b/deploy/manifests/examples/udproute-nlb.yaml index aa2793ab..c199ca80 100644 --- a/deploy/manifests/examples/udproute-nlb.yaml +++ b/deploy/manifests/examples/udproute-nlb.yaml @@ -1,4 +1,4 @@ -apiVersion: gateway.networking.k8s.io/v1alpha2 +apiVersion: gateway.networking.k8s.io/v1 kind: UDPRoute metadata: name: coap-dtls @@ -13,7 +13,7 @@ spec: - name: coap-service port: 5684 --- -apiVersion: gateway.networking.k8s.io/v1alpha2 +apiVersion: gateway.networking.k8s.io/v1 kind: UDPRoute metadata: name: srt diff --git a/go.mod b/go.mod index 3cdc5bc4..af72c5ed 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/gemyago/oke-gateway-api -go 1.26 +go 1.26.0 require ( github.com/go-logr/logr v1.4.3 @@ -16,11 +16,11 @@ require ( go.uber.org/dig v1.19.0 golang.org/x/sync v0.20.0 golang.org/x/sys v0.45.0 - k8s.io/api v0.35.1 - k8s.io/apimachinery v0.35.1 - k8s.io/client-go v0.35.1 - sigs.k8s.io/controller-runtime v0.20.4 - sigs.k8s.io/gateway-api v1.5.1 + k8s.io/api v0.36.1 + k8s.io/apimachinery v0.36.1 + k8s.io/client-go v0.36.1 + sigs.k8s.io/controller-runtime v0.24.1 + sigs.k8s.io/gateway-api v1.6.0 ) require ( @@ -35,18 +35,26 @@ require ( github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect - github.com/fxamacker/cbor/v2 v2.9.0 // indirect - github.com/go-openapi/jsonpointer v0.21.2 // indirect - github.com/go-openapi/jsonreference v0.21.0 // indirect - github.com/go-openapi/swag v0.23.1 // indirect + github.com/fxamacker/cbor/v2 v2.9.1 // indirect + github.com/go-openapi/jsonpointer v0.23.1 // indirect + github.com/go-openapi/jsonreference v0.21.5 // indirect + github.com/go-openapi/swag v0.26.0 // indirect + github.com/go-openapi/swag/cmdutils v0.26.0 // indirect + github.com/go-openapi/swag/conv v0.26.0 // indirect + github.com/go-openapi/swag/fileutils v0.26.0 // indirect + github.com/go-openapi/swag/jsonname v0.26.0 // indirect + github.com/go-openapi/swag/jsonutils v0.26.0 // indirect + github.com/go-openapi/swag/loading v0.26.0 // indirect + github.com/go-openapi/swag/mangling v0.26.0 // indirect + github.com/go-openapi/swag/netutils v0.26.0 // indirect + github.com/go-openapi/swag/stringutils v0.26.0 // indirect + github.com/go-openapi/swag/typeutils v0.26.0 // indirect + github.com/go-openapi/swag/yamlutils v0.26.0 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/gobuffalo/flect v1.0.3 // indirect github.com/gofrs/flock v0.12.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect - github.com/google/btree v1.1.3 // indirect - github.com/google/gnostic-models v0.7.0 // indirect - github.com/google/go-cmp v0.7.0 // indirect + github.com/google/gnostic-models v0.7.1 // indirect github.com/google/go-github/v82 v82.0.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect @@ -54,9 +62,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jinzhu/copier v0.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.9.1 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -69,10 +75,10 @@ require ( github.com/narqo/go-badge v0.0.0-20230821190521-c9a75c019a59 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.22.0 // indirect + github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.64.0 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/common v0.67.5 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/rjeczalik/notify v0.9.3 // indirect github.com/rs/zerolog v1.35.1 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect @@ -87,35 +93,35 @@ require ( github.com/vladopajic/go-test-coverage/v2 v2.18.8 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect - go.opentelemetry.io/otel v1.35.0 // indirect - go.opentelemetry.io/otel/trace v1.35.0 // indirect - go.yaml.in/yaml/v2 v2.4.3 // indirect + go.opentelemetry.io/otel v1.41.0 // indirect + go.opentelemetry.io/otel/trace v1.41.0 // indirect + go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.48.0 // indirect + golang.org/x/crypto v0.51.0 // indirect golang.org/x/image v0.38.0 // indirect - golang.org/x/mod v0.33.0 // indirect - golang.org/x/net v0.50.0 // indirect - golang.org/x/oauth2 v0.34.0 // indirect - golang.org/x/term v0.40.0 // indirect - golang.org/x/text v0.35.0 // indirect - golang.org/x/time v0.14.0 // indirect - golang.org/x/tools v0.42.0 // indirect + golang.org/x/mod v0.35.0 // indirect + golang.org/x/net v0.55.0 // indirect + golang.org/x/oauth2 v0.36.0 // indirect + golang.org/x/term v0.43.0 // indirect + golang.org/x/text v0.37.0 // indirect + golang.org/x/time v0.15.0 // indirect + golang.org/x/tools v0.44.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect - google.golang.org/protobuf v1.36.11 // indirect + google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // 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 - k8s.io/apiextensions-apiserver v0.33.1 // indirect - k8s.io/code-generator v0.33.1 // indirect - k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect - k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect - k8s.io/utils v0.0.0-20260108192941-914a6e750570 // indirect + k8s.io/apiextensions-apiserver v0.36.0 // indirect + k8s.io/code-generator v0.36.0 // indirect + k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect + k8s.io/klog/v2 v2.140.0 // indirect + k8s.io/kube-openapi v0.0.0-20260501160325-927ab1f70cd6 // indirect + k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 // indirect sigs.k8s.io/controller-tools v0.18.0 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.4.0 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) diff --git a/go.sum b/go.sum index 12726a9e..cde7d2b8 100644 --- a/go.sum +++ b/go.sum @@ -29,18 +29,46 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= -github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ= +github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.21.2 h1:AqQaNADVwq/VnkCmQg6ogE+M3FOsKTytwges0JdwVuA= -github.com/go-openapi/jsonpointer v0.21.2/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= -github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= -github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= -github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= -github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= +github.com/go-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4= +github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY= +github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= +github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= +github.com/go-openapi/swag v0.26.0 h1:GVDXCmfvhfu1BxiHo8/FA+BbKmhecHnG3varjON5/RI= +github.com/go-openapi/swag v0.26.0/go.mod h1:82g3193sZJRbocs7bNCqGfIgq8pkuwVwCfhKIRlEQF0= +github.com/go-openapi/swag/cmdutils v0.26.0 h1:iowihOcvq7y4egO8cOq0dmfohz6wfeQ63U1EnuhO2TU= +github.com/go-openapi/swag/cmdutils v0.26.0/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= +github.com/go-openapi/swag/conv v0.26.0 h1:5yGGsPYI1ZCva93U0AoKi/iZrNhaJEjr324YVsiD89I= +github.com/go-openapi/swag/conv v0.26.0/go.mod h1:tpAmIL7X58VPnHHiSO4uE3jBeRamGsFsfdDeDtb5ECE= +github.com/go-openapi/swag/fileutils v0.26.0 h1:WJoPRvsA7QRiiWluowkLJa9jaYR7FCuxmDvnCgaRRxU= +github.com/go-openapi/swag/fileutils v0.26.0/go.mod h1:0WDJ7lp67eNjPMO50wAWYlKvhOb6CQ37rzR7wrgI8Tc= +github.com/go-openapi/swag/jsonname v0.26.0 h1:gV1NFX9M8avo0YSpmWogqfQISigCmpaiNci8cGECU5w= +github.com/go-openapi/swag/jsonname v0.26.0/go.mod h1:urBBR8bZNoDYGr653ynhIx+gTeIz0ARZxHkAPktJK2M= +github.com/go-openapi/swag/jsonutils v0.26.0 h1:FawFML2iAXsPqmERscuMPIHmFsoP1tOqWkxBaKNMsnA= +github.com/go-openapi/swag/jsonutils v0.26.0/go.mod h1:2VmA0CJlyFqgawOaPI9psnjFDqzyivIqLYN34t9p91E= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0 h1:apqeINu/ICHouqiRZbyFvuDge5jCmmLTqGQ9V95EaOM= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.26.0/go.mod h1:AyM6QT8uz5IdKxk5akv0y6u4QvcL9GWERt0Jx/F/R8Y= +github.com/go-openapi/swag/loading v0.26.0 h1:Apg6zaKhCJurpJer0DCxq99qwmhFddBhaMX7kilDcko= +github.com/go-openapi/swag/loading v0.26.0/go.mod h1:dBxQ/6V2uBaAQdevN18VELE6xSpJWZxLX4txe12JwDg= +github.com/go-openapi/swag/mangling v0.26.0 h1:Du2YC4YLA/Y5m/YKQd7AnY5qq0wRKSFZTTt8ktFaXcQ= +github.com/go-openapi/swag/mangling v0.26.0/go.mod h1:jifS7W9vbg+pw63bT+GI53otluMQL3CeemuyCHKwVx0= +github.com/go-openapi/swag/netutils v0.26.0 h1:CmZp+ZT7HrmFwrC3GdGsXBq2+42T1bjKBapcqVpIs3c= +github.com/go-openapi/swag/netutils v0.26.0/go.mod h1:5iK+Ok3ZohWWex1C50BFTPexi03UaPwjW4Oj8kgrpwo= +github.com/go-openapi/swag/stringutils v0.26.0 h1:qZQngLxs5s7SLijc3N2ZO+fUq2o8LjuWAASSrJuh+xg= +github.com/go-openapi/swag/stringutils v0.26.0/go.mod h1:sWn5uY+QIIspwPhvgnqJsH8xqFT2ZbYcvbcFanRyhFE= +github.com/go-openapi/swag/typeutils v0.26.0 h1:2kdEwdiNWy+JJdOvu5MA2IIg2SylWAFuuyQIKYybfq4= +github.com/go-openapi/swag/typeutils v0.26.0/go.mod h1:oovDuIUvTrEHVMqWilQzKzV4YlSKgyZmFh7AlfABNVE= +github.com/go-openapi/swag/yamlutils v0.26.0 h1:H7O8l/8NJJQ/oiReEN+oMpnGMyt8G0hl460nRZxhLMQ= +github.com/go-openapi/swag/yamlutils v0.26.0/go.mod h1:1evKEGAtP37Pkwcc7EWMF0hedX0/x3Rkvei2wtG/TbU= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.2 h1:5zRca5jw7lzVREKCZVNBpysDNBjj74rBh0N2BGQbSR0= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.2/go.mod h1:XVevPw5hUXuV+5AkI1u1PeAm27EQVrhXTTCPAF85LmE= +github.com/go-openapi/testify/v2 v2.4.2 h1:tiByHpvE9uHrrKjOszax7ZvKB7QOgizBWGBLuq0ePx4= +github.com/go-openapi/testify/v2 v2.4.2/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= @@ -52,14 +80,10 @@ github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/gofrs/uuid/v5 v5.4.0 h1:EfbpCTjqMuGyq5ZJwxqzn3Cbr2d0rUZU7v5ycAk/e/0= github.com/gofrs/uuid/v5 v5.4.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= -github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= +github.com/google/gnostic-models v0.7.1 h1:SisTfuFKJSKM5CPZkffwi6coztzzeYUhc3v4yxLWH8c= +github.com/google/gnostic-models v0.7.1/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= @@ -90,12 +114,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/johannesboyne/gofakes3 v0.0.0-20230914150226-f005f5cc03aa h1:a6Hc6Hlq6MxPNBW53/S/HnVwVXKc0nbdD/vgnQYuxG0= github.com/johannesboyne/gofakes3 v0.0.0-20230914150226-f005f5cc03aa/go.mod h1:AxgWC4DDX54O2WDoQO1Ceabtn6IbktjU/7bigor+66g= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -104,8 +124,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8= -github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -132,10 +150,10 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.28.0 h1:Rrf+lVLmtlBIKv6KrIGJCjyY8N36vDVcutbGJkyqjJc= -github.com/onsi/ginkgo/v2 v2.28.0/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28= -github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg= +github.com/onsi/ginkgo/v2 v2.27.4 h1:fcEcQW/A++6aZAZQNUmNjvA9PSOzefMJBerHJ4t8v8Y= +github.com/onsi/ginkgo/v2 v2.27.4/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= +github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q= +github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= github.com/oracle/oci-go-sdk/v65 v65.91.0 h1:maO6AxKxVfszH0X4tbbtN21jOk03lCRR3IqiA8/FzZc= github.com/oracle/oci-go-sdk/v65 v65.91.0/go.mod h1:u6XRPsw9tPziBh76K7GrrRXPa8P8W3BQeqJ6ZZt9VLA= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= @@ -145,14 +163,14 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= -github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.64.0 h1:pdZeA+g617P7oGv1CzdTzyeShxAGrTBsolKNOLQPGO4= -github.com/prometheus/common v0.64.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rjeczalik/notify v0.9.3 h1:6rJAzHTGKXGj76sbRgDiDcYj/HniypXmSJo1SWakZeY= github.com/rjeczalik/notify v0.9.3/go.mod h1:gF3zSOrafR9DQEWSE8TjfI9NkooDxbyT4UgRGKZA0lc= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -209,65 +227,52 @@ github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= -go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= -go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= -go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= +go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c= +go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE= +go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= +go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= -go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= +go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= -golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= +golang.org/x/crypto v0.51.0 h1:IBPXwPfKxY7cWQZ38ZCIRPI50YLeevDLlLnyC5wRGTI= +golang.org/x/crypto v0.51.0/go.mod h1:8AdwkbraGNABw2kOX6YFPs3WM22XqI4EXEd8g+x7Oc8= golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE= golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= -golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= +golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60= -golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM= -golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= -golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -285,38 +290,33 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= -golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg= -golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM= +golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= +golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= -golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= -golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= +golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= +golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k= -golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0= -golang.org/x/tools/go/expect v0.1.0-deprecated h1:jY2C5HGYR5lqex3gEniOQL0r7Dq5+VGVgY1nudX5lXY= -golang.org/x/tools/go/expect v0.1.0-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= +golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= +golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= +golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gomodules.xyz/jsonpatch/v2 v2.5.0 h1:JELs8RLM12qJGXU4u/TO3V25KW8GreMKl9pdkk14RM0= gomodules.xyz/jsonpatch/v2 v2.5.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -332,35 +332,35 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.35.1 h1:0PO/1FhlK/EQNVK5+txc4FuhQibV25VLSdLMmGpDE/Q= -k8s.io/api v0.35.1/go.mod h1:28uR9xlXWml9eT0uaGo6y71xK86JBELShLy4wR1XtxM= -k8s.io/apiextensions-apiserver v0.33.1 h1:N7ccbSlRN6I2QBcXevB73PixX2dQNIW0ZRuguEE91zI= -k8s.io/apiextensions-apiserver v0.33.1/go.mod h1:uNQ52z1A1Gu75QSa+pFK5bcXc4hq7lpOXbweZgi4dqA= -k8s.io/apimachinery v0.35.1 h1:yxO6gV555P1YV0SANtnTjXYfiivaTPvCTKX6w6qdDsU= -k8s.io/apimachinery v0.35.1/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/client-go v0.35.1 h1:+eSfZHwuo/I19PaSxqumjqZ9l5XiTEKbIaJ+j1wLcLM= -k8s.io/client-go v0.35.1/go.mod h1:1p1KxDt3a0ruRfc/pG4qT/3oHmUj1AhSHEcxNSGg+OA= -k8s.io/code-generator v0.33.1 h1:ZLzIRdMsh3Myfnx9BaooX6iQry29UJjVfVG+BuS+UMw= -k8s.io/code-generator v0.33.1/go.mod h1:HUKT7Ubp6bOgIbbaPIs9lpd2Q02uqkMCMx9/GjDrWpY= -k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q= -k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= -k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= -k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/utils v0.0.0-20260108192941-914a6e750570 h1:JT4W8lsdrGENg9W+YwwdLJxklIuKWdRm+BC+xt33FOY= -k8s.io/utils v0.0.0-20260108192941-914a6e750570/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= -sigs.k8s.io/controller-runtime v0.20.4 h1:X3c+Odnxz+iPTRobG4tp092+CvBU9UK0t/bRf+n0DGU= -sigs.k8s.io/controller-runtime v0.20.4/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY= +k8s.io/api v0.36.1 h1:XbL/EMj8K2aJpJtePmqUyQMsM0D4QI2pvl7YKJ20FTY= +k8s.io/api v0.36.1/go.mod h1:KOWo4ey3TINlXjeHVuwB3i+tXXnu+UcwFBHlI/9dvEo= +k8s.io/apiextensions-apiserver v0.36.0 h1:Wt7E8J+VBCbj4FjiBfDTK/neXDDjyJVJc7xfuOHImZ0= +k8s.io/apiextensions-apiserver v0.36.0/go.mod h1:kGDjH0msuiIB3tgsYRV0kS9GqpMYMUsQ3GHv7TApyug= +k8s.io/apimachinery v0.36.1 h1:G63Gjx2W+q0YD+72Vo8oY0nDnePVwnuzTmmy5ENrVSA= +k8s.io/apimachinery v0.36.1/go.mod h1:ibYOR00vW/I1kzvi5SF0dRuJ52BvKtfvRdOn35GPQ+8= +k8s.io/client-go v0.36.1 h1:FN/K8QIT2CEDt+2WB2HnWrUANZ50AP5GII43/SP2JR0= +k8s.io/client-go v0.36.1/go.mod h1:s6rAnCtTGYDQnpNjEhSaISV+2O8jwruZ6m3QOYBFbtU= +k8s.io/code-generator v0.36.0 h1:XWAkrhnArm0VWMmSFO7kyB+wE2LROwep7hEH0GPGkqA= +k8s.io/code-generator v0.36.0/go.mod h1:Tr2UhfBRdlyRoadfob9aPCmmGe8PUs5XPK9MEJ2nx+w= +k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b h1:gMplByicHV/TJBizHd9aVEsTYoJBnnUAT5MHlTkbjhQ= +k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM= +k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= +k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= +k8s.io/kube-openapi v0.0.0-20260501160325-927ab1f70cd6 h1:ngxu1nL4SbFuXwu1EY7cSKcVqSjTQPVbYQT6WNjTXaU= +k8s.io/kube-openapi v0.0.0-20260501160325-927ab1f70cd6/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbeZuxoSGOX/J+aYM= +k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +sigs.k8s.io/controller-runtime v0.24.1 h1:miPEwrmirImAvgME1L9qebGHrOnGJoVmVdtOU9fRfo4= +sigs.k8s.io/controller-runtime v0.24.1/go.mod h1:vFkfY5fGt5xAC/sKb8IBFKgWPNKG9OUG29dR8Y2wImw= sigs.k8s.io/controller-tools v0.18.0 h1:rGxGZCZTV2wJreeRgqVoWab/mfcumTMmSwKzoM9xrsE= sigs.k8s.io/controller-tools v0.18.0/go.mod h1:gLKoiGBriyNh+x1rWtUQnakUYEujErjXs9pf+x/8n1U= -sigs.k8s.io/gateway-api v1.5.1 h1:RqVRIlkhLhUO8wOHKTLnTJA6o/1un4po4/6M1nRzdd0= -sigs.k8s.io/gateway-api v1.5.1/go.mod h1:GvCETiaMAlLym5CovLxGjS0NysqFk3+Yuq3/rh6QL2o= +sigs.k8s.io/gateway-api v1.6.0 h1:735YBRj5NXFrOGX0GoSjwzUIzbz8kiEOfADsqHFmHgE= +sigs.k8s.io/gateway-api v1.6.0/go.mod h1:FVfx3t389ybeXOqvDghLbdvJdSCfI/PReqCUI3lu3mY= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= -sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.4.0 h1:qmp2e3ZfFi1/jJbDGpD4mt3wyp6PE1NfKHCYLqgNQJo= +sigs.k8s.io/structured-merge-diff/v6 v6.4.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/internal/app/l4_controller_test.go b/internal/app/l4_controller_test.go index 61ef2898..f33aa71e 100644 --- a/internal/app/l4_controller_test.go +++ b/internal/app/l4_controller_test.go @@ -12,7 +12,6 @@ import ( apitypes "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" "github.com/gemyago/oke-gateway-api/internal/diag" ) @@ -126,7 +125,7 @@ func TestTCPRouteController(t *testing.T) { req := reconcile.Request{NamespacedName: apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}} t.Run("programs resolved route", func(t *testing.T) { - model := &stubTCPRouteModel{resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}} + model := &stubTCPRouteModel{resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}} controller := NewTCPRouteController(TCPRouteControllerDeps{ RootLogger: diag.RootTestLogger(), TCPRouteModel: model, @@ -141,7 +140,7 @@ func TestTCPRouteController(t *testing.T) { t.Run("returns busy requeue for network load balancer busy errors", func(t *testing.T) { model := &stubTCPRouteModel{ - resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}, + resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}, programErr: &networkLoadBalancerBusyError{id: "nlb-id"}, } controller := NewTCPRouteController(TCPRouteControllerDeps{ @@ -159,7 +158,7 @@ func TestTCPRouteController(t *testing.T) { t.Run("returns drift requeue for resolved route when interval is configured", func(t *testing.T) { driftInterval := 17 * time.Minute - model := &stubTCPRouteModel{resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}} + model := &stubTCPRouteModel{resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}} controller := NewTCPRouteController(TCPRouteControllerDeps{ RootLogger: diag.RootTestLogger(), TCPRouteModel: model, @@ -175,7 +174,7 @@ func TestTCPRouteController(t *testing.T) { t.Run("returns busy requeue for network load balancer busy errors", func(t *testing.T) { model := &stubTCPRouteModel{ - resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}, + resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}, programErr: &networkLoadBalancerBusyError{id: "nlb-id"}, } controller := NewTCPRouteController(TCPRouteControllerDeps{ @@ -193,7 +192,7 @@ func TestTCPRouteController(t *testing.T) { t.Run("sets rejected status for route status errors", func(t *testing.T) { model := &stubTCPRouteModel{ - resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}, + resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}, programErr: newTCPRouteAcceptedStatusError( gatewayv1.RouteReasonNotAllowedByListeners, "rejected", @@ -213,7 +212,7 @@ func TestTCPRouteController(t *testing.T) { t.Run("deprovisions deleted route with finalizer", func(t *testing.T) { model := &stubTCPRouteModel{resolved: []resolvedTCPRouteDetails{{ - tcpRoute: gatewayv1alpha2.TCPRoute{ObjectMeta: metav1.ObjectMeta{ + tcpRoute: gatewayv1.TCPRoute{ObjectMeta: metav1.ObjectMeta{ DeletionTimestamp: &metav1.Time{}, Finalizers: []string{NetworkLoadBalancerTCPRouteProgrammedFinalizer}, }}, @@ -256,7 +255,7 @@ func TestTCPRouteController(t *testing.T) { t.Run("skips deleted route without finalizer", func(t *testing.T) { model := &stubTCPRouteModel{resolved: []resolvedTCPRouteDetails{{ - tcpRoute: gatewayv1alpha2.TCPRoute{ObjectMeta: metav1.ObjectMeta{DeletionTimestamp: &metav1.Time{}}}, + tcpRoute: gatewayv1.TCPRoute{ObjectMeta: metav1.ObjectMeta{DeletionTimestamp: &metav1.Time{}}}, }}} controller := NewTCPRouteController(TCPRouteControllerDeps{ RootLogger: diag.RootTestLogger(), @@ -272,15 +271,15 @@ func TestTCPRouteController(t *testing.T) { t.Run("wraps program and status errors", func(t *testing.T) { for name, model := range map[string]*stubTCPRouteModel{ "program": { - resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}, + resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}, programErr: errors.New("boom"), }, "set programmed": { - resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}, + resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}, setProgrammedErr: errors.New("boom"), }, "set rejected": { - resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{}}}, + resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{}}}, programErr: newTCPRouteAcceptedStatusError( gatewayv1.RouteReasonNotAllowedByListeners, "rejected", @@ -288,7 +287,7 @@ func TestTCPRouteController(t *testing.T) { setRejectedErr: errors.New("boom"), }, "deprovision": { - resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1alpha2.TCPRoute{ObjectMeta: metav1.ObjectMeta{ + resolved: []resolvedTCPRouteDetails{{tcpRoute: gatewayv1.TCPRoute{ObjectMeta: metav1.ObjectMeta{ DeletionTimestamp: &metav1.Time{}, Finalizers: []string{NetworkLoadBalancerTCPRouteProgrammedFinalizer}, }}}}, @@ -516,7 +515,7 @@ func TestUDPRouteController(t *testing.T) { req := reconcile.Request{NamespacedName: apitypes.NamespacedName{Namespace: "iot", Name: "coap"}} t.Run("programs resolved route", func(t *testing.T) { - model := &stubUDPRouteModel{resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}} + model := &stubUDPRouteModel{resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}} controller := NewUDPRouteController(UDPRouteControllerDeps{ RootLogger: diag.RootTestLogger(), UDPRouteModel: model, @@ -531,7 +530,7 @@ func TestUDPRouteController(t *testing.T) { t.Run("returns busy requeue for network load balancer busy errors", func(t *testing.T) { model := &stubUDPRouteModel{ - resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}, + resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}, programErr: &networkLoadBalancerBusyError{id: "nlb-id"}, } controller := NewUDPRouteController(UDPRouteControllerDeps{ @@ -549,7 +548,7 @@ func TestUDPRouteController(t *testing.T) { t.Run("returns drift requeue for resolved route when interval is configured", func(t *testing.T) { driftInterval := 19 * time.Minute - model := &stubUDPRouteModel{resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}} + model := &stubUDPRouteModel{resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}} controller := NewUDPRouteController(UDPRouteControllerDeps{ RootLogger: diag.RootTestLogger(), UDPRouteModel: model, @@ -565,7 +564,7 @@ func TestUDPRouteController(t *testing.T) { t.Run("returns busy requeue for network load balancer busy errors", func(t *testing.T) { model := &stubUDPRouteModel{ - resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}, + resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}, programErr: &networkLoadBalancerBusyError{id: "nlb-id"}, } controller := NewUDPRouteController(UDPRouteControllerDeps{ @@ -583,7 +582,7 @@ func TestUDPRouteController(t *testing.T) { t.Run("sets rejected status for route status errors", func(t *testing.T) { model := &stubUDPRouteModel{ - resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}, + resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}, programErr: newUDPRouteAcceptedStatusError( gatewayv1.RouteReasonNotAllowedByListeners, "rejected", @@ -603,7 +602,7 @@ func TestUDPRouteController(t *testing.T) { t.Run("deprovisions deleted route with finalizer", func(t *testing.T) { model := &stubUDPRouteModel{resolved: []resolvedUDPRouteDetails{{ - udpRoute: gatewayv1alpha2.UDPRoute{ObjectMeta: metav1.ObjectMeta{ + udpRoute: gatewayv1.UDPRoute{ObjectMeta: metav1.ObjectMeta{ DeletionTimestamp: &metav1.Time{}, Finalizers: []string{NetworkLoadBalancerUDPRouteProgrammedFinalizer}, }}, @@ -646,7 +645,7 @@ func TestUDPRouteController(t *testing.T) { t.Run("skips deleted route without finalizer", func(t *testing.T) { model := &stubUDPRouteModel{resolved: []resolvedUDPRouteDetails{{ - udpRoute: gatewayv1alpha2.UDPRoute{ObjectMeta: metav1.ObjectMeta{DeletionTimestamp: &metav1.Time{}}}, + udpRoute: gatewayv1.UDPRoute{ObjectMeta: metav1.ObjectMeta{DeletionTimestamp: &metav1.Time{}}}, }}} controller := NewUDPRouteController(UDPRouteControllerDeps{ RootLogger: diag.RootTestLogger(), @@ -662,15 +661,15 @@ func TestUDPRouteController(t *testing.T) { t.Run("wraps program and status errors", func(t *testing.T) { for name, model := range map[string]*stubUDPRouteModel{ "program": { - resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}, + resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}, programErr: errors.New("boom"), }, "set programmed": { - resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}, + resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}, setProgrammedErr: errors.New("boom"), }, "set rejected": { - resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{}}}, + resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{}}}, programErr: newUDPRouteAcceptedStatusError( gatewayv1.RouteReasonNotAllowedByListeners, "rejected", @@ -678,7 +677,7 @@ func TestUDPRouteController(t *testing.T) { setRejectedErr: errors.New("boom"), }, "deprovision": { - resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1alpha2.UDPRoute{ObjectMeta: metav1.ObjectMeta{ + resolved: []resolvedUDPRouteDetails{{udpRoute: gatewayv1.UDPRoute{ObjectMeta: metav1.ObjectMeta{ DeletionTimestamp: &metav1.Time{}, Finalizers: []string{NetworkLoadBalancerUDPRouteProgrammedFinalizer}, }}}}, diff --git a/internal/app/l4_route_model_helpers_test.go b/internal/app/l4_route_model_helpers_test.go index c163343c..a24cdf13 100644 --- a/internal/app/l4_route_model_helpers_test.go +++ b/internal/app/l4_route_model_helpers_test.go @@ -15,22 +15,21 @@ import ( apitypes "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" "github.com/gemyago/oke-gateway-api/internal/diag" "github.com/gemyago/oke-gateway-api/internal/services/k8sapi" ) -func mustTCPRoute(t *testing.T, obj client.Object) *gatewayv1alpha2.TCPRoute { +func mustTCPRoute(t *testing.T, obj client.Object) *gatewayv1.TCPRoute { t.Helper() - route, ok := obj.(*gatewayv1alpha2.TCPRoute) + route, ok := obj.(*gatewayv1.TCPRoute) require.True(t, ok) return route } -func mustUDPRoute(t *testing.T, obj client.Object) *gatewayv1alpha2.UDPRoute { +func mustUDPRoute(t *testing.T, obj client.Object) *gatewayv1.UDPRoute { t.Helper() - route, ok := obj.(*gatewayv1alpha2.UDPRoute) + route, ok := obj.(*gatewayv1.UDPRoute) require.True(t, ok) return route } @@ -312,9 +311,9 @@ func TestL4RouteModelSetRejected(t *testing.T) { Update(t.Context(), mock.Anything). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { switch route := obj.(type) { - case *gatewayv1alpha2.TCPRoute: + case *gatewayv1.TCPRoute: require.Len(t, route.Status.Parents, 1) - case *gatewayv1alpha2.UDPRoute: + case *gatewayv1.UDPRoute: require.Len(t, route.Status.Parents, 1) case *gatewayv1.TLSRoute: require.Len(t, route.Status.Parents, 1) @@ -327,7 +326,7 @@ func TestL4RouteModelSetRejected(t *testing.T) { if tc.routeKind == "tcp" { model := newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) err := model.setRejected(t.Context(), resolvedTCPRouteDetails{ - tcpRoute: gatewayv1alpha2.TCPRoute{ObjectMeta: metav1.ObjectMeta{Name: "rtmp", Generation: 1}}, + tcpRoute: gatewayv1.TCPRoute{ObjectMeta: metav1.ObjectMeta{Name: "rtmp", Generation: 1}}, matchedRef: gatewayv1.ParentReference{Name: "edge"}, }, newTCPRouteAcceptedStatusError(gatewayv1.RouteReasonNotAllowedByListeners, "blocked")) require.NoError(t, err) @@ -351,7 +350,7 @@ func TestL4RouteModelSetRejected(t *testing.T) { model := newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) err := model.setRejected(t.Context(), resolvedUDPRouteDetails{ - udpRoute: gatewayv1alpha2.UDPRoute{ObjectMeta: metav1.ObjectMeta{Name: "coap", Generation: 1}}, + udpRoute: gatewayv1.UDPRoute{ObjectMeta: metav1.ObjectMeta{Name: "coap", Generation: 1}}, matchedRef: gatewayv1.ParentReference{Name: "edge"}, }, newUDPRouteAcceptedStatusError(gatewayv1.RouteReasonNotAllowedByListeners, "blocked")) require.NoError(t, err) diff --git a/internal/app/l4_route_model_integration_test.go b/internal/app/l4_route_model_integration_test.go index 48788d33..2e374cea 100644 --- a/internal/app/l4_route_model_integration_test.go +++ b/internal/app/l4_route_model_integration_test.go @@ -16,7 +16,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" "github.com/gemyago/oke-gateway-api/internal/diag" @@ -30,7 +29,6 @@ func newL4TestScheme(t *testing.T) *runtime.Scheme { require.NoError(t, corev1.AddToScheme(scheme)) require.NoError(t, discoveryv1.AddToScheme(scheme)) require.NoError(t, gatewayv1.Install(scheme)) - require.NoError(t, gatewayv1alpha2.Install(scheme)) require.NoError(t, gatewayv1beta1.Install(scheme)) require.NoError(t, types.AddKnownTypes(scheme)) return scheme @@ -98,15 +96,15 @@ func TestTCPRouteModelResolveAndProgram(t *testing.T) { Protocol: gatewayv1.TCPProtocolType, Port: port, } - route := &gatewayv1alpha2.TCPRoute{ + route := &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp", Generation: 7}, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("rtmp"))}, }, }, - Rules: []gatewayv1alpha2.TCPRouteRule{ + Rules: []gatewayv1.TCPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ { @@ -125,7 +123,7 @@ func TestTCPRouteModelResolveAndProgram(t *testing.T) { k8sClient := fake.NewClientBuilder(). WithScheme(newL4TestScheme(t)). WithRuntimeObjects(objects...). - WithStatusSubresource(&gatewayv1alpha2.TCPRoute{}). + WithStatusSubresource(&gatewayv1.TCPRoute{}). Build() nlbClient := &stubNetworkLoadBalancerClient{} model := newTCPRouteModel(tcpRouteModelDeps{ @@ -164,7 +162,7 @@ func TestTCPRouteModelResolveAndProgram(t *testing.T) { err = model.setProgrammed(t.Context(), resolved[0]) require.NoError(t, err) - var updated gatewayv1alpha2.TCPRoute + var updated gatewayv1.TCPRoute require.NoError(t, k8sClient.Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, &updated)) assert.Contains(t, updated.Finalizers, NetworkLoadBalancerTCPRouteProgrammedFinalizer) assert.Len(t, updated.Status.Parents, 1) @@ -177,7 +175,7 @@ func TestUDPRouteModelResolveAndProgram(t *testing.T) { Protocol: gatewayv1.UDPProtocolType, Port: port, } - route := &gatewayv1alpha2.UDPRoute{ + route := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -186,13 +184,13 @@ func TestUDPRouteModelResolveAndProgram(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "9000", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("coap"))}, }, }, - Rules: []gatewayv1alpha2.UDPRouteRule{ + Rules: []gatewayv1.UDPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ { @@ -211,7 +209,7 @@ func TestUDPRouteModelResolveAndProgram(t *testing.T) { k8sClient := fake.NewClientBuilder(). WithScheme(newL4TestScheme(t)). WithRuntimeObjects(objects...). - WithStatusSubresource(&gatewayv1alpha2.UDPRoute{}). + WithStatusSubresource(&gatewayv1.UDPRoute{}). Build() nlbClient := &stubNetworkLoadBalancerClient{} model := newUDPRouteModel(udpRouteModelDeps{ @@ -250,7 +248,7 @@ func TestUDPRouteModelResolveAndProgram(t *testing.T) { err = model.setProgrammed(t.Context(), resolved[0]) require.NoError(t, err) - var updated gatewayv1alpha2.UDPRoute + var updated gatewayv1.UDPRoute require.NoError(t, k8sClient.Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, &updated)) assert.Contains(t, updated.Finalizers, NetworkLoadBalancerUDPRouteProgrammedFinalizer) assert.Len(t, updated.Status.Parents, 1) @@ -386,9 +384,9 @@ func TestL4RouteEndpointBackendResolution(t *testing.T) { RootLogger: diag.RootTestLogger(), K8sClient: k8sClient, })) - tcpRoute := gatewayv1alpha2.TCPRoute{ + tcpRoute := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{Rules: []gatewayv1alpha2.TCPRouteRule{ + Spec: gatewayv1.TCPRouteSpec{Rules: []gatewayv1.TCPRouteRule{ {BackendRefs: []gatewayv1.BackendRef{ { BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, @@ -405,9 +403,9 @@ func TestL4RouteEndpointBackendResolution(t *testing.T) { }}, }}, } - udpRoute := gatewayv1alpha2.UDPRoute{ + udpRoute := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{Rules: []gatewayv1alpha2.UDPRouteRule{ + Spec: gatewayv1.UDPRouteSpec{Rules: []gatewayv1.UDPRouteRule{ {BackendRefs: []gatewayv1.BackendRef{ { BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, @@ -458,9 +456,9 @@ func TestL4RouteResolveRequestBranches(t *testing.T) { tcpPort := gatewayv1.PortNumber(1935) udpPort := gatewayv1.PortNumber(5684) serviceKindRef := gatewayv1.Kind(serviceKind) - tcpRoute := &gatewayv1alpha2.TCPRoute{ + tcpRoute := &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Kind: &serviceKindRef, Name: "ignored"}, {Name: "missing"}, @@ -471,9 +469,9 @@ func TestL4RouteResolveRequestBranches(t *testing.T) { }, }}, } - udpRoute := &gatewayv1alpha2.UDPRoute{ + udpRoute := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Kind: &serviceKindRef, Name: "ignored"}, {Name: "missing"}, @@ -548,7 +546,7 @@ func TestL4RouteResolveRequestBranches(t *testing.T) { k8sClient := fake.NewClientBuilder(). WithScheme(newL4TestScheme(t)). WithRuntimeObjects(objects...). - WithStatusSubresource(&gatewayv1alpha2.TCPRoute{}, &gatewayv1alpha2.UDPRoute{}). + WithStatusSubresource(&gatewayv1.TCPRoute{}, &gatewayv1.UDPRoute{}). Build() tcpModel := newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: k8sClient}) udpModel := newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: k8sClient}) @@ -585,7 +583,7 @@ func TestL4RouteProgramRouteStaleAndUpToDate(t *testing.T) { routeKey := apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"} objects := l4GatewayObjects(listener) if protocol == gatewayv1.TCPProtocolType { - objects = append(objects, &gatewayv1alpha2.TCPRoute{ + objects = append(objects, &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: routeKey.Namespace, Name: routeKey.Name, @@ -594,17 +592,17 @@ func TestL4RouteProgramRouteStaleAndUpToDate(t *testing.T) { NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation: "bs_old", }, }, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.TCPRouteRule{{BackendRefs: []gatewayv1.BackendRef{{ + Rules: []gatewayv1.TCPRouteRule{{BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}}}, }, }) } else { - objects = append(objects, &gatewayv1alpha2.UDPRoute{ + objects = append(objects, &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: routeKey.Namespace, Name: routeKey.Name, @@ -614,11 +612,11 @@ func TestL4RouteProgramRouteStaleAndUpToDate(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "1935", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.UDPRouteRule{{BackendRefs: []gatewayv1.BackendRef{{ + Rules: []gatewayv1.UDPRouteRule{{BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}}}, }, @@ -648,7 +646,7 @@ func TestL4RouteProgramRouteStaleAndUpToDate(t *testing.T) { OciNetworkLoadBalancerAPI: nlbClient, WorkRequestsWatcher: &stubWorkRequestsWatcher{}, }) - var route gatewayv1alpha2.TCPRoute + var route gatewayv1.TCPRoute require.NoError(t, k8sClient.Get(t.Context(), routeKey, &route)) err := model.programRoute(t.Context(), resolvedTCPRouteDetails{ gatewayDetails: details, @@ -664,7 +662,7 @@ func TestL4RouteProgramRouteStaleAndUpToDate(t *testing.T) { OciNetworkLoadBalancerAPI: nlbClient, WorkRequestsWatcher: &stubWorkRequestsWatcher{}, }) - var route gatewayv1alpha2.UDPRoute + var route gatewayv1.UDPRoute require.NoError(t, k8sClient.Get(t.Context(), routeKey, &route)) err := model.programRoute(t.Context(), resolvedUDPRouteDetails{ gatewayDetails: details, diff --git a/internal/app/tcproute_model.go b/internal/app/tcproute_model.go index ae7aad50..3b93f54d 100644 --- a/internal/app/tcproute_model.go +++ b/internal/app/tcproute_model.go @@ -20,14 +20,13 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" "github.com/gemyago/oke-gateway-api/internal/types" ) type resolvedTCPRouteDetails struct { gatewayDetails resolvedGatewayDetails - tcpRoute gatewayv1alpha2.TCPRoute + tcpRoute gatewayv1.TCPRoute matchedRef gatewayv1.ParentReference matchedListener gatewayv1.Listener } @@ -109,7 +108,7 @@ func tcpRouteMatchesListener(parentRef gatewayv1.ParentReference, listener gatew return true } -func tcpRouteKey(route gatewayv1alpha2.TCPRoute) string { +func tcpRouteKey(route gatewayv1.TCPRoute) string { return fmt.Sprintf("%s/%s", route.Namespace, route.Name) } @@ -137,7 +136,7 @@ func (m *tcpRouteModelImpl) resolveRequest( ctx context.Context, req reconcile.Request, ) ([]resolvedTCPRouteDetails, error) { - route := &gatewayv1alpha2.TCPRoute{} + route := &gatewayv1.TCPRoute{} return resolveL4RouteRequest(ctx, resolveL4RouteRequestParams[resolvedTCPRouteDetails]{ k8sClient: m.client, logger: m.logger, @@ -215,7 +214,7 @@ func resolveL4RouteRequest[D any]( func (m *tcpRouteModelImpl) resolveParentRef( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, parentRef gatewayv1.ParentReference, ) ([]resolvedTCPRouteDetails, bool, error) { gatewayDetails, resolved, err := m.resolveParentGateway(ctx, route.Namespace, parentRef) @@ -301,7 +300,7 @@ func resolveL4ParentGateway( func (m *tcpRouteModelImpl) rejectNoMatchingListener( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, parentRef gatewayv1.ParentReference, ) error { gatewayDetails, resolved, err := m.resolveParentGateway(ctx, route.Namespace, parentRef) @@ -324,7 +323,7 @@ func (m *tcpRouteModelImpl) rejectNoMatchingListener( func (m *tcpRouteModelImpl) handleUnresolvedFinalizedRoute( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, ) error { if route.DeletionTimestamp != nil { return m.removeDeletingRouteFinalizer(ctx, route) @@ -334,7 +333,7 @@ func (m *tcpRouteModelImpl) handleUnresolvedFinalizedRoute( func (m *tcpRouteModelImpl) removeDeletingRouteFinalizer( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, ) error { routeToUpdate := route.DeepCopy() controllerutil.RemoveFinalizer(routeToUpdate, NetworkLoadBalancerTCPRouteProgrammedFinalizer) @@ -351,7 +350,7 @@ func (m *tcpRouteModelImpl) removeDeletingRouteFinalizer( func (m *tcpRouteModelImpl) endpointBackendsForRoute( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, ) ([]networkloadbalancer.BackendDetails, error) { desired := make(map[string]networkloadbalancer.BackendDetails) @@ -372,7 +371,7 @@ func (m *tcpRouteModelImpl) endpointBackendsForRoute( func (m *tcpRouteModelImpl) endpointBackendsForBackendRef( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, backendRef gatewayv1.BackendRef, ) ([]networkloadbalancer.BackendDetails, error) { weight := l4BackendRefWeight(backendRef) @@ -398,7 +397,7 @@ func (m *tcpRouteModelImpl) endpointBackendsForBackendRef( func (m *tcpRouteModelImpl) resolveBackendRefServicePort( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, backendRef gatewayv1.BackendRef, ) (apitypes.NamespacedName, *corev1.ServicePort, error) { return resolveL4BackendRefServicePort( @@ -581,21 +580,21 @@ func (m *tcpRouteModelImpl) matchingRoutesForListener( details resolvedTCPRouteDetails, excludeRouteKey string, listError string, -) ([]l4RouteListenerMatch[gatewayv1alpha2.TCPRoute], error) { - var routeList gatewayv1alpha2.TCPRouteList - return listMatchingL4RoutesForListener(ctx, listMatchingL4RoutesForListenerParams[gatewayv1alpha2.TCPRoute]{ +) ([]l4RouteListenerMatch[gatewayv1.TCPRoute], error) { + var routeList gatewayv1.TCPRouteList + return listMatchingL4RoutesForListener(ctx, listMatchingL4RoutesForListenerParams[gatewayv1.TCPRoute]{ k8sClient: m.client, routeList: &routeList, listError: listError, - items: func() []gatewayv1alpha2.TCPRoute { return routeList.Items }, + items: func() []gatewayv1.TCPRoute { return routeList.Items }, gatewayName: client.ObjectKeyFromObject(&details.gatewayDetails.gateway), listener: details.matchedListener, excludeRouteKey: excludeRouteKey, routeKey: tcpRouteKey, - routeNamespace: func(route gatewayv1alpha2.TCPRoute) string { return route.Namespace }, - routeCreatedAt: func(route gatewayv1alpha2.TCPRoute) metav1.Time { return route.CreationTimestamp }, - parentRefs: func(route gatewayv1alpha2.TCPRoute) []gatewayv1.ParentReference { return route.Spec.ParentRefs }, - routeDeleted: func(route gatewayv1alpha2.TCPRoute) bool { return route.DeletionTimestamp != nil }, + routeNamespace: func(route gatewayv1.TCPRoute) string { return route.Namespace }, + routeCreatedAt: func(route gatewayv1.TCPRoute) metav1.Time { return route.CreationTimestamp }, + parentRefs: func(route gatewayv1.TCPRoute) []gatewayv1.ParentReference { return route.Spec.ParentRefs }, + routeDeleted: func(route gatewayv1.TCPRoute) bool { return route.DeletionTimestamp != nil }, parentTarget: tcpParentRefTarget, matchesListener: tcpRouteMatchesListener, }) @@ -1106,7 +1105,7 @@ func deprovisionL4Route[D any](ctx context.Context, params deprovisionL4RoutePar func (m *tcpRouteModelImpl) deprovisionDetachedRoute( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, ) error { programmedBackendSets := annotatedBackendSetNames( &route, @@ -1131,7 +1130,7 @@ func (m *tcpRouteModelImpl) deprovisionDetachedRoute( func (m *tcpRouteModelImpl) cleanupDetachedRouteParent( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, parentStatus gatewayv1.RouteParentStatus, programmedBackendSets map[string]struct{}, ) (bool, error) { @@ -1161,7 +1160,7 @@ func (m *tcpRouteModelImpl) cleanupDetachedRouteParent( func (m *tcpRouteModelImpl) resolveDetachedRouteGateway( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, parentStatus gatewayv1.RouteParentStatus, ) (resolvedGatewayDetails, bool, error) { return resolveDetachedL4RouteGateway( @@ -1230,7 +1229,7 @@ func resolveDetachedL4RouteGateway( func (m *tcpRouteModelImpl) removeDetachedRouteFinalizer( ctx context.Context, - route gatewayv1alpha2.TCPRoute, + route gatewayv1.TCPRoute, ) error { routeToUpdate := route.DeepCopy() controllerutil.RemoveFinalizer(routeToUpdate, NetworkLoadBalancerTCPRouteProgrammedFinalizer) diff --git a/internal/app/tcproute_model_test.go b/internal/app/tcproute_model_test.go index 7923e132..f123f81f 100644 --- a/internal/app/tcproute_model_test.go +++ b/internal/app/tcproute_model_test.go @@ -19,7 +19,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" "github.com/gemyago/oke-gateway-api/internal/diag" "github.com/gemyago/oke-gateway-api/internal/services/k8sapi" @@ -110,9 +109,9 @@ func TestTCPRouteModel(t *testing.T) { t.Run("desired backend sets ignore non gateway parent refs", func(t *testing.T) { otherGroup := gatewayv1.Group("example.com") details := resolvedTCPRouteDetails{ - tcpRoute: gatewayv1alpha2.TCPRoute{ + tcpRoute: gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Group: &otherGroup, Name: "edge"}, @@ -137,9 +136,9 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("resolveRequest wraps Kubernetes read errors", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }}, } @@ -153,7 +152,7 @@ func TestTCPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, - mock.AnythingOfType("*v1alpha2.TCPRoute"), + mock.AnythingOfType("*v1.TCPRoute"), ). Return(errors.New("route failed")) }, @@ -165,7 +164,7 @@ func TestTCPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, - mock.AnythingOfType("*v1alpha2.TCPRoute"), + mock.AnythingOfType("*v1.TCPRoute"), ). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustTCPRoute(t, obj)) = route @@ -183,7 +182,7 @@ func TestTCPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, - mock.AnythingOfType("*v1alpha2.TCPRoute"), + mock.AnythingOfType("*v1.TCPRoute"), ). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustTCPRoute(t, obj)) = route @@ -210,7 +209,7 @@ func TestTCPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, - mock.AnythingOfType("*v1alpha2.TCPRoute"), + mock.AnythingOfType("*v1.TCPRoute"), ). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustTCPRoute(t, obj)) = route @@ -262,15 +261,15 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("resolveRequest returns status update errors for unmatched listener", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }}, } mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, mock.AnythingOfType("*v1alpha2.TCPRoute")). + Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustTCPRoute(t, obj)) = route return nil @@ -308,7 +307,7 @@ func TestTCPRouteModel(t *testing.T) { mockStatusWriter := k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). Return(errors.New("status failed")) model := newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) @@ -322,7 +321,7 @@ func TestTCPRouteModel(t *testing.T) { t.Run("resolveRequest removes finalizer from deleting route with no resolved parent", func(t *testing.T) { now := metav1.Now() otherGroup := gatewayv1.Group("example.com") - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -332,19 +331,19 @@ func TestTCPRouteModel(t *testing.T) { NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation: "bs_rtmp", }, }, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Group: &otherGroup, Name: "edge"}}, }}, } mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, mock.AnythingOfType("*v1alpha2.TCPRoute")). + Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp"}, mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustTCPRoute(t, obj)) = route return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { updated := mustTCPRoute(t, obj) assert.NotContains(t, updated.Finalizers, NetworkLoadBalancerTCPRouteProgrammedFinalizer) @@ -362,13 +361,13 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("programRoute rejects route when listener is already owned", func(t *testing.T) { - currentRoute := gatewayv1alpha2.TCPRoute{ + currentRoute := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "z-route", Generation: 1, }, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ { @@ -384,10 +383,10 @@ func TestTCPRouteModel(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.TCPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { - reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1alpha2.TCPRouteList{ - Items: []gatewayv1alpha2.TCPRoute{currentRoute, otherRoute}, + reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1.TCPRouteList{ + Items: []gatewayv1.TCPRoute{currentRoute, otherRoute}, })) return nil }) @@ -423,7 +422,7 @@ func TestTCPRouteModel(t *testing.T) { t.Run("listener ownership helpers return list errors", func(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.TCPRouteList")). Return(errors.New("list failed")). Twice() model := newTCPRouteModel(tcpRouteModelDeps{ @@ -440,23 +439,23 @@ func TestTCPRouteModel(t *testing.T) { t.Run("listener ownership ignores non matching parent refs", func(t *testing.T) { serviceKind := gatewayv1.Kind("Service") - routes := gatewayv1alpha2.TCPRouteList{Items: []gatewayv1alpha2.TCPRoute{ + routes := gatewayv1.TCPRouteList{Items: []gatewayv1.TCPRoute{ { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "service-parent"}, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Kind: &serviceKind, Name: "backend"}}, }}, }, { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "other-gateway"}, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "other"}}, }}, }, }} mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.TCPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().Set(reflect.ValueOf(routes)) return nil @@ -467,20 +466,20 @@ func TestTCPRouteModel(t *testing.T) { gatewayDetails: resolvedGatewayDetails{ gateway: gatewayv1.Gateway{ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "edge"}}, }, - tcpRoute: gatewayv1alpha2.TCPRoute{ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}}, + tcpRoute: gatewayv1.TCPRoute{ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}}, matchedListener: gatewayv1.Listener{Name: "rtmp", Protocol: gatewayv1.TCPProtocolType, Port: 1935}, }) require.NoError(t, err) }) t.Run("deprovisionRoute clears backend set and removes finalizer when no successor exists", func(t *testing.T) { - currentRoute := gatewayv1alpha2.TCPRoute{ + currentRoute := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", Finalizers: []string{NetworkLoadBalancerTCPRouteProgrammedFinalizer}, }, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, @@ -489,15 +488,15 @@ func TestTCPRouteModel(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.TCPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { - reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1alpha2.TCPRouteList{ - Items: []gatewayv1alpha2.TCPRoute{currentRoute}, + reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1.TCPRouteList{ + Items: []gatewayv1.TCPRoute{currentRoute}, })) return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.NotContains(t, obj.GetFinalizers(), NetworkLoadBalancerTCPRouteProgrammedFinalizer) assert.NotContains(t, obj.GetAnnotations(), NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation) @@ -549,10 +548,10 @@ func TestTCPRouteModel(t *testing.T) { K8sClient: fake.NewClientBuilder().WithScheme(newL4TestScheme(t)).Build(), }) modelImpl := mustTCPRouteModelImpl(t, model) - _, err := modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.TCPRoute{ + _, err := modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ - Rules: []gatewayv1alpha2.TCPRouteRule{ + Spec: gatewayv1.TCPRouteSpec{ + Rules: []gatewayv1.TCPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ {BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend"}}, @@ -566,10 +565,10 @@ func TestTCPRouteModel(t *testing.T) { assert.Equal(t, gatewayv1.RouteReasonInvalidKind, statusErr.reason) backendNamespace := gatewayv1.Namespace("other") - _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.TCPRoute{ + _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ - Rules: []gatewayv1alpha2.TCPRouteRule{{ + Spec: gatewayv1.TCPRouteSpec{ + Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{ Namespace: &backendNamespace, @@ -598,10 +597,10 @@ func TestTCPRouteModel(t *testing.T) { Return(errors.New("list failed")) model = newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) modelImpl = mustTCPRouteModelImpl(t, model) - _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.TCPRoute{ + _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ - Rules: []gatewayv1alpha2.TCPRouteRule{{ + Spec: gatewayv1.TCPRouteSpec{ + Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -616,10 +615,10 @@ func TestTCPRouteModel(t *testing.T) { Return(errors.New("get failed")) model = newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) modelImpl = mustTCPRouteModelImpl(t, model) - _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.TCPRoute{ + _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ - Rules: []gatewayv1alpha2.TCPRouteRule{{ + Spec: gatewayv1.TCPRouteSpec{ + Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -630,13 +629,13 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("setProgrammed adds finalizer and backend set annotation", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", Generation: 1, }, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("rtmp"))}, @@ -649,10 +648,10 @@ func TestTCPRouteModel(t *testing.T) { mockStatusWriter := k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). Return(nil) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.Contains(t, obj.GetFinalizers(), NetworkLoadBalancerTCPRouteProgrammedFinalizer) assert.Equal( @@ -694,7 +693,7 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("setProgrammed updates existing parent status and wraps errors", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -704,7 +703,7 @@ func TestTCPRouteModel(t *testing.T) { NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation: "bs_rtmp", }, }, - Status: gatewayv1alpha2.TCPRouteStatus{ + Status: gatewayv1.TCPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, @@ -731,7 +730,7 @@ func TestTCPRouteModel(t *testing.T) { mockStatusWriter := k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { updated := mustTCPRoute(t, obj) require.Len(t, updated.Status.Parents, 1) @@ -743,7 +742,7 @@ func TestTCPRouteModel(t *testing.T) { mockClient = NewMockk8sClient(t) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). Return(errors.New("update failed")) model = newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) details.tcpRoute.Finalizers = nil @@ -755,7 +754,7 @@ func TestTCPRouteModel(t *testing.T) { mockStatusWriter = k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). Return(errors.New("status failed")) model = newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) details.tcpRoute = route @@ -764,7 +763,7 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute clears annotated backend set and removes finalizer", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -773,7 +772,7 @@ func TestTCPRouteModel(t *testing.T) { NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation: "bs_old", }, }, - Status: gatewayv1alpha2.TCPRouteStatus{ + Status: gatewayv1.TCPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{ { @@ -816,7 +815,7 @@ func TestTCPRouteModel(t *testing.T) { return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.NotContains(t, obj.GetFinalizers(), NetworkLoadBalancerTCPRouteProgrammedFinalizer) assert.NotContains(t, obj.GetAnnotations(), NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation) @@ -863,7 +862,7 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute removes finalizer when no backend sets are annotated", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -872,7 +871,7 @@ func TestTCPRouteModel(t *testing.T) { } mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.NotContains(t, obj.GetFinalizers(), NetworkLoadBalancerTCPRouteProgrammedFinalizer) return nil @@ -890,7 +889,7 @@ func TestTCPRouteModel(t *testing.T) { t.Run("deprovisionDetachedRoute returns finalizer update error "+ "when no backend sets are annotated", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -898,7 +897,7 @@ func TestTCPRouteModel(t *testing.T) { }, } mockClient := NewMockk8sClient(t) - mockClient.EXPECT().Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + mockClient.EXPECT().Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). Return(errors.New("update failed")) model := newTCPRouteModel(tcpRouteModelDeps{ RootLogger: diag.RootTestLogger(), @@ -912,7 +911,7 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute returns cleanup and update errors", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -921,7 +920,7 @@ func TestTCPRouteModel(t *testing.T) { NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation: "bs_old", }, }, - Status: gatewayv1alpha2.TCPRouteStatus{ + Status: gatewayv1.TCPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, @@ -986,7 +985,7 @@ func TestTCPRouteModel(t *testing.T) { return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). Return(errors.New("update failed")) model = newTCPRouteModel(tcpRouteModelDeps{ RootLogger: diag.RootTestLogger(), @@ -1005,7 +1004,7 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute returns gateway read errors", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -1014,7 +1013,7 @@ func TestTCPRouteModel(t *testing.T) { NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation: "bs_old", }, }, - Status: gatewayv1alpha2.TCPRouteStatus{ + Status: gatewayv1.TCPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, @@ -1107,14 +1106,14 @@ func TestTCPRouteModel(t *testing.T) { port := gatewayv1.PortNumber(1935) listener := gatewayv1.Listener{Name: "rtmp", Protocol: gatewayv1.TCPProtocolType, Port: port} now := metav1.Now() - currentRoute := &gatewayv1alpha2.TCPRoute{ + currentRoute := &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp-old", Finalizers: []string{NetworkLoadBalancerTCPRouteProgrammedFinalizer}, DeletionTimestamp: &now, }, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("rtmp"))}, @@ -1122,15 +1121,15 @@ func TestTCPRouteModel(t *testing.T) { }, }, } - nextRoute := &gatewayv1alpha2.TCPRoute{ + nextRoute := &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp-new", Generation: 2}, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("rtmp"))}, }, }, - Rules: []gatewayv1alpha2.TCPRouteRule{{ + Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1142,7 +1141,7 @@ func TestTCPRouteModel(t *testing.T) { k8sClient := fake.NewClientBuilder(). WithScheme(newL4TestScheme(t)). WithRuntimeObjects(objects...). - WithStatusSubresource(&gatewayv1alpha2.TCPRoute{}). + WithStatusSubresource(&gatewayv1.TCPRoute{}). Build() nlbClient := &stubNetworkLoadBalancerClient{} model := newTCPRouteModel(tcpRouteModelDeps{ @@ -1172,7 +1171,7 @@ func TestTCPRouteModel(t *testing.T) { require.NoError(t, err) require.Len(t, nlbClient.updateBackendSetRequests, 1) - var updatedNext gatewayv1alpha2.TCPRoute + var updatedNext gatewayv1.TCPRoute require.NoError(t, k8sClient.Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "rtmp-new"}, @@ -1184,7 +1183,7 @@ func TestTCPRouteModel(t *testing.T) { t.Run("deprovisionRoute wraps list update and next route errors", func(t *testing.T) { listener := gatewayv1.Listener{Name: "rtmp", Protocol: gatewayv1.TCPProtocolType, Port: 1935} - currentRoute := gatewayv1alpha2.TCPRoute{ + currentRoute := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp-old", @@ -1201,7 +1200,7 @@ func TestTCPRouteModel(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.TCPRouteList")). Return(errors.New("list failed")) model := newTCPRouteModel(tcpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) err := model.deprovisionRoute(t.Context(), details) @@ -1209,15 +1208,15 @@ func TestTCPRouteModel(t *testing.T) { mockClient = NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.TCPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { - reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1alpha2.TCPRouteList{ - Items: []gatewayv1alpha2.TCPRoute{currentRoute}, + reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1.TCPRouteList{ + Items: []gatewayv1.TCPRoute{currentRoute}, })) return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.TCPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.TCPRoute")). Return(errors.New("update failed")) model = newTCPRouteModel(tcpRouteModelDeps{ RootLogger: diag.RootTestLogger(), @@ -1234,13 +1233,13 @@ func TestTCPRouteModel(t *testing.T) { now := metav1.Now() deletingRoute := currentRoute deletingRoute.DeletionTimestamp = &now - nextRoute := &gatewayv1alpha2.TCPRoute{ + nextRoute := &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp-new"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.TCPRouteRule{ + Rules: []gatewayv1.TCPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ {BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend"}}, @@ -1274,13 +1273,13 @@ func TestTCPRouteModel(t *testing.T) { t.Run("programRoute returns update and wait errors", func(t *testing.T) { port := gatewayv1.PortNumber(1935) - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.TCPRouteRule{{ + Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1352,13 +1351,13 @@ func TestTCPRouteModel(t *testing.T) { t.Run("programRoute returns busy error for backend set update conflict", func(t *testing.T) { port := gatewayv1.PortNumber(1935) - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.TCPRouteRule{{ + Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1409,7 +1408,7 @@ func TestTCPRouteModel(t *testing.T) { t.Run("programRoute returns busy error when NLB is already updating", func(t *testing.T) { port := gatewayv1.PortNumber(1935) listener := gatewayv1.Listener{Name: "rtmp", Protocol: gatewayv1.TCPProtocolType, Port: port} - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, } nlbClient := &stubNetworkLoadBalancerClient{} @@ -1451,7 +1450,7 @@ func TestTCPRouteModel(t *testing.T) { }, }, } - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "other", Name: "rtmp", @@ -1491,13 +1490,13 @@ func TestTCPRouteModel(t *testing.T) { t.Run("programRoute skips update when backend set is current", func(t *testing.T) { port := gatewayv1.PortNumber(1935) listener := gatewayv1.Listener{Name: "rtmp", Protocol: gatewayv1.TCPProtocolType, Port: port} - route := &gatewayv1alpha2.TCPRoute{ + route := &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.TCPRouteRule{{ + Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1625,7 +1624,7 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("clearStaleBackendSets keeps desired backend set", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -1654,7 +1653,7 @@ func TestTCPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute skips unresolved gateway references", func(t *testing.T) { - route := gatewayv1alpha2.TCPRoute{ + route := gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "rtmp", @@ -1663,7 +1662,7 @@ func TestTCPRouteModel(t *testing.T) { NetworkLoadBalancerTCPRouteProgrammedBackendSetsAnnotation: "bs_rtmp", }, }, - Status: gatewayv1alpha2.TCPRouteStatus{ + Status: gatewayv1.TCPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, diff --git a/internal/app/udproute_model.go b/internal/app/udproute_model.go index 28815b4e..e4fa8807 100644 --- a/internal/app/udproute_model.go +++ b/internal/app/udproute_model.go @@ -18,12 +18,11 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) type resolvedUDPRouteDetails struct { gatewayDetails resolvedGatewayDetails - udpRoute gatewayv1alpha2.UDPRoute + udpRoute gatewayv1.UDPRoute matchedRef gatewayv1.ParentReference matchedListener gatewayv1.Listener } @@ -105,7 +104,7 @@ func udpRouteMatchesListener(parentRef gatewayv1.ParentReference, listener gatew return true } -func udpRouteKey(route gatewayv1alpha2.UDPRoute) string { +func udpRouteKey(route gatewayv1.UDPRoute) string { return fmt.Sprintf("%s/%s", route.Namespace, route.Name) } @@ -133,7 +132,7 @@ func (m *udpRouteModelImpl) resolveRequest( ctx context.Context, req reconcile.Request, ) ([]resolvedUDPRouteDetails, error) { - route := &gatewayv1alpha2.UDPRoute{} + route := &gatewayv1.UDPRoute{} return resolveL4RouteRequest(ctx, resolveL4RouteRequestParams[resolvedUDPRouteDetails]{ k8sClient: m.client, logger: m.logger, @@ -158,7 +157,7 @@ func (m *udpRouteModelImpl) resolveRequest( func (m *udpRouteModelImpl) resolveParentRef( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, parentRef gatewayv1.ParentReference, ) ([]resolvedUDPRouteDetails, bool, error) { gatewayDetails, resolved, err := m.resolveParentGateway(ctx, route.Namespace, parentRef) @@ -191,7 +190,7 @@ func (m *udpRouteModelImpl) resolveParentGateway( func (m *udpRouteModelImpl) rejectNoMatchingListener( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, parentRef gatewayv1.ParentReference, ) error { gatewayDetails, resolved, err := m.resolveParentGateway(ctx, route.Namespace, parentRef) @@ -214,7 +213,7 @@ func (m *udpRouteModelImpl) rejectNoMatchingListener( func (m *udpRouteModelImpl) handleUnresolvedFinalizedRoute( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, ) error { if route.DeletionTimestamp != nil { return m.removeDeletingRouteFinalizer(ctx, route) @@ -224,7 +223,7 @@ func (m *udpRouteModelImpl) handleUnresolvedFinalizedRoute( func (m *udpRouteModelImpl) removeDeletingRouteFinalizer( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, ) error { routeToUpdate := route.DeepCopy() controllerutil.RemoveFinalizer(routeToUpdate, NetworkLoadBalancerUDPRouteProgrammedFinalizer) @@ -241,7 +240,7 @@ func (m *udpRouteModelImpl) removeDeletingRouteFinalizer( func (m *udpRouteModelImpl) endpointBackendsForRoute( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, ) ([]networkloadbalancer.BackendDetails, error) { desired := make(map[string]networkloadbalancer.BackendDetails) @@ -262,7 +261,7 @@ func (m *udpRouteModelImpl) endpointBackendsForRoute( func (m *udpRouteModelImpl) endpointBackendsForBackendRef( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, backendRef gatewayv1.BackendRef, ) ([]networkloadbalancer.BackendDetails, error) { weight := l4BackendRefWeight(backendRef) @@ -288,7 +287,7 @@ func (m *udpRouteModelImpl) endpointBackendsForBackendRef( func (m *udpRouteModelImpl) resolveBackendRefServicePort( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, backendRef gatewayv1.BackendRef, ) (apitypes.NamespacedName, *corev1.ServicePort, error) { return resolveL4BackendRefServicePort( @@ -378,23 +377,23 @@ func (m *udpRouteModelImpl) matchingRoutesForListener( details resolvedUDPRouteDetails, excludeRouteKey string, listError string, -) ([]l4RouteListenerMatch[gatewayv1alpha2.UDPRoute], error) { - var routeList gatewayv1alpha2.UDPRouteList - params := listMatchingL4RoutesForListenerParams[gatewayv1alpha2.UDPRoute]{ +) ([]l4RouteListenerMatch[gatewayv1.UDPRoute], error) { + var routeList gatewayv1.UDPRouteList + params := listMatchingL4RoutesForListenerParams[gatewayv1.UDPRoute]{ k8sClient: m.client, routeList: &routeList, listError: listError, - items: func() []gatewayv1alpha2.UDPRoute { return routeList.Items }, + items: func() []gatewayv1.UDPRoute { return routeList.Items }, routeKey: udpRouteKey, parentTarget: udpParentRefTarget, } params.gatewayName = client.ObjectKeyFromObject(&details.gatewayDetails.gateway) params.listener = details.matchedListener params.excludeRouteKey = excludeRouteKey - params.routeNamespace = func(route gatewayv1alpha2.UDPRoute) string { return route.Namespace } - params.routeCreatedAt = func(route gatewayv1alpha2.UDPRoute) metav1.Time { return route.CreationTimestamp } - params.parentRefs = func(route gatewayv1alpha2.UDPRoute) []gatewayv1.ParentReference { return route.Spec.ParentRefs } - params.routeDeleted = func(route gatewayv1alpha2.UDPRoute) bool { return route.DeletionTimestamp != nil } + params.routeNamespace = func(route gatewayv1.UDPRoute) string { return route.Namespace } + params.routeCreatedAt = func(route gatewayv1.UDPRoute) metav1.Time { return route.CreationTimestamp } + params.parentRefs = func(route gatewayv1.UDPRoute) []gatewayv1.ParentReference { return route.Spec.ParentRefs } + params.routeDeleted = func(route gatewayv1.UDPRoute) bool { return route.DeletionTimestamp != nil } params.matchesListener = udpRouteMatchesListener return listMatchingL4RoutesForListener(ctx, params) } @@ -685,7 +684,7 @@ func (m *udpRouteModelImpl) deprovisionRoute( func (m *udpRouteModelImpl) deprovisionDetachedRoute( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, ) error { programmedBackendSets := annotatedBackendSetNames( &route, @@ -710,7 +709,7 @@ func (m *udpRouteModelImpl) deprovisionDetachedRoute( func (m *udpRouteModelImpl) cleanupDetachedRouteParent( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, parentStatus gatewayv1.RouteParentStatus, programmedBackendSets map[string]struct{}, ) (bool, error) { @@ -740,7 +739,7 @@ func (m *udpRouteModelImpl) cleanupDetachedRouteParent( func (m *udpRouteModelImpl) resolveDetachedRouteGateway( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, parentStatus gatewayv1.RouteParentStatus, ) (resolvedGatewayDetails, bool, error) { return resolveDetachedL4RouteGateway( @@ -753,7 +752,7 @@ func (m *udpRouteModelImpl) resolveDetachedRouteGateway( func (m *udpRouteModelImpl) removeDetachedRouteFinalizer( ctx context.Context, - route gatewayv1alpha2.UDPRoute, + route gatewayv1.UDPRoute, ) error { routeToUpdate := route.DeepCopy() controllerutil.RemoveFinalizer(routeToUpdate, NetworkLoadBalancerUDPRouteProgrammedFinalizer) diff --git a/internal/app/udproute_model_test.go b/internal/app/udproute_model_test.go index 53a61047..3c6dbd48 100644 --- a/internal/app/udproute_model_test.go +++ b/internal/app/udproute_model_test.go @@ -19,7 +19,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" "github.com/gemyago/oke-gateway-api/internal/diag" "github.com/gemyago/oke-gateway-api/internal/services/k8sapi" @@ -48,9 +47,9 @@ func TestUDPRouteModel(t *testing.T) { t.Run("desired backend sets ignore non gateway parent refs", func(t *testing.T) { otherGroup := gatewayv1.Group("example.com") details := resolvedUDPRouteDetails{ - udpRoute: gatewayv1alpha2.UDPRoute{ + udpRoute: gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Group: &otherGroup, Name: "edge"}, @@ -75,7 +74,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("resolveRequest wraps Kubernetes read errors", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -83,7 +82,7 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "5684", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }}, } @@ -97,7 +96,7 @@ func TestUDPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, - mock.AnythingOfType("*v1alpha2.UDPRoute"), + mock.AnythingOfType("*v1.UDPRoute"), ). Return(errors.New("route failed")) }, @@ -109,7 +108,7 @@ func TestUDPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, - mock.AnythingOfType("*v1alpha2.UDPRoute"), + mock.AnythingOfType("*v1.UDPRoute"), ). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustUDPRoute(t, obj)) = route @@ -127,7 +126,7 @@ func TestUDPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, - mock.AnythingOfType("*v1alpha2.UDPRoute"), + mock.AnythingOfType("*v1.UDPRoute"), ). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustUDPRoute(t, obj)) = route @@ -154,7 +153,7 @@ func TestUDPRouteModel(t *testing.T) { Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, - mock.AnythingOfType("*v1alpha2.UDPRoute"), + mock.AnythingOfType("*v1.UDPRoute"), ). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustUDPRoute(t, obj)) = route @@ -206,15 +205,15 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("resolveRequest returns status update errors for unmatched listener", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }}, } mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, mock.AnythingOfType("*v1alpha2.UDPRoute")). + Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustUDPRoute(t, obj)) = route return nil @@ -252,7 +251,7 @@ func TestUDPRouteModel(t *testing.T) { mockStatusWriter := k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). Return(errors.New("status failed")) model := newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) @@ -266,7 +265,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("resolveRequest removes finalizer from deleting route with no resolved parent", func(t *testing.T) { now := metav1.Now() otherGroup := gatewayv1.Group("example.com") - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -276,19 +275,19 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation: "bs_coap", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Group: &otherGroup, Name: "edge"}}, }}, } mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, mock.AnythingOfType("*v1alpha2.UDPRoute")). + Get(t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap"}, mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, _ apitypes.NamespacedName, obj client.Object, _ ...client.GetOption) error { *(mustUDPRoute(t, obj)) = route return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { updated := mustUDPRoute(t, obj) assert.NotContains(t, updated.Finalizers, NetworkLoadBalancerUDPRouteProgrammedFinalizer) @@ -306,13 +305,13 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("programRoute rejects route when listener is already owned", func(t *testing.T) { - currentRoute := gatewayv1alpha2.UDPRoute{ + currentRoute := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "z-route", Generation: 1, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ { @@ -328,10 +327,10 @@ func TestUDPRouteModel(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.UDPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { - reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1alpha2.UDPRouteList{ - Items: []gatewayv1alpha2.UDPRoute{currentRoute, otherRoute}, + reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1.UDPRouteList{ + Items: []gatewayv1.UDPRoute{currentRoute, otherRoute}, })) return nil }) @@ -367,7 +366,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("listener ownership helpers return list errors", func(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.UDPRouteList")). Return(errors.New("list failed")). Twice() model := newUDPRouteModel(udpRouteModelDeps{ @@ -384,23 +383,23 @@ func TestUDPRouteModel(t *testing.T) { t.Run("listener ownership ignores non matching parent refs", func(t *testing.T) { serviceKind := gatewayv1.Kind("Service") - routes := gatewayv1alpha2.UDPRouteList{Items: []gatewayv1alpha2.UDPRoute{ + routes := gatewayv1.UDPRouteList{Items: []gatewayv1.UDPRoute{ { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "service-parent"}, - Spec: gatewayv1alpha2.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Kind: &serviceKind, Name: "backend"}}, }}, }, { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "other-gateway"}, - Spec: gatewayv1alpha2.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "other"}}, }}, }, }} mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.UDPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().Set(reflect.ValueOf(routes)) return nil @@ -411,20 +410,20 @@ func TestUDPRouteModel(t *testing.T) { gatewayDetails: resolvedGatewayDetails{ gateway: gatewayv1.Gateway{ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "edge"}}, }, - udpRoute: gatewayv1alpha2.UDPRoute{ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}}, + udpRoute: gatewayv1.UDPRoute{ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}}, matchedListener: gatewayv1.Listener{Name: "coap", Protocol: gatewayv1.UDPProtocolType, Port: 5684}, }) require.NoError(t, err) }) t.Run("deprovisionRoute clears backend set and removes finalizer when no successor exists", func(t *testing.T) { - currentRoute := gatewayv1alpha2.UDPRoute{ + currentRoute := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", Finalizers: []string{NetworkLoadBalancerUDPRouteProgrammedFinalizer}, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, @@ -433,15 +432,15 @@ func TestUDPRouteModel(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.UDPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { - reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1alpha2.UDPRouteList{ - Items: []gatewayv1alpha2.UDPRoute{currentRoute}, + reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1.UDPRouteList{ + Items: []gatewayv1.UDPRoute{currentRoute}, })) return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.NotContains(t, obj.GetFinalizers(), NetworkLoadBalancerUDPRouteProgrammedFinalizer) assert.NotContains(t, obj.GetAnnotations(), NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation) @@ -493,10 +492,10 @@ func TestUDPRouteModel(t *testing.T) { K8sClient: fake.NewClientBuilder().WithScheme(newL4TestScheme(t)).Build(), }) modelImpl := mustUDPRouteModelImpl(t, model) - _, err := modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.UDPRoute{ + _, err := modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{ - Rules: []gatewayv1alpha2.UDPRouteRule{ + Spec: gatewayv1.UDPRouteSpec{ + Rules: []gatewayv1.UDPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ {BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend"}}, @@ -510,10 +509,10 @@ func TestUDPRouteModel(t *testing.T) { assert.Equal(t, gatewayv1.RouteReasonInvalidKind, statusErr.reason) backendNamespace := gatewayv1.Namespace("other") - _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.UDPRoute{ + _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{ - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Spec: gatewayv1.UDPRouteSpec{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{ Namespace: &backendNamespace, @@ -542,10 +541,10 @@ func TestUDPRouteModel(t *testing.T) { Return(errors.New("list failed")) model = newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) modelImpl = mustUDPRouteModelImpl(t, model) - _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.UDPRoute{ + _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{ - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Spec: gatewayv1.UDPRouteSpec{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -560,10 +559,10 @@ func TestUDPRouteModel(t *testing.T) { Return(errors.New("get failed")) model = newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) modelImpl = mustUDPRouteModelImpl(t, model) - _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1alpha2.UDPRoute{ + _, err = modelImpl.endpointBackendsForRoute(t.Context(), gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{ - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Spec: gatewayv1.UDPRouteSpec{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -574,13 +573,13 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("setProgrammed adds finalizer and backend set annotation", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", Generation: 1, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("coap"))}, @@ -593,10 +592,10 @@ func TestUDPRouteModel(t *testing.T) { mockStatusWriter := k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). Return(nil) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.Contains(t, obj.GetFinalizers(), NetworkLoadBalancerUDPRouteProgrammedFinalizer) assert.Equal( @@ -638,7 +637,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("setProgrammed updates existing parent status and wraps errors", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -648,7 +647,7 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation: "bs_coap", }, }, - Status: gatewayv1alpha2.UDPRouteStatus{ + Status: gatewayv1.UDPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, @@ -675,7 +674,7 @@ func TestUDPRouteModel(t *testing.T) { mockStatusWriter := k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { updated := mustUDPRoute(t, obj) require.Len(t, updated.Status.Parents, 1) @@ -687,7 +686,7 @@ func TestUDPRouteModel(t *testing.T) { mockClient = NewMockk8sClient(t) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). Return(errors.New("update failed")) model = newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) details.udpRoute.Finalizers = nil @@ -699,7 +698,7 @@ func TestUDPRouteModel(t *testing.T) { mockStatusWriter = k8sapi.NewMockSubResourceWriter(t) mockClient.EXPECT().Status().Return(mockStatusWriter) mockStatusWriter.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). Return(errors.New("status failed")) model = newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) details.udpRoute = route @@ -708,7 +707,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute clears annotated backend set and removes finalizer", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -717,7 +716,7 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation: "bs_old", }, }, - Status: gatewayv1alpha2.UDPRouteStatus{ + Status: gatewayv1.UDPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{ { @@ -756,7 +755,7 @@ func TestUDPRouteModel(t *testing.T) { return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.NotContains(t, obj.GetFinalizers(), NetworkLoadBalancerUDPRouteProgrammedFinalizer) assert.NotContains(t, obj.GetAnnotations(), NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation) @@ -805,7 +804,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute removes finalizer when no backend sets are annotated", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -814,7 +813,7 @@ func TestUDPRouteModel(t *testing.T) { } mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). RunAndReturn(func(_ context.Context, obj client.Object, _ ...client.UpdateOption) error { assert.NotContains(t, obj.GetFinalizers(), NetworkLoadBalancerUDPRouteProgrammedFinalizer) return nil @@ -832,7 +831,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("deprovisionDetachedRoute returns finalizer update error "+ "when no backend sets are annotated", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -840,7 +839,7 @@ func TestUDPRouteModel(t *testing.T) { }, } mockClient := NewMockk8sClient(t) - mockClient.EXPECT().Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + mockClient.EXPECT().Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). Return(errors.New("update failed")) model := newUDPRouteModel(udpRouteModelDeps{ RootLogger: diag.RootTestLogger(), @@ -854,7 +853,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute returns cleanup and update errors", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -863,7 +862,7 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation: "bs_old", }, }, - Status: gatewayv1alpha2.UDPRouteStatus{ + Status: gatewayv1.UDPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, @@ -928,7 +927,7 @@ func TestUDPRouteModel(t *testing.T) { return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). Return(errors.New("update failed")) model = newUDPRouteModel(udpRouteModelDeps{ RootLogger: diag.RootTestLogger(), @@ -947,7 +946,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute returns gateway read errors", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -956,7 +955,7 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation: "bs_old", }, }, - Status: gatewayv1alpha2.UDPRouteStatus{ + Status: gatewayv1.UDPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, @@ -1049,14 +1048,14 @@ func TestUDPRouteModel(t *testing.T) { port := gatewayv1.PortNumber(5684) listener := gatewayv1.Listener{Name: "coap", Protocol: gatewayv1.UDPProtocolType, Port: port} now := metav1.Now() - currentRoute := &gatewayv1alpha2.UDPRoute{ + currentRoute := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap-old", Finalizers: []string{NetworkLoadBalancerUDPRouteProgrammedFinalizer}, DeletionTimestamp: &now, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("coap"))}, @@ -1064,7 +1063,7 @@ func TestUDPRouteModel(t *testing.T) { }, }, } - nextRoute := &gatewayv1alpha2.UDPRoute{ + nextRoute := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap-new", @@ -1073,13 +1072,13 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "5684", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{ {Name: "edge", SectionName: lo.ToPtr(gatewayv1.SectionName("coap"))}, }, }, - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1091,7 +1090,7 @@ func TestUDPRouteModel(t *testing.T) { k8sClient := fake.NewClientBuilder(). WithScheme(newL4TestScheme(t)). WithRuntimeObjects(objects...). - WithStatusSubresource(&gatewayv1alpha2.UDPRoute{}). + WithStatusSubresource(&gatewayv1.UDPRoute{}). Build() nlbClient := &stubNetworkLoadBalancerClient{} model := newUDPRouteModel(udpRouteModelDeps{ @@ -1121,7 +1120,7 @@ func TestUDPRouteModel(t *testing.T) { require.NoError(t, err) require.Len(t, nlbClient.updateBackendSetRequests, 1) - var updatedNext gatewayv1alpha2.UDPRoute + var updatedNext gatewayv1.UDPRoute require.NoError(t, k8sClient.Get( t.Context(), apitypes.NamespacedName{Namespace: "iot", Name: "coap-new"}, @@ -1133,7 +1132,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("deprovisionRoute wraps list update and next route errors", func(t *testing.T) { listener := gatewayv1.Listener{Name: "coap", Protocol: gatewayv1.UDPProtocolType, Port: 5684} - currentRoute := gatewayv1alpha2.UDPRoute{ + currentRoute := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap-old", @@ -1150,7 +1149,7 @@ func TestUDPRouteModel(t *testing.T) { mockClient := NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.UDPRouteList")). Return(errors.New("list failed")) model := newUDPRouteModel(udpRouteModelDeps{RootLogger: diag.RootTestLogger(), K8sClient: mockClient}) err := model.deprovisionRoute(t.Context(), details) @@ -1158,15 +1157,15 @@ func TestUDPRouteModel(t *testing.T) { mockClient = NewMockk8sClient(t) mockClient.EXPECT(). - List(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRouteList")). + List(t.Context(), mock.AnythingOfType("*v1.UDPRouteList")). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { - reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1alpha2.UDPRouteList{ - Items: []gatewayv1alpha2.UDPRoute{currentRoute}, + reflect.ValueOf(list).Elem().Set(reflect.ValueOf(gatewayv1.UDPRouteList{ + Items: []gatewayv1.UDPRoute{currentRoute}, })) return nil }) mockClient.EXPECT(). - Update(t.Context(), mock.AnythingOfType("*v1alpha2.UDPRoute")). + Update(t.Context(), mock.AnythingOfType("*v1.UDPRoute")). Return(errors.New("update failed")) model = newUDPRouteModel(udpRouteModelDeps{ RootLogger: diag.RootTestLogger(), @@ -1183,13 +1182,13 @@ func TestUDPRouteModel(t *testing.T) { now := metav1.Now() deletingRoute := currentRoute deletingRoute.DeletionTimestamp = &now - nextRoute := &gatewayv1alpha2.UDPRoute{ + nextRoute := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap-new"}, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.UDPRouteRule{ + Rules: []gatewayv1.UDPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ {BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend"}}, @@ -1223,7 +1222,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("programRoute returns update and wait errors", func(t *testing.T) { port := gatewayv1.PortNumber(5684) - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1231,11 +1230,11 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "5684", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1307,7 +1306,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("programRoute returns busy error for backend set update conflict", func(t *testing.T) { port := gatewayv1.PortNumber(5684) - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1315,11 +1314,11 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "5684", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1370,7 +1369,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("programRoute returns busy error when NLB is already updating", func(t *testing.T) { port := gatewayv1.PortNumber(5684) listener := gatewayv1.Listener{Name: "coap", Protocol: gatewayv1.UDPProtocolType, Port: port} - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1411,7 +1410,7 @@ func TestUDPRouteModel(t *testing.T) { port := gatewayv1.PortNumber(5684) healthCheckPort := 9000 listener := gatewayv1.Listener{Name: "coap", Protocol: gatewayv1.UDPProtocolType, Port: port} - route := &gatewayv1alpha2.UDPRoute{ + route := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1419,11 +1418,11 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "9000", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1475,7 +1474,7 @@ func TestUDPRouteModel(t *testing.T) { }, } { t.Run(name, func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1522,7 +1521,7 @@ func TestUDPRouteModel(t *testing.T) { }, }, } - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "other", Name: "coap", @@ -1562,7 +1561,7 @@ func TestUDPRouteModel(t *testing.T) { t.Run("programRoute skips update when backend set is current", func(t *testing.T) { port := gatewayv1.PortNumber(5684) listener := gatewayv1.Listener{Name: "coap", Protocol: gatewayv1.UDPProtocolType, Port: port} - route := &gatewayv1alpha2.UDPRoute{ + route := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1570,11 +1569,11 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteHealthCheckPortAnnotation: "5684", }, }, - Spec: gatewayv1alpha2.UDPRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{ CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }, - Rules: []gatewayv1alpha2.UDPRouteRule{{ + Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{ BackendObjectReference: gatewayv1.BackendObjectReference{Name: "backend", Port: &port}, }}, @@ -1706,7 +1705,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("clearStaleBackendSets keeps desired backend set", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1735,7 +1734,7 @@ func TestUDPRouteModel(t *testing.T) { }) t.Run("deprovisionDetachedRoute skips unresolved gateway references", func(t *testing.T) { - route := gatewayv1alpha2.UDPRoute{ + route := gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{ Namespace: "iot", Name: "coap", @@ -1744,7 +1743,7 @@ func TestUDPRouteModel(t *testing.T) { NetworkLoadBalancerUDPRouteProgrammedBackendSetsAnnotation: "bs_coap", }, }, - Status: gatewayv1alpha2.UDPRouteStatus{ + Status: gatewayv1.UDPRouteStatus{ RouteStatus: gatewayv1.RouteStatus{ Parents: []gatewayv1.RouteParentStatus{{ ParentRef: gatewayv1.ParentReference{Name: "edge"}, diff --git a/internal/app/watches_model.go b/internal/app/watches_model.go index 98fbffe4..f0b48869 100644 --- a/internal/app/watches_model.go +++ b/internal/app/watches_model.go @@ -15,7 +15,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" "github.com/gemyago/oke-gateway-api/internal/diag" @@ -100,7 +99,7 @@ func (m *WatchesModel) RegisterFieldIndexers( if opts.EnableTCPRoute { if err := indexer.IndexField(ctx, - &gatewayv1alpha2.TCPRoute{}, + &gatewayv1.TCPRoute{}, tcpRouteBackendServiceIndexKey, func(o client.Object) []string { return m.indexTCPRouteByBackendService(ctx, o) @@ -112,7 +111,7 @@ func (m *WatchesModel) RegisterFieldIndexers( if opts.EnableUDPRoute { if err := indexer.IndexField(ctx, - &gatewayv1alpha2.UDPRoute{}, + &gatewayv1.UDPRoute{}, udpRouteBackendServiceIndexKey, func(o client.Object) []string { return m.indexUDPRouteByBackendService(ctx, o) @@ -392,7 +391,7 @@ func (m *WatchesModel) indexHTTPRouteByBackendService(ctx context.Context, obj c } func (m *WatchesModel) indexTCPRouteByBackendService(ctx context.Context, obj client.Object) []string { - tcpRoute, isRoute := obj.(*gatewayv1alpha2.TCPRoute) + tcpRoute, isRoute := obj.(*gatewayv1.TCPRoute) logger := m.logger.WithGroup("tcp-route-backend-service-index") if !isRoute { logger.WarnContext(ctx, "Received non-TCPRoute object", slog.Any("object", obj)) @@ -421,7 +420,7 @@ func (m *WatchesModel) indexTCPRouteByBackendService(ctx context.Context, obj cl } func (m *WatchesModel) indexUDPRouteByBackendService(ctx context.Context, obj client.Object) []string { - udpRoute, isRoute := obj.(*gatewayv1alpha2.UDPRoute) + udpRoute, isRoute := obj.(*gatewayv1.UDPRoute) logger := m.logger.WithGroup("udp-route-backend-service-index") if !isRoute { logger.WarnContext(ctx, "Received non-UDPRoute object", slog.Any("object", obj)) @@ -735,7 +734,7 @@ func (m *WatchesModel) MapGRPCRouteToHTTPRoute(ctx context.Context, obj client.O } func (m *WatchesModel) MapEndpointSliceToTCPRoute(ctx context.Context, obj client.Object) []reconcile.Request { - var routeList gatewayv1alpha2.TCPRouteList + var routeList gatewayv1.TCPRouteList return mapEndpointSliceToL4Route( ctx, m.logger, @@ -744,7 +743,7 @@ func (m *WatchesModel) MapEndpointSliceToTCPRoute(ctx context.Context, obj clien &routeList, tcpRouteBackendServiceIndexKey, "TCPRoutes", - func(routeList *gatewayv1alpha2.TCPRouteList) []reconcile.Request { + func(routeList *gatewayv1.TCPRouteList) []reconcile.Request { requests := make([]reconcile.Request, 0, len(routeList.Items)) for _, route := range routeList.Items { if route.DeletionTimestamp != nil { @@ -760,7 +759,7 @@ func (m *WatchesModel) MapEndpointSliceToTCPRoute(ctx context.Context, obj clien } func (m *WatchesModel) MapEndpointSliceToUDPRoute(ctx context.Context, obj client.Object) []reconcile.Request { - var routeList gatewayv1alpha2.UDPRouteList + var routeList gatewayv1.UDPRouteList return mapEndpointSliceToL4Route( ctx, m.logger, @@ -769,7 +768,7 @@ func (m *WatchesModel) MapEndpointSliceToUDPRoute(ctx context.Context, obj clien &routeList, udpRouteBackendServiceIndexKey, "UDPRoutes", - func(routeList *gatewayv1alpha2.UDPRouteList) []reconcile.Request { + func(routeList *gatewayv1.UDPRouteList) []reconcile.Request { requests := make([]reconcile.Request, 0, len(routeList.Items)) for _, route := range routeList.Items { if route.DeletionTimestamp != nil { @@ -1048,9 +1047,9 @@ func routeReferencesBackendNamespace(routeNamespace string, refs []gatewayv1.Bac } func (m *WatchesModel) MapReferenceGrantToTCPRoute(ctx context.Context, obj client.Object) []reconcile.Request { - var routeList gatewayv1alpha2.TCPRouteList + var routeList gatewayv1.TCPRouteList return mapReferenceGrantToL4Route(ctx, m.logger, m.k8sClient, obj, &routeList, "TCPRoutes", - func(routeList *gatewayv1alpha2.TCPRouteList, grant *gatewayv1beta1.ReferenceGrant) []reconcile.Request { + func(routeList *gatewayv1.TCPRouteList, grant *gatewayv1beta1.ReferenceGrant) []reconcile.Request { requests := make([]reconcile.Request, 0) for _, route := range routeList.Items { shouldQueue := false @@ -1070,9 +1069,9 @@ func (m *WatchesModel) MapReferenceGrantToTCPRoute(ctx context.Context, obj clie } func (m *WatchesModel) MapReferenceGrantToUDPRoute(ctx context.Context, obj client.Object) []reconcile.Request { - var routeList gatewayv1alpha2.UDPRouteList + var routeList gatewayv1.UDPRouteList return mapReferenceGrantToL4Route(ctx, m.logger, m.k8sClient, obj, &routeList, "UDPRoutes", - func(routeList *gatewayv1alpha2.UDPRouteList, grant *gatewayv1beta1.ReferenceGrant) []reconcile.Request { + func(routeList *gatewayv1.UDPRouteList, grant *gatewayv1beta1.ReferenceGrant) []reconcile.Request { requests := make([]reconcile.Request, 0) for _, route := range routeList.Items { shouldQueue := false @@ -1139,7 +1138,7 @@ func mapReferenceGrantToL4Route[T client.ObjectList]( return requestsFromList(routeList, grant) } -func tcpRouteReferencesGateway(route gatewayv1alpha2.TCPRoute, gateway gatewayv1.Gateway) bool { +func tcpRouteReferencesGateway(route gatewayv1.TCPRoute, gateway gatewayv1.Gateway) bool { gatewayName := client.ObjectKeyFromObject(&gateway) for _, parentRef := range route.Spec.ParentRefs { if !parentRefTargetsGateway(parentRef) { @@ -1152,7 +1151,7 @@ func tcpRouteReferencesGateway(route gatewayv1alpha2.TCPRoute, gateway gatewayv1 return false } -func udpRouteReferencesGateway(route gatewayv1alpha2.UDPRoute, gateway gatewayv1.Gateway) bool { +func udpRouteReferencesGateway(route gatewayv1.UDPRoute, gateway gatewayv1.Gateway) bool { gatewayName := client.ObjectKeyFromObject(&gateway) for _, parentRef := range route.Spec.ParentRefs { if !parentRefTargetsGateway(parentRef) { @@ -1166,9 +1165,9 @@ func udpRouteReferencesGateway(route gatewayv1alpha2.UDPRoute, gateway gatewayv1 } func (m *WatchesModel) MapGatewayToTCPRoute(ctx context.Context, obj client.Object) []reconcile.Request { - var routeList gatewayv1alpha2.TCPRouteList + var routeList gatewayv1.TCPRouteList return mapGatewayToL4Route(ctx, m.logger, m.k8sClient, obj, &routeList, "TCPRoutes", - func(routeList *gatewayv1alpha2.TCPRouteList, gateway *gatewayv1.Gateway) []reconcile.Request { + func(routeList *gatewayv1.TCPRouteList, gateway *gatewayv1.Gateway) []reconcile.Request { requests := make([]reconcile.Request, 0) for _, route := range routeList.Items { if tcpRouteReferencesGateway(route, *gateway) { @@ -1181,9 +1180,9 @@ func (m *WatchesModel) MapGatewayToTCPRoute(ctx context.Context, obj client.Obje } func (m *WatchesModel) MapGatewayToUDPRoute(ctx context.Context, obj client.Object) []reconcile.Request { - var routeList gatewayv1alpha2.UDPRouteList + var routeList gatewayv1.UDPRouteList return mapGatewayToL4Route(ctx, m.logger, m.k8sClient, obj, &routeList, "UDPRoutes", - func(routeList *gatewayv1alpha2.UDPRouteList, gateway *gatewayv1.Gateway) []reconcile.Request { + func(routeList *gatewayv1.UDPRouteList, gateway *gatewayv1.Gateway) []reconcile.Request { requests := make([]reconcile.Request, 0) for _, route := range routeList.Items { if udpRouteReferencesGateway(route, *gateway) { diff --git a/internal/app/watches_model_test.go b/internal/app/watches_model_test.go index 1d3439d2..53fb3e17 100644 --- a/internal/app/watches_model_test.go +++ b/internal/app/watches_model_test.go @@ -19,7 +19,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" "github.com/gemyago/oke-gateway-api/internal/diag" @@ -79,14 +78,14 @@ func TestWatchesModel(t *testing.T) { mockIndexer.EXPECT().IndexField( t.Context(), - &gatewayv1alpha2.TCPRoute{}, + &gatewayv1.TCPRoute{}, tcpRouteBackendServiceIndexKey, mock.AnythingOfType("client.IndexerFunc"), ).Return(nil) mockIndexer.EXPECT().IndexField( t.Context(), - &gatewayv1alpha2.UDPRoute{}, + &gatewayv1.UDPRoute{}, udpRouteBackendServiceIndexKey, mock.AnythingOfType("client.IndexerFunc"), ).Return(nil) @@ -345,14 +344,14 @@ func TestWatchesModel(t *testing.T) { mockIndexer.EXPECT().IndexField( t.Context(), - &gatewayv1alpha2.TCPRoute{}, + &gatewayv1.TCPRoute{}, tcpRouteBackendServiceIndexKey, mock.AnythingOfType("client.IndexerFunc"), ).Return(nil) mockIndexer.EXPECT().IndexField( t.Context(), - &gatewayv1alpha2.UDPRoute{}, + &gatewayv1.UDPRoute{}, udpRouteBackendServiceIndexKey, mock.AnythingOfType("client.IndexerFunc"), ).Return(nil) @@ -410,20 +409,20 @@ func TestWatchesModel(t *testing.T) { if tc.failTCP { mockIndexer.EXPECT().IndexField( t.Context(), - &gatewayv1alpha2.TCPRoute{}, + &gatewayv1.TCPRoute{}, tcpRouteBackendServiceIndexKey, mock.AnythingOfType("client.IndexerFunc"), ).Return(wantErr) } else { mockIndexer.EXPECT().IndexField( t.Context(), - &gatewayv1alpha2.TCPRoute{}, + &gatewayv1.TCPRoute{}, tcpRouteBackendServiceIndexKey, mock.AnythingOfType("client.IndexerFunc"), ).Return(nil) mockIndexer.EXPECT().IndexField( t.Context(), - &gatewayv1alpha2.UDPRoute{}, + &gatewayv1.UDPRoute{}, udpRouteBackendServiceIndexKey, mock.AnythingOfType("client.IndexerFunc"), ).Return(wantErr) @@ -1635,10 +1634,10 @@ func TestWatchesModel(t *testing.T) { t.Run("indexes TCPRoute and UDPRoute backend services", func(t *testing.T) { deps := makeMockDeps(t) model := NewWatchesModel(deps) - tcpRoute := &gatewayv1alpha2.TCPRoute{ + tcpRoute := &gatewayv1.TCPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{ - Rules: []gatewayv1alpha2.TCPRouteRule{ + Spec: gatewayv1.TCPRouteSpec{ + Rules: []gatewayv1.TCPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ { @@ -1659,10 +1658,10 @@ func TestWatchesModel(t *testing.T) { }, }, } - udpRoute := &gatewayv1alpha2.UDPRoute{ + udpRoute := &gatewayv1.UDPRoute{ ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{ - Rules: []gatewayv1alpha2.UDPRouteRule{ + Spec: gatewayv1.UDPRouteSpec{ + Rules: []gatewayv1.UDPRouteRule{ { BackendRefs: []gatewayv1.BackendRef{ { @@ -1709,23 +1708,23 @@ func TestWatchesModel(t *testing.T) { randomEndpointSliceWithNamespaceOpt("iot"), randomEndpointSliceWithServiceNameOpt("backend"), ) - tcpRoutes := []gatewayv1alpha2.TCPRoute{ + tcpRoutes := []gatewayv1.TCPRoute{ {ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}}, {ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "srt"}}, } - udpRoutes := []gatewayv1alpha2.UDPRoute{ + udpRoutes := []gatewayv1.UDPRoute{ {ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}}, } mockK8sClient, _ := deps.K8sClient.(*Mockk8sClient) mockK8sClient.EXPECT(). - List(t.Context(), &gatewayv1alpha2.TCPRouteList{}, + List(t.Context(), &gatewayv1.TCPRouteList{}, client.MatchingFields{tcpRouteBackendServiceIndexKey: "iot/backend"}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(tcpRoutes)) return nil }) mockK8sClient.EXPECT(). - List(t.Context(), &gatewayv1alpha2.UDPRouteList{}, + List(t.Context(), &gatewayv1.UDPRouteList{}, client.MatchingFields{udpRouteBackendServiceIndexKey: "iot/backend"}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(udpRoutes)) @@ -1753,24 +1752,24 @@ func TestWatchesModel(t *testing.T) { randomEndpointSliceWithServiceNameOpt("backend"), ) now := metav1.Now() - tcpRoutes := []gatewayv1alpha2.TCPRoute{ + tcpRoutes := []gatewayv1.TCPRoute{ {ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "active"}}, {ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "deleting", DeletionTimestamp: &now}}, } - udpRoutes := []gatewayv1alpha2.UDPRoute{ + udpRoutes := []gatewayv1.UDPRoute{ {ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "active"}}, {ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "deleting", DeletionTimestamp: &now}}, } mockK8sClient, _ := deps.K8sClient.(*Mockk8sClient) mockK8sClient.EXPECT(). - List(t.Context(), &gatewayv1alpha2.TCPRouteList{}, + List(t.Context(), &gatewayv1.TCPRouteList{}, client.MatchingFields{tcpRouteBackendServiceIndexKey: "iot/backend"}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(tcpRoutes)) return nil }) mockK8sClient.EXPECT(). - List(t.Context(), &gatewayv1alpha2.UDPRouteList{}, + List(t.Context(), &gatewayv1.UDPRouteList{}, client.MatchingFields{udpRouteBackendServiceIndexKey: "iot/backend"}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(udpRoutes)) @@ -1791,11 +1790,11 @@ func TestWatchesModel(t *testing.T) { model = NewWatchesModel(deps) mockK8sClient, _ = deps.K8sClient.(*Mockk8sClient) mockK8sClient.EXPECT(). - List(t.Context(), &gatewayv1alpha2.TCPRouteList{}, + List(t.Context(), &gatewayv1.TCPRouteList{}, client.MatchingFields{tcpRouteBackendServiceIndexKey: "iot/backend"}). Return(errors.New("tcp list failed")) mockK8sClient.EXPECT(). - List(t.Context(), &gatewayv1alpha2.UDPRouteList{}, + List(t.Context(), &gatewayv1.UDPRouteList{}, client.MatchingFields{udpRouteBackendServiceIndexKey: "iot/backend"}). Return(errors.New("udp list failed")) require.Nil(t, model.MapEndpointSliceToTCPRoute(t.Context(), &endpointSlice)) @@ -1806,10 +1805,10 @@ func TestWatchesModel(t *testing.T) { deps := makeMockDeps(t) model := NewWatchesModel(deps) grant := &gatewayv1beta1.ReferenceGrant{ObjectMeta: metav1.ObjectMeta{Namespace: "media", Name: "allow"}} - tcpRoutes := []gatewayv1alpha2.TCPRoute{ + tcpRoutes := []gatewayv1.TCPRoute{ { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{Rules: []gatewayv1alpha2.TCPRouteRule{{ + Spec: gatewayv1.TCPRouteSpec{Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{BackendObjectReference: gatewayv1.BackendObjectReference{ Namespace: &crossNamespace, Name: "rtmp", @@ -1819,7 +1818,7 @@ func TestWatchesModel(t *testing.T) { }, { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "local"}, - Spec: gatewayv1alpha2.TCPRouteSpec{Rules: []gatewayv1alpha2.TCPRouteRule{{ + Spec: gatewayv1.TCPRouteSpec{Rules: []gatewayv1.TCPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{BackendObjectReference: gatewayv1.BackendObjectReference{ Name: "local", Port: &backendPort, @@ -1827,10 +1826,10 @@ func TestWatchesModel(t *testing.T) { }}}, }, } - udpRoutes := []gatewayv1alpha2.UDPRoute{ + udpRoutes := []gatewayv1.UDPRoute{ { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{Rules: []gatewayv1alpha2.UDPRouteRule{{ + Spec: gatewayv1.UDPRouteSpec{Rules: []gatewayv1.UDPRouteRule{{ BackendRefs: []gatewayv1.BackendRef{{BackendObjectReference: gatewayv1.BackendObjectReference{ Namespace: &crossNamespace, Name: "coap", @@ -1840,12 +1839,12 @@ func TestWatchesModel(t *testing.T) { }, } mockK8sClient, _ := deps.K8sClient.(*Mockk8sClient) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.TCPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.TCPRouteList{}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(tcpRoutes)) return nil }) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.UDPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.UDPRouteList{}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(udpRoutes)) return nil @@ -1866,14 +1865,14 @@ func TestWatchesModel(t *testing.T) { deps := makeMockDeps(t) model := NewWatchesModel(deps) mockK8sClient, _ := deps.K8sClient.(*Mockk8sClient) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.TCPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.TCPRouteList{}). Return(errors.New("tcp list failed")) require.Nil(t, model.MapReferenceGrantToTCPRoute(t.Context(), grant)) deps = makeMockDeps(t) model = NewWatchesModel(deps) mockK8sClient, _ = deps.K8sClient.(*Mockk8sClient) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.UDPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.UDPRouteList{}). Return(errors.New("udp list failed")) require.Nil(t, model.MapReferenceGrantToUDPRoute(t.Context(), grant)) }) @@ -1882,35 +1881,35 @@ func TestWatchesModel(t *testing.T) { deps := makeMockDeps(t) model := NewWatchesModel(deps) gateway := &gatewayv1.Gateway{ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "edge"}} - tcpRoutes := []gatewayv1alpha2.TCPRoute{ + tcpRoutes := []gatewayv1.TCPRoute{ { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "rtmp"}, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }}, }, { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "other"}, - Spec: gatewayv1alpha2.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.TCPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "other"}}, }}, }, } - udpRoutes := []gatewayv1alpha2.UDPRoute{ + udpRoutes := []gatewayv1.UDPRoute{ { ObjectMeta: metav1.ObjectMeta{Namespace: "iot", Name: "coap"}, - Spec: gatewayv1alpha2.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ + Spec: gatewayv1.UDPRouteSpec{CommonRouteSpec: gatewayv1.CommonRouteSpec{ ParentRefs: []gatewayv1.ParentReference{{Name: "edge"}}, }}, }, } mockK8sClient, _ := deps.K8sClient.(*Mockk8sClient) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.TCPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.TCPRouteList{}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(tcpRoutes)) return nil }) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.UDPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.UDPRouteList{}). RunAndReturn(func(_ context.Context, list client.ObjectList, _ ...client.ListOption) error { reflect.ValueOf(list).Elem().FieldByName("Items").Set(reflect.ValueOf(udpRoutes)) return nil @@ -1931,14 +1930,14 @@ func TestWatchesModel(t *testing.T) { deps := makeMockDeps(t) model := NewWatchesModel(deps) mockK8sClient, _ := deps.K8sClient.(*Mockk8sClient) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.TCPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.TCPRouteList{}). Return(errors.New("tcp list failed")) require.Nil(t, model.MapGatewayToTCPRoute(t.Context(), gateway)) deps = makeMockDeps(t) model = NewWatchesModel(deps) mockK8sClient, _ = deps.K8sClient.(*Mockk8sClient) - mockK8sClient.EXPECT().List(t.Context(), &gatewayv1alpha2.UDPRouteList{}). + mockK8sClient.EXPECT().List(t.Context(), &gatewayv1.UDPRouteList{}). Return(errors.New("udp list failed")) require.Nil(t, model.MapGatewayToUDPRoute(t.Context(), gateway)) }) diff --git a/internal/k8s/start_manager.go b/internal/k8s/start_manager.go index b14b3f22..c39dff2b 100644 --- a/internal/k8s/start_manager.go +++ b/internal/k8s/start_manager.go @@ -21,7 +21,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" "github.com/gemyago/oke-gateway-api/internal/app" @@ -120,7 +119,7 @@ func detectExperimentalRouteCapabilities(mapper meta.RESTMapper) (experimentalRo tcpRouteAvailable, err := resourceKindAvailable( mapper, schema.GroupKind{Group: gatewayv1.GroupName, Kind: "TCPRoute"}, - "v1alpha2", + "v1", ) if err != nil { return experimentalRouteCapabilities{}, fmt.Errorf("failed to detect TCPRoute availability: %w", err) @@ -129,7 +128,7 @@ func detectExperimentalRouteCapabilities(mapper meta.RESTMapper) (experimentalRo udpRouteAvailable, err := resourceKindAvailable( mapper, schema.GroupKind{Group: gatewayv1.GroupName, Kind: "UDPRoute"}, - "v1alpha2", + "v1", ) if err != nil { return experimentalRouteCapabilities{}, fmt.Errorf("failed to detect UDPRoute availability: %w", err) @@ -474,7 +473,7 @@ func l4RouteControllerSetupTasks( setup: func() error { return setupL4RouteController(mgr, setupL4RouteControllerParams{ name: "tcproute", - route: &gatewayv1alpha2.TCPRoute{}, + route: &gatewayv1.TCPRoute{}, mapEndpoint: deps.WatchesModel.MapEndpointSliceToTCPRoute, mapGrant: deps.WatchesModel.MapReferenceGrantToTCPRoute, mapGateway: deps.WatchesModel.MapGatewayToTCPRoute, @@ -489,7 +488,7 @@ func l4RouteControllerSetupTasks( setup: func() error { return setupL4RouteController(mgr, setupL4RouteControllerParams{ name: "udproute", - route: &gatewayv1alpha2.UDPRoute{}, + route: &gatewayv1.UDPRoute{}, mapEndpoint: deps.WatchesModel.MapEndpointSliceToUDPRoute, mapGrant: deps.WatchesModel.MapReferenceGrantToUDPRoute, mapGateway: deps.WatchesModel.MapGatewayToUDPRoute, diff --git a/internal/k8s/start_manager_test.go b/internal/k8s/start_manager_test.go index 45b4e94e..58e9c048 100644 --- a/internal/k8s/start_manager_test.go +++ b/internal/k8s/start_manager_test.go @@ -120,16 +120,16 @@ func TestL4RouteObjectPredicate(t *testing.T) { func TestDetectExperimentalRouteCapabilities(t *testing.T) { t.Run("detects TCPRoute and UDPRoute", func(t *testing.T) { mapper := meta.NewDefaultRESTMapper([]schema.GroupVersion{ - {Group: gatewayv1.GroupName, Version: "v1alpha2"}, + {Group: gatewayv1.GroupName, Version: "v1"}, }) mapper.Add(schema.GroupVersionKind{ Group: gatewayv1.GroupName, - Version: "v1alpha2", + Version: "v1", Kind: "TCPRoute", }, meta.RESTScopeNamespace) mapper.Add(schema.GroupVersionKind{ Group: gatewayv1.GroupName, - Version: "v1alpha2", + Version: "v1", Kind: "UDPRoute", }, meta.RESTScopeNamespace) @@ -142,7 +142,7 @@ func TestDetectExperimentalRouteCapabilities(t *testing.T) { t.Run("treats missing routes as unavailable", func(t *testing.T) { mapper := meta.NewDefaultRESTMapper([]schema.GroupVersion{ - {Group: gatewayv1.GroupName, Version: "v1alpha2"}, + {Group: gatewayv1.GroupName, Version: "v1"}, }) got, err := detectExperimentalRouteCapabilities(mapper) diff --git a/internal/services/k8sapi/client.go b/internal/services/k8sapi/client.go index bc6577ec..f33574de 100644 --- a/internal/services/k8sapi/client.go +++ b/internal/services/k8sapi/client.go @@ -17,7 +17,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" - gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" "github.com/gemyago/oke-gateway-api/internal/types" @@ -81,10 +80,6 @@ func newManager(config *rest.Config) (*controllerManager, error) { return nil, fmt.Errorf("failed to add gateway api scheme: %w", err) } - if err := gatewayv1alpha2.Install(scheme); err != nil { - return nil, fmt.Errorf("failed to add gateway api v1alpha2 scheme: %w", err) - } - if err := gatewayv1beta1.Install(scheme); err != nil { return nil, fmt.Errorf("failed to add gateway api v1beta1 scheme: %w", err) } diff --git a/internal/services/k8sapi/mock_sub_resource_writer.go b/internal/services/k8sapi/mock_sub_resource_writer.go index bd7b86d8..5ce63ac3 100644 --- a/internal/services/k8sapi/mock_sub_resource_writer.go +++ b/internal/services/k8sapi/mock_sub_resource_writer.go @@ -7,6 +7,7 @@ package k8sapi import ( context "context" + runtime "k8s.io/apimachinery/pkg/runtime" client "sigs.k8s.io/controller-runtime/pkg/client" mock "github.com/stretchr/testify/mock" @@ -25,6 +26,68 @@ func (_m *MockSubResourceWriter) EXPECT() *MockSubResourceWriter_Expecter { return &MockSubResourceWriter_Expecter{mock: &_m.Mock} } +// Apply provides a mock function with given fields: ctx, obj, opts +func (_m *MockSubResourceWriter) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.SubResourceApplyOption) error { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, obj) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Apply") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, runtime.ApplyConfiguration, ...client.SubResourceApplyOption) error); ok { + r0 = rf(ctx, obj, opts...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockSubResourceWriter_Apply_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Apply' +type MockSubResourceWriter_Apply_Call struct { + *mock.Call +} + +// Apply is a helper method to define mock.On call +// - ctx context.Context +// - obj runtime.ApplyConfiguration +// - opts ...client.SubResourceApplyOption +func (_e *MockSubResourceWriter_Expecter) Apply(ctx interface{}, obj interface{}, opts ...interface{}) *MockSubResourceWriter_Apply_Call { + return &MockSubResourceWriter_Apply_Call{Call: _e.mock.On("Apply", + append([]interface{}{ctx, obj}, opts...)...)} +} + +func (_c *MockSubResourceWriter_Apply_Call) Run(run func(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.SubResourceApplyOption)) *MockSubResourceWriter_Apply_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]client.SubResourceApplyOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(client.SubResourceApplyOption) + } + } + run(args[0].(context.Context), args[1].(runtime.ApplyConfiguration), variadicArgs...) + }) + return _c +} + +func (_c *MockSubResourceWriter_Apply_Call) Return(_a0 error) *MockSubResourceWriter_Apply_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockSubResourceWriter_Apply_Call) RunAndReturn(run func(context.Context, runtime.ApplyConfiguration, ...client.SubResourceApplyOption) error) *MockSubResourceWriter_Apply_Call { + _c.Call.Return(run) + return _c +} + // Create provides a mock function with given fields: ctx, obj, subResource, opts func (_m *MockSubResourceWriter) Create(ctx context.Context, obj client.Object, subResource client.Object, opts ...client.SubResourceCreateOption) error { _va := make([]interface{}, len(opts))