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

add support for gateway-api #72

Merged
merged 6 commits into from
Nov 8, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
get ingress domain from go commons lib
mohit-sheth authored and rsevilla87 committed Nov 8, 2024
commit 77c8176c820db475105868b33d6cea6967483ddc
5 changes: 5 additions & 0 deletions pkg/runner/runner.go
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ import (
openshiftrouteclientset "github.com/openshift/client-go/route/clientset/versioned"
istioclient "istio.io/client-go/pkg/clientset/versioned"
"k8s.io/client-go/tools/clientcmd"
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
gatewayApiClientset "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned"
)

@@ -302,6 +303,10 @@ func (r *Runner) deployAssets() error {
}
}
if r.gatewayApi {
ocpMetadata, _ := ocpmetadata.NewMetadata(restConfig)
ingressDomain, _ = ocpMetadata.GetDefaultIngressDomain()
listenerHostName = gatewayv1beta1.Hostname("*.gwapi." + ingressDomain)
httproutes.Spec.Hostnames = append(httproutes.Spec.Hostnames, gatewayv1beta1.Hostname("nginx.gwapi."+ingressDomain))
log.Debugf("Creating GatewayClass...")
_, err = hrClientSet.GatewayV1beta1().GatewayClasses().Create(context.TODO(), gatewayClass, metav1.CreateOptions{})
if err != nil && !errors.IsAlreadyExists(err) {
10 changes: 2 additions & 8 deletions pkg/runner/types.go
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ package runner

import (
"fmt"
ex "os/exec"

"github.com/cloud-bulldozer/go-commons/indexers"
routev1 "github.com/openshift/api/route/v1"
@@ -56,10 +55,8 @@ var gatewayNamespace gatewayv1beta1.Namespace = "openshift-ingress"
var portNumber gatewayv1beta1.PortNumber = 8080
var tlsType gatewayv1beta1.TLSModeType = "Terminate"
var fromNamespaces gatewayv1beta1.FromNamespaces = "All"
var domainName = ex.Command("oc", "get", "ingresses.config/cluster", "-o", "jsonpath={.spec.domain}")
var output, err = domainName.CombinedOutput()
var hostName string = "nginx.gwapi." + string(output)
var listenerHostName = gatewayv1beta1.Hostname("*.gwapi." + string(output))
var listenerHostName gatewayv1beta1.Hostname
var ingressDomain string

var benchmarkNs = corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
@@ -411,9 +408,6 @@ var httproutes = gatewayv1beta1.HTTPRoute{
Name: service.Name,
},
Spec: gatewayv1beta1.HTTPRouteSpec{
Hostnames: []gatewayv1beta1.Hostname{
gatewayv1beta1.Hostname(hostName),
},
CommonRouteSpec: gatewayv1beta1.CommonRouteSpec{
ParentRefs: []gatewayv1beta1.ParentReference{
{