Skip to content

Commit 7dc9cdc

Browse files
authored
chore: refer proper versions of GWAPI CRDs (#279)
1 parent c7a8d0f commit 7dc9cdc

6 files changed

+25
-21
lines changed

pkg/provider/k8sgatewayscountprovider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
func NewK8sGatewayCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error) {
2323
gvr := schema.GroupVersionResource{
2424
Group: "gateway.networking.k8s.io",
25-
Version: "v1beta1",
25+
Version: "v1",
2626
Resource: "gateways",
2727
}
2828
return NewK8sObjectCountProviderWithRESTMapper(name, GatewayCountKind, d, gvr, rm)

pkg/provider/k8sgrpcroutescountprovider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
func NewK8sGRPCRouteCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error) {
2323
gvr := schema.GroupVersionResource{
2424
Group: "gateway.networking.k8s.io",
25-
Version: "v1alpha2",
25+
Version: "v1",
2626
Resource: "grpcroutes",
2727
}
2828
return NewK8sObjectCountProviderWithRESTMapper(name, GRPCRouteCountKind, d, gvr, rm)

pkg/provider/k8shttproutescountprovider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
func NewK8sHTTPRouteCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error) {
2323
gvr := schema.GroupVersionResource{
2424
Group: "gateway.networking.k8s.io",
25-
Version: "v1beta1",
25+
Version: "v1",
2626
Resource: "httproutes",
2727
}
2828
return NewK8sObjectCountProviderWithRESTMapper(name, HTTPRouteCountKind, d, gvr, rm)

pkg/provider/k8stgatewayclassescountprovider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const (
2222
func NewK8sGatewayClassCountProvider(name string, d dynamic.Interface, rm meta.RESTMapper) (Provider, error) {
2323
gvr := schema.GroupVersionResource{
2424
Group: "gateway.networking.k8s.io",
25-
Version: "v1beta1",
25+
Version: "v1",
2626
Resource: "gatewayclasses",
2727
}
2828
return NewK8sObjectCountProviderWithRESTMapper(name, GatewayClassCountKind, d, gvr, rm)

pkg/telemetry/manager_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
clientgo_fake "k8s.io/client-go/kubernetes/fake"
2020
"k8s.io/client-go/kubernetes/scheme"
2121
ctrlclient_fake "sigs.k8s.io/controller-runtime/pkg/client/fake"
22+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
2223
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
2324
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
2425

@@ -172,6 +173,7 @@ func TestManagerWithMultilpleWorkflows(t *testing.T) {
172173

173174
func TestManagerWithCatalogWorkflows(t *testing.T) {
174175
t.Run("identify platform and cluster state", func(t *testing.T) {
176+
require.NoError(t, gatewayv1.Install(scheme.Scheme))
175177
require.NoError(t, gatewayv1beta1.Install(scheme.Scheme))
176178
require.NoError(t, gatewayv1alpha2.Install(scheme.Scheme))
177179

pkg/telemetry/workflowsk8s_test.go

+19-17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
clientgo_fake "k8s.io/client-go/kubernetes/fake"
2121
"k8s.io/client-go/kubernetes/scheme"
2222
ctrlclient_fake "sigs.k8s.io/controller-runtime/pkg/client/fake"
23+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
2324
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
2425
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
2526

@@ -122,6 +123,7 @@ func TestWorkflowClusterState(t *testing.T) {
122123
})
123124

124125
t.Run("properly reports cluster state", func(t *testing.T) {
126+
require.NoError(t, gatewayv1.Install(scheme.Scheme))
125127
require.NoError(t, gatewayv1beta1.Install(scheme.Scheme))
126128
require.NoError(t, gatewayv1alpha2.Install(scheme.Scheme))
127129

@@ -152,19 +154,19 @@ func TestWorkflowClusterState(t *testing.T) {
152154
Name: "srv",
153155
},
154156
},
155-
&gatewayv1beta1.GatewayClass{
157+
&gatewayv1.GatewayClass{
156158
ObjectMeta: metav1.ObjectMeta{
157159
Namespace: "kong",
158160
Name: "gatewayclass-1",
159161
},
160162
},
161-
&gatewayv1beta1.Gateway{
163+
&gatewayv1.Gateway{
162164
ObjectMeta: metav1.ObjectMeta{
163165
Namespace: "kong",
164166
Name: "gateway-1",
165167
},
166168
},
167-
&gatewayv1beta1.HTTPRoute{
169+
&gatewayv1.HTTPRoute{
168170
ObjectMeta: metav1.ObjectMeta{
169171
Namespace: "kong",
170172
Name: "httproute-1",
@@ -176,7 +178,7 @@ func TestWorkflowClusterState(t *testing.T) {
176178
Name: "referencegrant-1",
177179
},
178180
},
179-
&gatewayv1alpha2.GRPCRoute{
181+
&gatewayv1.GRPCRoute{
180182
ObjectMeta: metav1.ObjectMeta{
181183
Namespace: "kong",
182184
Name: "grpcroute-1",
@@ -272,11 +274,11 @@ func TestWorkflowClusterState(t *testing.T) {
272274
meta.RESTScopeRoot,
273275
)
274276
}
275-
as(gatewayv1beta1.GroupVersion, "GatewayClass", "gatewayclasses")
276-
as(gatewayv1beta1.GroupVersion, "Gateway", "gateways")
277-
as(gatewayv1beta1.GroupVersion, "HTTPRoute", "httproutes")
277+
as(gatewayv1.GroupVersion, "GatewayClass", "gatewayclasses")
278+
as(gatewayv1.GroupVersion, "Gateway", "gateways")
279+
as(gatewayv1.GroupVersion, "HTTPRoute", "httproutes")
280+
as(gatewayv1.GroupVersion, "GRPCRoute", "grpcroutes")
278281
as(gatewayv1beta1.GroupVersion, "ReferenceGrant", "referencegrants")
279-
as(gatewayv1alpha2.GroupVersion, "GRPCRoute", "grpcroutes")
280282
as(gatewayv1alpha2.GroupVersion, "TCPRoute", "tcproutes")
281283
as(gatewayv1alpha2.GroupVersion, "UDPRoute", "udproutes")
282284
as(gatewayv1alpha2.GroupVersion, "TLSRoute", "tlsroutes")
@@ -293,7 +295,7 @@ func TestWorkflowClusterState(t *testing.T) {
293295
map[schema.GroupVersionResource]string{
294296
{
295297
Group: "gateway.networking.k8s.io",
296-
Version: "v1beta1",
298+
Version: "v1",
297299
Resource: "gateways",
298300
}: "GatewayList",
299301
},
@@ -312,17 +314,17 @@ func TestWorkflowClusterState(t *testing.T) {
312314
provider.NodeCountKey: 2,
313315
provider.PodCountKey: 1,
314316
provider.ServiceCountKey: 2,
315-
// gateway.networking.k8s.io v1beta1
317+
// gateway.networking.k8s.io v1
318+
provider.GRPCRouteCountKey: 1,
319+
provider.HTTPRouteCountKey: 1,
316320
provider.GatewayClassCountKey: 1,
317-
// This should be equal to 1 but see above for comment explaining the issue.
318-
provider.GatewayCountKey: 0,
319-
provider.HTTPRouteCountKey: 1,
321+
provider.GatewayCountKey: 0, // This should be equal to 1 but see above for comment explaining the issue.
322+
// gateway.networking.k8s.io v1beta1
320323
provider.ReferenceGrantCountKey: 1,
321324
// gateway.networking.k8s.io v1alpha2
322-
provider.GRPCRouteCountKey: 1,
323-
provider.TCPRouteCountKey: 1,
324-
provider.UDPRouteCountKey: 1,
325-
provider.TLSRouteCountKey: 1,
325+
provider.TCPRouteCountKey: 1,
326+
provider.UDPRouteCountKey: 1,
327+
provider.TLSRouteCountKey: 1,
326328
}, r)
327329
})
328330

0 commit comments

Comments
 (0)