Skip to content

Commit

Permalink
revert: Use v1beta1 gateway API
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 authored and leozhantw committed Jun 27, 2024
1 parent 3972536 commit 58d369a
Show file tree
Hide file tree
Showing 525 changed files with 1,233 additions and 1,207 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha1/basic_auth_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package v1alpha1

import gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"

const BasicAuthUsersSecretKey = ".htpasswd"

Expand All @@ -23,5 +23,5 @@ type BasicAuth struct {
// for more details.
//
// Note: The secret must be in the same namespace as the SecurityPolicy.
Users gwapiv1b1.SecretObjectReference `json:"users"`
Users gwapiv1.SecretObjectReference `json:"users"`
}
6 changes: 2 additions & 4 deletions api/v1alpha1/oidc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

package v1alpha1

import (
gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
)
import gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"

const OIDCClientSecretKey = "client-secret"

Expand All @@ -28,7 +26,7 @@ type OIDC struct {
// This is an Opaque secret. The client secret should be stored in the key
// "client-secret".
// +kubebuilder:validation:Required
ClientSecret gwapiv1b1.SecretObjectReference `json:"clientSecret"`
ClientSecret gwapiv1.SecretObjectReference `json:"clientSecret"`

// The OIDC scopes to be used in the
// [Authentication Request](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest).
Expand Down
8 changes: 4 additions & 4 deletions internal/cmd/egctl/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
gwv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"

egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1"
)
Expand Down Expand Up @@ -119,21 +119,21 @@ func runStatus(ctx context.Context, cli client.Client, resourceType, namespace s

switch strings.ToLower(resourceType) {
case "gc", "gatewayclass":
gc := gwv1.GatewayClassList{}
gc := gwv1b1.GatewayClassList{}
if err := cli.List(ctx, &gc, client.InNamespace(namespace)); err != nil {
return err
}
resourcesList = &gc

case "gtw", "gateway":
gtw := gwv1.GatewayList{}
gtw := gwv1b1.GatewayList{}
if err := cli.List(ctx, &gtw, client.InNamespace(namespace)); err != nil {
return err
}
resourcesList = &gtw

case "httproute":
httproute := gwv1.HTTPRouteList{}
httproute := gwv1b1.HTTPRouteList{}
if err := cli.List(ctx, &httproute, client.InNamespace(namespace)); err != nil {
return err
}
Expand Down
37 changes: 19 additions & 18 deletions internal/cmd/egctl/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
"testing"
"time"

egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1"

"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
gwv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1"
gwv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1"
)

func TestWriteStatus(t *testing.T) {
Expand All @@ -37,7 +38,7 @@ func TestWriteStatus(t *testing.T) {
}{
{
name: "egctl x status gc -v, but no resources",
resourceList: &gwv1.GatewayClassList{},
resourceList: &gwv1b1.GatewayClassList{},
resourceNamespaced: false,
resourceType: "gatewayclass",
quiet: false,
Expand All @@ -50,8 +51,8 @@ func TestWriteStatus(t *testing.T) {
},
{
name: "egctl x status gc",
resourceList: &gwv1.GatewayClassList{
Items: []gwv1.GatewayClass{
resourceList: &gwv1b1.GatewayClassList{
Items: []gwv1b1.GatewayClass{
{
ObjectMeta: metav1.ObjectMeta{
Name: "gc",
Expand Down Expand Up @@ -93,8 +94,8 @@ gc foobar2 test-status-2 test reason 2
},
{
name: "egctl x status gc -v",
resourceList: &gwv1.GatewayClassList{
Items: []gwv1.GatewayClass{
resourceList: &gwv1b1.GatewayClassList{
Items: []gwv1b1.GatewayClass{
{
ObjectMeta: metav1.ObjectMeta{
Name: "gc",
Expand Down Expand Up @@ -136,8 +137,8 @@ gc foobar2 test-status-2 test reason 2 test message 2 123457
},
{
name: "egctl x status gc -v -q",
resourceList: &gwv1.GatewayClassList{
Items: []gwv1.GatewayClass{
resourceList: &gwv1b1.GatewayClassList{
Items: []gwv1b1.GatewayClass{
{
ObjectMeta: metav1.ObjectMeta{
Name: "gc",
Expand Down Expand Up @@ -178,7 +179,7 @@ gc foobar2 test-status-2 test reason 2 test message 2 123457
},
{
name: "egctl x status gtw -v -A, no resources",
resourceList: &gwv1.GatewayList{},
resourceList: &gwv1b1.GatewayList{},
resourceNamespaced: true,
resourceType: "gateway",
quiet: false,
Expand All @@ -191,8 +192,8 @@ gc foobar2 test-status-2 test reason 2 test message 2 123457
},
{
name: "egctl x status gtw -v -A",
resourceList: &gwv1.GatewayList{
Items: []gwv1.Gateway{
resourceList: &gwv1b1.GatewayList{
Items: []gwv1b1.Gateway{
{
ObjectMeta: metav1.ObjectMeta{
Name: "gtw",
Expand Down Expand Up @@ -235,8 +236,8 @@ default gtw foobar2 test-status-2 test reason 2 test message 2
},
{
name: "egctl x status gtw -v -q -A",
resourceList: &gwv1.GatewayList{
Items: []gwv1.Gateway{
resourceList: &gwv1b1.GatewayList{
Items: []gwv1b1.Gateway{
{
ObjectMeta: metav1.ObjectMeta{
Name: "gtw1",
Expand Down Expand Up @@ -305,8 +306,8 @@ default2 gtw2 foobar4 test-status-4 test reason 4 test message 4
},
{
name: "egctl x status httproute -A",
resourceList: &gwv1.HTTPRouteList{
Items: []gwv1.HTTPRoute{
resourceList: &gwv1b1.HTTPRouteList{
Items: []gwv1b1.HTTPRoute{
{
ObjectMeta: metav1.ObjectMeta{
Name: "http1",
Expand Down Expand Up @@ -389,8 +390,8 @@ default2 http2 foobar4 test-status-4 test reason 4
},
{
name: "egctl x status httproute -q -n default1",
resourceList: &gwv1.HTTPRouteList{
Items: []gwv1.HTTPRoute{
resourceList: &gwv1b1.HTTPRouteList{
Items: []gwv1b1.HTTPRoute{
{
ObjectMeta: metav1.ObjectMeta{
Name: "http1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand Down Expand Up @@ -91,7 +91,7 @@ spec:
port: 3000
weight: 1
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand Down Expand Up @@ -70,7 +70,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand Down Expand Up @@ -74,7 +74,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand Down Expand Up @@ -123,7 +123,7 @@ spec:
port: 3000
weight: 1
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
address: 127.0.0.1
port_value: 19000
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: eg
Expand All @@ -30,7 +30,7 @@ spec:
name: example
namespace: default
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand Down Expand Up @@ -148,7 +148,7 @@ spec:
port: 3000
weight: 1
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand Down Expand Up @@ -85,7 +85,7 @@ spec:
remoteJWKS:
uri: https://raw.githubusercontent.com/envoyproxy/gateway/main/examples/kubernetes/jwt/jwks.json
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
10 changes: 5 additions & 5 deletions internal/cmd/egctl/testdata/translate/in/multiple-xds.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand Down Expand Up @@ -41,7 +41,7 @@ spec:
selector:
app: backend
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand All @@ -63,7 +63,7 @@ spec:
type: PathPrefix
value: /
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg2
Expand All @@ -75,7 +75,7 @@ spec:
protocol: HTTP
port: 80
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: eg
Expand All @@ -9,7 +9,7 @@ spec:
protocol: HTTP
port: 80
---
apiVersion: gateway.networking.k8s.io/v1
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: backend
Expand Down
Loading

0 comments on commit 58d369a

Please sign in to comment.