Skip to content

Commit 66689c0

Browse files
author
Kate Osborn
committed
Use v1 ParentRef
1 parent 50cc127 commit 66689c0

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

internal/mode/static/state/graph/graph_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func TestBuildGraph(t *testing.T) {
363363
processedRoutePolicy := &Policy{
364364
Source: hrPolicy,
365365
Ancestor: &PolicyAncestor{
366-
Ancestor: v1alpha2.ParentReference{
366+
Ancestor: gatewayv1.ParentReference{
367367
Group: helpers.GetPointer[gatewayv1.Group](gatewayv1.GroupName),
368368
Kind: helpers.GetPointer[gatewayv1.Kind](kinds.HTTPRoute),
369369
Namespace: (*gatewayv1.Namespace)(&testNs),
@@ -392,7 +392,7 @@ func TestBuildGraph(t *testing.T) {
392392
processedGwPolicy := &Policy{
393393
Source: gwPolicy,
394394
Ancestor: &PolicyAncestor{
395-
Ancestor: v1alpha2.ParentReference{
395+
Ancestor: gatewayv1.ParentReference{
396396
Group: helpers.GetPointer[gatewayv1.Group](gatewayv1.GroupName),
397397
Kind: helpers.GetPointer[gatewayv1.Kind](kinds.Gateway),
398398
Namespace: (*gatewayv1.Namespace)(&testNs),

internal/mode/static/state/graph/policies.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"k8s.io/apimachinery/pkg/types"
99
"sigs.k8s.io/controller-runtime/pkg/client"
1010
v1 "sigs.k8s.io/gateway-api/apis/v1"
11-
"sigs.k8s.io/gateway-api/apis/v1alpha2"
1211

1312
"github.com/nginxinc/nginx-gateway-fabric/internal/framework/conditions"
1413
"github.com/nginxinc/nginx-gateway-fabric/internal/framework/kinds"
@@ -37,7 +36,7 @@ type Policy struct {
3736
// PolicyAncestor represents an ancestor of a Policy.
3837
type PolicyAncestor struct {
3938
// Ancestor is the ancestor object.
40-
Ancestor v1alpha2.ParentReference
39+
Ancestor v1.ParentReference
4140
// Conditions contains the list of conditions of the Policy in relation to the ancestor.
4241
Conditions []conditions.Condition
4342
}

internal/mode/static/state/graph/policy_ancestor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func ancestorsFull(
1212
ancestors []v1alpha2.PolicyAncestorStatus,
13-
newAncestor v1alpha2.ParentReference,
13+
newAncestor v1.ParentReference,
1414
ctlrName string,
1515
) bool {
1616
if len(ancestors) < 16 {

internal/mode/static/state/graph/policy_ancestor_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestAncestorsFull(t *testing.T) {
1919

2020
for i := 0; i < numAncestors; i++ {
2121
statuses = append(statuses, v1alpha2.PolicyAncestorStatus{
22-
AncestorRef: v1alpha2.ParentReference{
22+
AncestorRef: v1.ParentReference{
2323
Group: helpers.GetPointer[v1.Group](v1.GroupName),
2424
Kind: helpers.GetPointer[v1.Kind](kinds.Gateway),
2525
Namespace: (*v1.Namespace)(&ns),
@@ -33,15 +33,15 @@ func TestAncestorsFull(t *testing.T) {
3333
}
3434

3535
tests := []struct {
36-
newAncestor v1alpha2.ParentReference
36+
newAncestor v1.ParentReference
3737
name string
3838
curStatus []v1alpha2.PolicyAncestorStatus
3939
expFull bool
4040
}{
4141
{
4242
name: "not full",
4343
curStatus: createCurStatus(15, "controller"),
44-
newAncestor: v1alpha2.ParentReference{
44+
newAncestor: v1.ParentReference{
4545
Group: helpers.GetPointer[v1.Group](v1.GroupName),
4646
Kind: helpers.GetPointer[v1.Kind](kinds.Gateway),
4747
Namespace: (*v1.Namespace)(&ns),
@@ -52,7 +52,7 @@ func TestAncestorsFull(t *testing.T) {
5252
{
5353
name: "full; ancestor does not exist in current status",
5454
curStatus: createCurStatus(16, "controller"),
55-
newAncestor: v1alpha2.ParentReference{
55+
newAncestor: v1.ParentReference{
5656
Group: helpers.GetPointer[v1.Group](v1.GroupName),
5757
Kind: helpers.GetPointer[v1.Kind](kinds.Gateway),
5858
Namespace: (*v1.Namespace)(&ns),
@@ -63,7 +63,7 @@ func TestAncestorsFull(t *testing.T) {
6363
{
6464
name: "full, but ancestor does exist in current status",
6565
curStatus: createCurStatus(16, "nginx-gateway"),
66-
newAncestor: v1alpha2.ParentReference{
66+
newAncestor: v1.ParentReference{
6767
Group: helpers.GetPointer[v1.Group](v1.GroupName),
6868
Kind: helpers.GetPointer[v1.Kind](kinds.Gateway),
6969
Namespace: (*v1.Namespace)(&ns),
@@ -88,7 +88,7 @@ func TestAncestorStatusExists(t *testing.T) {
8888
ns := "test"
8989

9090
return v1alpha2.PolicyAncestorStatus{
91-
AncestorRef: v1alpha2.ParentReference{
91+
AncestorRef: v1.ParentReference{
9292
Group: helpers.GetPointer[v1.Group](v1.GroupName),
9393
Kind: helpers.GetPointer[v1.Kind](kinds.Gateway),
9494
Namespace: (*v1.Namespace)(&ns),

internal/mode/static/status/prepare_requests_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ func TestBuildNGFPolicyStatuses(t *testing.T) {
14221422
validPolicyCfg := policyCfg{
14231423
Name: validPolicyKey.NsName.Name,
14241424
Ancestor: &graph.PolicyAncestor{
1425-
Ancestor: v1alpha2.ParentReference{
1425+
Ancestor: v1.ParentReference{
14261426
Name: "ancestor",
14271427
},
14281428
},
@@ -1436,7 +1436,7 @@ func TestBuildNGFPolicyStatuses(t *testing.T) {
14361436
Name: invalidPolicyKey.NsName.Name,
14371437
Conditions: invalidConds,
14381438
Ancestor: &graph.PolicyAncestor{
1439-
Ancestor: v1alpha2.ParentReference{
1439+
Ancestor: v1.ParentReference{
14401440
Name: "ancestor",
14411441
},
14421442
},
@@ -1449,7 +1449,7 @@ func TestBuildNGFPolicyStatuses(t *testing.T) {
14491449
targetRefNotFoundPolicyCfg := policyCfg{
14501450
Name: targetRefNotFoundPolicyKey.NsName.Name,
14511451
Ancestor: &graph.PolicyAncestor{
1452-
Ancestor: v1alpha2.ParentReference{
1452+
Ancestor: v1.ParentReference{
14531453
Name: "ancestor",
14541454
},
14551455
Conditions: targetRefNotFoundConds,
@@ -1464,7 +1464,7 @@ func TestBuildNGFPolicyStatuses(t *testing.T) {
14641464
Name: multiInvalidCondsPolicyKey.NsName.Name,
14651465
Conditions: invalidConds,
14661466
Ancestor: &graph.PolicyAncestor{
1467-
Ancestor: v1alpha2.ParentReference{
1467+
Ancestor: v1.ParentReference{
14681468
Name: "ancestor",
14691469
},
14701470
Conditions: targetRefNotFoundConds,

0 commit comments

Comments
 (0)