Skip to content

Commit

Permalink
gatewayapi v1beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Nov 9, 2023
1 parent 0a8e214 commit 12b3aa3
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 205 deletions.
27 changes: 13 additions & 14 deletions cmd/generate_gatewayapi_httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/kuadrant/kuadrantctl/pkg/utils"
"github.com/spf13/cobra"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
gatewayapiv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
)

Expand Down Expand Up @@ -111,43 +110,43 @@ func generateGatewayApiHttpRoute(cmd *cobra.Command, args []string) error {
return nil
}

func generateGatewayAPIHTTPRoute(cmd *cobra.Command, doc *openapi3.T) (*gatewayapiv1alpha2.HTTPRoute, error) {
func generateGatewayAPIHTTPRoute(cmd *cobra.Command, doc *openapi3.T) (*gatewayapiv1beta1.HTTPRoute, error) {

//loop through gateway
// https://github.com/getkin/kin-openapi
gatewaysRef := []gatewayapiv1beta1.ParentReference{}
for _, gateway := range generateGatewayAPIHTTPRouteGateways {
gatewaysRef = append(gatewaysRef, gatewayapiv1beta1.ParentReference{
Name: gatewayapiv1alpha2.ObjectName(gateway),
Name: gatewayapiv1beta1.ObjectName(gateway),
})
}

port := gatewayapiv1alpha2.PortNumber(generateGatewayAPIHTTPRouteSvcPort)
port := gatewayapiv1beta1.PortNumber(generateGatewayAPIHTTPRouteSvcPort)
service := fmt.Sprintf("%s.%s.svc", generateGatewayAPIHTTPRouteSvcName, generateGatewayAPIHTTPRouteSvcNamespace)
matches, err := gatewayapi.HTTPRouteMatchesFromOAS(doc)
if err != nil {
return nil, err
}

httpRoute := gatewayapiv1alpha2.HTTPRoute{
httpRoute := gatewayapiv1beta1.HTTPRoute{
TypeMeta: v1.TypeMeta{
Kind: "HTTPRoute",
APIVersion: "gateway.networking.k8s.io/v1alpha2",
APIVersion: "gateway.networking.k8s.io/v1beta1",
},
Spec: gatewayapiv1alpha2.HTTPRouteSpec{
Spec: gatewayapiv1beta1.HTTPRouteSpec{
CommonRouteSpec: gatewayapiv1beta1.CommonRouteSpec{
ParentRefs: gatewaysRef,
},
Hostnames: []gatewayapiv1alpha2.Hostname{
gatewayapiv1alpha2.Hostname(generateGatewayAPIHTTPRouteHost),
Hostnames: []gatewayapiv1beta1.Hostname{
gatewayapiv1beta1.Hostname(generateGatewayAPIHTTPRouteHost),
},
Rules: []gatewayapiv1alpha2.HTTPRouteRule{
Rules: []gatewayapiv1beta1.HTTPRouteRule{
{
BackendRefs: []gatewayapiv1alpha2.HTTPBackendRef{
BackendRefs: []gatewayapiv1beta1.HTTPBackendRef{
{
BackendRef: gatewayapiv1alpha2.BackendRef{
BackendObjectReference: gatewayapiv1alpha2.BackendObjectReference{
Name: gatewayapiv1alpha2.ObjectName(service),
BackendRef: gatewayapiv1beta1.BackendRef{
BackendObjectReference: gatewayapiv1beta1.BackendObjectReference{
Name: gatewayapiv1beta1.ObjectName(service),
Port: &port,
},
},
Expand Down
55 changes: 27 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,40 @@ require (
github.com/getkin/kin-openapi v0.76.0
github.com/kuadrant/kuadrant-operator v0.4.1
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.27.8
github.com/onsi/gomega v1.27.10
github.com/operator-framework/api v0.19.0
github.com/spf13/cobra v1.7.0
k8s.io/api v0.27.7
k8s.io/apiextensions-apiserver v0.27.7
k8s.io/apimachinery v0.27.7
k8s.io/client-go v0.27.7
sigs.k8s.io/controller-runtime v0.15.0
k8s.io/api v0.28.3
k8s.io/apiextensions-apiserver v0.28.3
k8s.io/apimachinery v0.28.3
k8s.io/client-go v0.28.3
sigs.k8s.io/controller-runtime v0.16.3
sigs.k8s.io/gateway-api v0.6.2
)

require (
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kuadrant/authorino-operator v0.9.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -50,28 +49,28 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230525154841-bd750badd5c6 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
istio.io/api v0.0.0-20230712174848-a2b2de508c88 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // 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.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit 12b3aa3

Please sign in to comment.