Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /validate-gateway-networking-k8s-io-v1alpha2-tcproute
path: /validate-gateway-networking-k8s-io-v1-tcproute
failurePolicy: Ignore
name: vtcproute-v1alpha2.kb.io
name: vtcproute-v1.kb.io
rules:
- apiGroups:
- gateway.networking.k8s.io
apiVersions:
- v1alpha2
- v1
operations:
- CREATE
- UPDATE
Expand All @@ -230,14 +230,14 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /validate-gateway-networking-k8s-io-v1alpha2-udproute
path: /validate-gateway-networking-k8s-io-v1-udproute
failurePolicy: Ignore
name: vudproute-v1alpha2.kb.io
name: vudproute-v1.kb.io
rules:
- apiGroups:
- gateway.networking.k8s.io
apiVersions:
- v1alpha2
- v1
operations:
- CREATE
- UPDATE
Expand Down
12 changes: 8 additions & 4 deletions docs/en/latest/concepts/gateway-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ By supporting Gateway API, the APISIX Ingress controller can realize richer func
| Gateway | Partially supported | Partially supported | Not supported | v1 |
| HTTPRoute | Supported | Partially supported | Not supported | v1 |
| GRPCRoute | Supported | Supported | Not supported | v1 |
| ReferenceGrant | Supported | Not supported | Not supported | v1beta1 |
| TLSRoute | Supported | Supported | Not supported | v1alpha2 |
| TCPRoute | Supported | Supported | Not supported | v1alpha2 |
| UDPRoute | Supported | Supported | Not supported | v1alpha2 |
| ReferenceGrant | Supported | Not supported | Not supported | v1 |
| TLSRoute | Supported | Supported | Not supported | v1 |
| TCPRoute | Supported | Supported | Not supported | v1 |
| UDPRoute | Supported | Supported | Not supported | v1 |
| BackendTLSPolicy | Not supported | Not supported | Not supported | v1alpha3 |

TLSRoute, TCPRoute, and UDPRoute are read as `v1`, which Gateway API promoted them to in 1.6. Gateway API 1.6 or later is therefore required for L4 routing: the `v1alpha2` versions of these resources are deprecated everywhere and are not even served by the standard channel CRDs. ReferenceGrant is read as `v1` for the same reason, although its `v1beta1` version is not deprecated and remains the storage version.

Existing manifests that still declare an older version keep working as long as the installed CRDs serve it, because the API server converts them before they reach the controller. They should still be updated to `v1`.

## Examples

For configuration examples, see the Gateway API tabs in [Configuration Examples](../reference/example.md).
Expand Down
2 changes: 1 addition & 1 deletion examples/httpbin/tcproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
name: apisix-proxy-config
---

apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1
kind: TCPRoute
metadata:
name: tcp-app-1
Expand Down
17 changes: 8 additions & 9 deletions internal/adc/translator/l4route_serverport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

"github.com/apache/apisix-ingress-controller/internal/controller/config"
"github.com/apache/apisix-ingress-controller/internal/provider"
Expand Down Expand Up @@ -99,11 +98,11 @@ func TestTranslateTCPRouteServerPort(t *testing.T) {
tctx.Listeners = tt.listeners
tctx.HasExplicitListenerMatch = tt.explicit

route := &gatewayv1alpha2.TCPRoute{
route := &gatewayv1.TCPRoute{
ObjectMeta: metav1.ObjectMeta{Name: "my-tcp", Namespace: "default"},
Spec: gatewayv1alpha2.TCPRouteSpec{
Rules: []gatewayv1alpha2.TCPRouteRule{
{BackendRefs: []gatewayv1alpha2.BackendRef{}},
Spec: gatewayv1.TCPRouteSpec{
Rules: []gatewayv1.TCPRouteRule{
{BackendRefs: []gatewayv1.BackendRef{}},
},
},
}
Expand Down Expand Up @@ -177,11 +176,11 @@ func TestTranslateUDPRouteServerPort(t *testing.T) {
tctx.Listeners = tt.listeners
tctx.HasExplicitListenerMatch = tt.explicit

route := &gatewayv1alpha2.UDPRoute{
route := &gatewayv1.UDPRoute{
ObjectMeta: metav1.ObjectMeta{Name: "my-udp", Namespace: "default"},
Spec: gatewayv1alpha2.UDPRouteSpec{
Rules: []gatewayv1alpha2.UDPRouteRule{
{BackendRefs: []gatewayv1alpha2.BackendRef{}},
Spec: gatewayv1.UDPRouteSpec{
Rules: []gatewayv1.UDPRouteRule{
{BackendRefs: []gatewayv1.BackendRef{}},
},
},
}
Expand Down
37 changes: 18 additions & 19 deletions internal/adc/translator/l4route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
k8stypes "k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

"github.com/apache/apisix-ingress-controller/api/v1alpha1"
apiv2 "github.com/apache/apisix-ingress-controller/api/v2"
Expand Down Expand Up @@ -84,14 +83,14 @@ func TestTranslateTCPRouteWithL4RoutePolicy(t *testing.T) {
tctx.L4RoutePolicies[key] = tt.policy
}

route := &gatewayv1alpha2.TCPRoute{
route := &gatewayv1.TCPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "my-tcp",
Namespace: "default",
},
Spec: gatewayv1alpha2.TCPRouteSpec{
Rules: []gatewayv1alpha2.TCPRouteRule{
{BackendRefs: []gatewayv1alpha2.BackendRef{}},
Spec: gatewayv1.TCPRouteSpec{
Rules: []gatewayv1.TCPRouteRule{
{BackendRefs: []gatewayv1.BackendRef{}},
},
},
}
Expand Down Expand Up @@ -151,14 +150,14 @@ func TestTranslateUDPRouteWithL4RoutePolicy(t *testing.T) {
tctx.L4RoutePolicies[key] = tt.policy
}

route := &gatewayv1alpha2.UDPRoute{
route := &gatewayv1.UDPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "my-udp",
Namespace: "default",
},
Spec: gatewayv1alpha2.UDPRouteSpec{
Rules: []gatewayv1alpha2.UDPRouteRule{
{BackendRefs: []gatewayv1alpha2.BackendRef{}},
Spec: gatewayv1.UDPRouteSpec{
Rules: []gatewayv1.UDPRouteRule{
{BackendRefs: []gatewayv1.BackendRef{}},
},
},
}
Expand Down Expand Up @@ -230,20 +229,20 @@ func TestTranslateTLSRouteWithL4RoutePolicy(t *testing.T) {
tctx.L4RoutePolicies[key] = tt.policy
}

hostnames := make([]gatewayv1alpha2.Hostname, 0, len(tt.hostnames))
hostnames := make([]gatewayv1.Hostname, 0, len(tt.hostnames))
for _, h := range tt.hostnames {
hostnames = append(hostnames, gatewayv1alpha2.Hostname(h))
hostnames = append(hostnames, gatewayv1.Hostname(h))
}

route := &gatewayv1alpha2.TLSRoute{
route := &gatewayv1.TLSRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "my-tls",
Namespace: "default",
},
Spec: gatewayv1alpha2.TLSRouteSpec{
Spec: gatewayv1.TLSRouteSpec{
Hostnames: hostnames,
Rules: []gatewayv1alpha2.TLSRouteRule{
{BackendRefs: []gatewayv1alpha2.BackendRef{}},
Rules: []gatewayv1.TLSRouteRule{
{BackendRefs: []gatewayv1.BackendRef{}},
},
},
}
Expand Down Expand Up @@ -330,14 +329,14 @@ func TestTranslateTCPRouteUpstreamScheme(t *testing.T) {
},
}

route := &gatewayv1alpha2.TCPRoute{
route := &gatewayv1.TCPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "my-tcp",
Namespace: namespace,
},
Spec: gatewayv1alpha2.TCPRouteSpec{
Rules: []gatewayv1alpha2.TCPRouteRule{{
BackendRefs: []gatewayv1alpha2.BackendRef{{
Spec: gatewayv1.TCPRouteSpec{
Rules: []gatewayv1.TCPRouteRule{{
BackendRefs: []gatewayv1.BackendRef{{
BackendObjectReference: gatewayv1.BackendObjectReference{
Name: gatewayv1.ObjectName(serviceName),
Port: ptr.To(portNumber),
Expand Down
3 changes: 1 addition & 2 deletions internal/adc/translator/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

adctypes "github.com/apache/apisix-ingress-controller/api/adc"
"github.com/apache/apisix-ingress-controller/api/v1alpha1"
Expand Down Expand Up @@ -240,7 +239,7 @@ func (t *Translator) AttachL4RoutePolicyPlugins(
continue
}
for _, ref := range policy.Spec.TargetRefs {
if string(ref.Group) != gatewayv1alpha2.GroupName {
if string(ref.Group) != gatewayv1.GroupName {
continue
}
if string(ref.Kind) != routeKind {
Expand Down
3 changes: 1 addition & 2 deletions internal/adc/translator/tcproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"sort"

gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

adctypes "github.com/apache/apisix-ingress-controller/api/adc"
apiv2 "github.com/apache/apisix-ingress-controller/api/v2"
Expand Down Expand Up @@ -105,7 +104,7 @@ func (t *Translator) buildL4StreamRoutes(tctx *provider.TranslateContext, namesp
return streamRoutes
}

func (t *Translator) TranslateTCPRoute(tctx *provider.TranslateContext, tcpRoute *gatewayv1alpha2.TCPRoute) (*TranslateResult, error) {
func (t *Translator) TranslateTCPRoute(tctx *provider.TranslateContext, tcpRoute *gatewayv1.TCPRoute) (*TranslateResult, error) {
result := &TranslateResult{}
rules := tcpRoute.Spec.Rules
labels := label.GenLabel(tcpRoute)
Expand Down
3 changes: 1 addition & 2 deletions internal/adc/translator/tlsroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"

gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

adctypes "github.com/apache/apisix-ingress-controller/api/adc"
apiv2 "github.com/apache/apisix-ingress-controller/api/v2"
Expand All @@ -31,7 +30,7 @@ import (
"github.com/apache/apisix-ingress-controller/internal/types"
)

func (t *Translator) TranslateTLSRoute(tctx *provider.TranslateContext, tlsRoute *gatewayv1alpha2.TLSRoute) (*TranslateResult, error) {
func (t *Translator) TranslateTLSRoute(tctx *provider.TranslateContext, tlsRoute *gatewayv1.TLSRoute) (*TranslateResult, error) {
result := &TranslateResult{}
rules := tlsRoute.Spec.Rules
labels := label.GenLabel(tlsRoute)
Expand Down
3 changes: 1 addition & 2 deletions internal/adc/translator/udproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"

gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

adctypes "github.com/apache/apisix-ingress-controller/api/adc"
apiv2 "github.com/apache/apisix-ingress-controller/api/v2"
Expand All @@ -31,7 +30,7 @@ import (
"github.com/apache/apisix-ingress-controller/internal/types"
)

func (t *Translator) TranslateUDPRoute(tctx *provider.TranslateContext, udpRoute *gatewayv1alpha2.UDPRoute) (*TranslateResult, error) {
func (t *Translator) TranslateUDPRoute(tctx *provider.TranslateContext, udpRoute *gatewayv1.UDPRoute) (*TranslateResult, error) {
result := &TranslateResult{}
rules := udpRoute.Spec.Rules
labels := label.GenLabel(udpRoute)
Expand Down
14 changes: 6 additions & 8 deletions internal/controller/consumer_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
"sigs.k8s.io/gateway-api/apis/v1beta1"

"github.com/apache/apisix-ingress-controller/api/v1alpha1"
"github.com/apache/apisix-ingress-controller/internal/provider"
Expand All @@ -48,7 +47,6 @@ func buildConsumerReconciler(t *testing.T, objs ...runtime.Object) *ConsumerReco
require.NoError(t, clientgoscheme.AddToScheme(scheme))
require.NoError(t, v1alpha1.AddToScheme(scheme))
require.NoError(t, gatewayv1.Install(scheme))
require.NoError(t, v1beta1.Install(scheme))

cli := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(objs...).Build()
return &ConsumerReconciler{Client: cli, Log: logr.Discard()}
Expand All @@ -75,16 +73,16 @@ func victimSecret() *corev1.Secret {
}
}

func secretGrant() *v1beta1.ReferenceGrant {
return &v1beta1.ReferenceGrant{
func secretGrant() *gatewayv1.ReferenceGrant {
return &gatewayv1.ReferenceGrant{
ObjectMeta: metav1.ObjectMeta{Name: "allow-consumer", Namespace: secretNS},
Spec: v1beta1.ReferenceGrantSpec{
From: []v1beta1.ReferenceGrantFrom{{
Group: v1beta1.Group(v1alpha1.GroupVersion.Group),
Spec: gatewayv1.ReferenceGrantSpec{
From: []gatewayv1.ReferenceGrantFrom{{
Group: gatewayv1.Group(v1alpha1.GroupVersion.Group),
Kind: "Consumer",
Namespace: consumerNS,
}},
To: []v1beta1.ReferenceGrantTo{{
To: []gatewayv1.ReferenceGrantTo{{
Group: "",
Kind: "Secret",
}},
Expand Down
Loading
Loading