Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apiv1beta1 #608

Closed
wants to merge 4 commits into from
Closed
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
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ require (
k8s.io/apimachinery v0.28.3
k8s.io/client-go v0.28.3
sigs.k8s.io/controller-runtime v0.16.2
sigs.k8s.io/controller-tools v0.13.0
sigs.k8s.io/gateway-api v0.5.0
sigs.k8s.io/yaml v1.4.0
sigs.k8s.io/gateway-api v0.8.1
)

require (
Expand Down Expand Up @@ -89,8 +87,8 @@ require (
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/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230928205116-a78145627833 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
30 changes: 14 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -459,26 +459,24 @@ gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/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.28.3 h1:Gj1HtbSdB4P08C8rs9AR94MfSGpRhJgsS+GF9V26xMM=
k8s.io/api v0.28.3/go.mod h1:MRCV/jr1dW87/qJnZ57U5Pak65LGmQVkKTzf3AtKFHc=
k8s.io/apiextensions-apiserver v0.28.3 h1:Od7DEnhXHnHPZG+W9I97/fSQkVpVPQx2diy+2EtmY08=
k8s.io/apiextensions-apiserver v0.28.3/go.mod h1:NE1XJZ4On0hS11aWWJUTNkmVB03j9LM7gJSisbRt8Lc=
k8s.io/apimachinery v0.28.3 h1:B1wYx8txOaCQG0HmYF6nbpU8dg6HvA06x5tEffvOe7A=
k8s.io/apimachinery v0.28.3/go.mod h1:uQTKmIqs+rAYaq+DFaoD2X7pcjLOqbQX2AOiO0nIpb8=
k8s.io/client-go v0.28.3 h1:2OqNb72ZuTZPKCl+4gTKvqao0AMOl9f3o2ijbAj3LI4=
k8s.io/client-go v0.28.3/go.mod h1:LTykbBp9gsA7SwqirlCXBWtK0guzfhpoW4qSm7i9dxo=
k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=
k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo=
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e h1:snPmy96t93RredGRjKfMFt+gvxuVAncqSAyBveJtr4Q=
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/api v0.28.2 h1:9mpl5mOb6vXZvqbQmankOfPIGiudghwCoLl1EYfUZbw=
k8s.io/api v0.28.2/go.mod h1:RVnJBsjU8tcMq7C3iaRSGMeaKt2TWEUXcpIt/90fjEg=
k8s.io/apiextensions-apiserver v0.28.2 h1:J6/QRWIKV2/HwBhHRVITMLYoypCoPY1ftigDM0Kn+QU=
k8s.io/apiextensions-apiserver v0.28.2/go.mod h1:5tnkxLGa9nefefYzWuAlWZ7RZYuN/765Au8cWLA6SRg=
k8s.io/apimachinery v0.28.2 h1:KCOJLrc6gu+wV1BYgwik4AF4vXOlVJPdiqn0yAWWwXQ=
k8s.io/apimachinery v0.28.2/go.mod h1:RdzF87y/ngqk9H4z3EL2Rppv5jj95vGS/HaFXrLDApU=
k8s.io/client-go v0.28.2 h1:DNoYI1vGq0slMBN/SWKMZMw0Rq+0EQW6/AK4v9+3VeY=
k8s.io/client-go v0.28.2/go.mod h1:sMkApowspLuc7omj1FOSUxSoqjr+d5Q0Yc0LOFnYFJY=
k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20230928205116-a78145627833 h1:iFFEmmB7szQhJP42AvRD2+gzdVP7EuIKY1rJgxf0JZY=
k8s.io/kube-openapi v0.0.0-20230928205116-a78145627833/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.16.2 h1:mwXAVuEk3EQf478PQwQ48zGOXvW27UJc8NHktQVuIPU=
sigs.k8s.io/controller-runtime v0.16.2/go.mod h1:vpMu3LpI5sYWtujJOa2uPK61nB5rbwlN7BAB8aSLvGU=
sigs.k8s.io/controller-tools v0.13.0 h1:NfrvuZ4bxyolhDBt/rCZhDnx3M2hzlhgo5n3Iv2RykI=
sigs.k8s.io/controller-tools v0.13.0/go.mod h1:5vw3En2NazbejQGCeWKRrE7q4P+CW8/klfVqP8QZkgA=
sigs.k8s.io/gateway-api v0.5.0 h1:ze+k9fJqvmL8s1t3e4q1ST8RnN+f09dEv+gfacahlAE=
sigs.k8s.io/gateway-api v0.5.0/go.mod h1:x0AP6gugkFV8fC/oTlnOMU0pnmuzIR8LfIPRVUjxSqA=
sigs.k8s.io/gateway-api v0.8.1 h1:Bo4NMAQFYkQZnHXOfufbYwbPW7b3Ic5NjpbeW6EJxuU=
sigs.k8s.io/gateway-api v0.8.1/go.mod h1:0PteDrsrgkRmr13nDqFWnev8tOysAVrwnvfFM55tSVg=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
Expand Down
9 changes: 4 additions & 5 deletions pkg/gateways/gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/gateway-api/apis/v1alpha2"
"sigs.k8s.io/gateway-api/apis/v1beta1"
)

Expand Down Expand Up @@ -246,7 +245,7 @@ MAIN_LOOP:
if listener.AllowedRoutes != nil {
validRGK := []store.RouteGroupKind{}
for _, kind := range listener.AllowedRoutes.Kinds {
if (kind.Group == nil || *kind.Group == v1alpha2.GroupName) && kind.Kind == K8S_TCPROUTE_KIND {
if (kind.Group == nil || *kind.Group == v1beta1.GroupName) && kind.Kind == K8S_TCPROUTE_KIND {
validRGK = append(validRGK, kind)
}
}
Expand Down Expand Up @@ -551,7 +550,7 @@ func (gm GatewayManagerImpl) isTCPRouteAllowedByListener(listener store.Listener

gkAllowed := listener.AllowedRoutes.Kinds == nil || len(listener.AllowedRoutes.Kinds) == 0
for _, kind := range listener.AllowedRoutes.Kinds {
if (kind.Group != nil && *kind.Group != v1alpha2.GroupName) || kind.Kind != K8S_TCPROUTE_KIND {
if (kind.Group != nil && *kind.Group != v1beta1.GroupName) || kind.Kind != K8S_TCPROUTE_KIND {
continue
}
gkAllowed = true
Expand All @@ -564,13 +563,13 @@ func (gm GatewayManagerImpl) isTCPRouteAllowedByListener(listener store.Listener
if allowedRoutesNamespaces != nil {
from := allowedRoutesNamespaces.From
if from == nil {
v := (string)(v1alpha2.NamespacesFromSame)
v := (string)(v1beta1.NamespacesFromSame)
from = &v
}
if *from == "Same" {
return routeNamespace == gatewayNamespace
}
if *from == (string)(v1alpha2.NamespacesFromSelector) {
if *from == (string)(v1beta1.NamespacesFromSelector) {
if allowedRoutesNamespaces.Selector == nil {
return false
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/gateways/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ func (statusMgr *StatusManagerImpl) UpdateStatusTCPRoutes(routesStatusRecords []
for _, parentStatusRecord := range tcprouteStatusRecord.parentsStatusesRecords {
parentStatusRecord := parentStatusRecord
conditions := []metav1.Condition{}
routeParentStatus := v1alpha2.RouteParentStatus{
ControllerName: v1alpha2.GatewayController(statusMgr.gatewayControllerName),
ParentRef: v1alpha2.ParentReference{
Group: (*v1alpha2.Group)(&parentStatusRecord.parentRef.Group),
Kind: (*v1alpha2.Kind)(&parentStatusRecord.parentRef.Kind),
Namespace: (*v1alpha2.Namespace)(parentStatusRecord.parentRef.Namespace),
Name: v1alpha2.ObjectName(parentStatusRecord.parentRef.Name),
SectionName: (*v1alpha2.SectionName)(parentStatusRecord.parentRef.SectionName),
Port: (*v1alpha2.PortNumber)(parentStatusRecord.parentRef.Port),
routeParentStatus := v1beta1.RouteParentStatus{
ControllerName: v1beta1.GatewayController(statusMgr.gatewayControllerName),
ParentRef: v1beta1.ParentReference{
Group: (*v1beta1.Group)(&parentStatusRecord.parentRef.Group),
Kind: (*v1beta1.Kind)(&parentStatusRecord.parentRef.Kind),
Namespace: (*v1beta1.Namespace)(parentStatusRecord.parentRef.Namespace),
Name: v1beta1.ObjectName(parentStatusRecord.parentRef.Name),
SectionName: (*v1beta1.SectionName)(parentStatusRecord.parentRef.SectionName),
Port: (*v1beta1.PortNumber)(parentStatusRecord.parentRef.Port),
},
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/k8s/informers.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ type InformerGetter interface {
}

type GatewayRelatedType interface {
*gatewayv1beta1.GatewayClass | *gatewayv1beta1.Gateway | *gatewayv1alpha2.TCPRoute | *gatewayv1alpha2.ReferenceGrant
*gatewayv1beta1.GatewayClass | *gatewayv1beta1.Gateway | *gatewayv1alpha2.TCPRoute | *gatewayv1beta1.ReferenceGrant
}

type GatewayInformerFunc[GWType GatewayRelatedType] func(gwObj GWType, eventChan chan SyncDataEvent, status store.Status)
Expand Down Expand Up @@ -910,12 +910,12 @@ func PopulateInformer[IT InformerGetter, GWType GatewayRelatedType, GWF GatewayI
}

func (k k8s) getReferenceGrantInformer(eventChan chan SyncDataEvent, factory gatewaynetworking.SharedInformerFactory) cache.SharedIndexInformer {
informer := factory.Gateway().V1alpha2().ReferenceGrants()
PopulateInformer(eventChan, informer, GatewayInformerFunc[*gatewayv1alpha2.ReferenceGrant](manageReferenceGrant))
informer := factory.Gateway().V1beta1().ReferenceGrants()
PopulateInformer(eventChan, informer, GatewayInformerFunc[*gatewayv1beta1.ReferenceGrant](manageReferenceGrant))
return informer.Informer()
}

func manageReferenceGrant(referenceGrant *gatewayv1alpha2.ReferenceGrant, eventChan chan SyncDataEvent, status store.Status) {
func manageReferenceGrant(referenceGrant *gatewayv1beta1.ReferenceGrant, eventChan chan SyncDataEvent, status store.Status) {
logger.Debugf("gwapi: referencegrant: informers: got '%s/%s'", referenceGrant.Namespace, referenceGrant.Name)
item := store.ReferenceGrant{
Name: referenceGrant.Name,
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var logger = utils.GetK8sLogger()
const (
CRSGroupVersionV1alpha1 = "core.haproxy.org/v1alpha1"
CRSGroupVersionV1alpha2 = "core.haproxy.org/v1alpha2"
GATEWAY_API_VERSION = "v0.8.1" //nolint:golint,stylecheck
CRSGroupVersionV1 = "ingress.v1.haproxy.org/v1"
GATEWAY_API_VERSION = "v0.5.1" //nolint:golint,stylecheck
)

var ErrIgnored = errors.New("ignored resource")
Expand Down
Loading