From 50670fc55707e31224f17ce01123d3573da59ff8 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Thu, 14 Nov 2024 02:51:24 -0700 Subject: [PATCH] update Signed-off-by: Tamal Saha --- go.mod | 2 +- go.sum | 4 ++-- pkg/apiserver/apiserver.go | 4 ++-- pkg/registry/meta/gatewayinfo/storage.go | 8 +++++--- .../apis/meta/v1alpha1/gateway_info_types.go | 5 +++-- .../apis/meta/v1alpha1/openapi_generated.go | 15 ++++++++++----- .../crds/meta.k8s.appscode.com_gatewayinfoes.yaml | 5 +++-- vendor/modules.txt | 2 +- 8 files changed, 27 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 98d0e2532..5a8b0613a 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,7 @@ require ( kmodules.xyz/go-containerregistry v0.0.12 kmodules.xyz/monitoring-agent-api v0.30.2 kmodules.xyz/offshoot-api v0.30.1 - kmodules.xyz/resource-metadata v0.22.3-0.20241114050515-5c4c07afd728 + kmodules.xyz/resource-metadata v0.22.3-0.20241114091625-6c277c3fe863 kmodules.xyz/resource-metrics v0.30.5 kmodules.xyz/resource-metrics/utils v0.30.4 kmodules.xyz/sets v0.29.0 diff --git a/go.sum b/go.sum index 8e651d011..14c9504e4 100644 --- a/go.sum +++ b/go.sum @@ -939,8 +939,8 @@ kmodules.xyz/monitoring-agent-api v0.30.2 h1:sAgz5P5EXZqhlj1NzJ+QltAgeIx5bGSMj+a kmodules.xyz/monitoring-agent-api v0.30.2/go.mod h1:BoZFPDDRB7J39CcUsSDlzgW8PQCwik4ILPleyUob+Mg= kmodules.xyz/offshoot-api v0.30.1 h1:TrulAYO+oBsXe9sZZGTmNWIuI8qD2izMpgcTSPvgAmI= kmodules.xyz/offshoot-api v0.30.1/go.mod h1:T3mpjR6fui0QzOcmQvIuANytW48fe9ytmy/1cgx6D4g= -kmodules.xyz/resource-metadata v0.22.3-0.20241114050515-5c4c07afd728 h1:kSYfTcj90SWg8HsemhkCO/FXkDnNZBgxEFdVFU4G1UM= -kmodules.xyz/resource-metadata v0.22.3-0.20241114050515-5c4c07afd728/go.mod h1:G57v46vQOq5P1HIs9Rl7lJ5Y4dBcjJG5OyxApTdSyNs= +kmodules.xyz/resource-metadata v0.22.3-0.20241114091625-6c277c3fe863 h1:dfsQYd8Uk8iQ/kcwddhL8GNXTN/i8e6UB3C4t0ArwyM= +kmodules.xyz/resource-metadata v0.22.3-0.20241114091625-6c277c3fe863/go.mod h1:G57v46vQOq5P1HIs9Rl7lJ5Y4dBcjJG5OyxApTdSyNs= kmodules.xyz/resource-metrics v0.30.5 h1:ZhpGeR9DCz1HTrKUg/mWhr95wlFzCPRdgVAqwaggy1o= kmodules.xyz/resource-metrics v0.30.5/go.mod h1:w9+rz7/s/kGP1GWzYSuRdCn+l7EwpesmESSEHkLBnIQ= kmodules.xyz/resource-metrics/utils v0.30.4 h1:bJS/x0Qr7N1FFdxugFbzZ/Es6HVs4ptsFlhkmgj3jac= diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index da04965da..24931c529 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -113,7 +113,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" + gwv1 "sigs.k8s.io/gateway-api/apis/v1" chartsapi "x-helm.dev/apimachinery/apis/charts/v1alpha1" ) @@ -141,7 +141,7 @@ func init() { utilruntime.Must(appcatalogapi.AddToScheme(Scheme)) utilruntime.Must(openvizapi.AddToScheme(Scheme)) utilruntime.Must(fluxsrc.AddToScheme(Scheme)) - utilruntime.Must(gwapiv1.Install(Scheme)) + utilruntime.Must(gwv1.Install(Scheme)) utilruntime.Must(monitoringv1.AddToScheme(Scheme)) utilruntime.Must(falco.AddToScheme(Scheme)) utilruntime.Must(clusterv1alpha1.Install(Scheme)) diff --git a/pkg/registry/meta/gatewayinfo/storage.go b/pkg/registry/meta/gatewayinfo/storage.go index 5a38bc711..41c552386 100644 --- a/pkg/registry/meta/gatewayinfo/storage.go +++ b/pkg/registry/meta/gatewayinfo/storage.go @@ -19,7 +19,6 @@ package gatewayinfo import ( "context" "fmt" - gwv1 "sigs.k8s.io/gateway-api/apis/v1" "strings" "go.bytebuilders.dev/catalog-manager/pkg/gateway" @@ -32,6 +31,7 @@ import ( "kmodules.xyz/client-go/meta" rsapi "kmodules.xyz/resource-metadata/apis/meta/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" + gwv1 "sigs.k8s.io/gateway-api/apis/v1" ) type Storage struct { @@ -79,7 +79,7 @@ func (r *Storage) Get(ctx context.Context, name string, options *metav1.GetOptio Kind: "GatewayClass", }) if err != nil { - return &rsapi.GatewayInfo{}, fmt.Errorf("kind GatewayClass from %v group is not present in this cluster", gwv1.GroupName) + return nil, fmt.Errorf("kind GatewayClass from %v group is not present in this cluster", gwv1.GroupName) } class, err := gateway.FindGatewayClass(context.TODO(), r.kc, name) @@ -98,9 +98,10 @@ func (r *Storage) Get(ctx context.Context, name string, options *metav1.GetOptio return nil, err } - var ip, hostName string + var svcType, ip, hostName string for _, s := range svcList.Items { if s.Labels[meta.ManagedByLabelKey] == "envoy-gateway" && s.Labels[OwningGatewayClassLabel] == class.Name { + svcType = string(s.Spec.Type) if s.Status.LoadBalancer.Ingress != nil { ip = s.Status.LoadBalancer.Ingress[0].IP hostName = s.Status.LoadBalancer.Ingress[0].Hostname @@ -114,6 +115,7 @@ func (r *Storage) Get(ctx context.Context, name string, options *metav1.GetOptio }, Spec: rsapi.GatewayInfoSpec{ GatewayClassName: class.Name, + ServiceType: svcType, HostName: hostName, IP: ip, }, diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/gateway_info_types.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/gateway_info_types.go index 1e98fb238..69ae70197 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/gateway_info_types.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/gateway_info_types.go @@ -36,6 +36,7 @@ type GatewayInfo struct { type GatewayInfoSpec struct { GatewayClassName string `json:"gatewayClassName"` - HostName string `json:"hostName"` - IP string `json:"ip"` + ServiceType string `json:"serviceType"` + HostName string `json:"hostName,omitempty"` + IP string `json:"ip,omitempty"` } diff --git a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go index c5efa71e9..e46825cd7 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/meta/v1alpha1/openapi_generated.go @@ -19461,22 +19461,27 @@ func schema_resource_metadata_apis_meta_v1alpha1_GatewayInfoSpec(ref common.Refe Format: "", }, }, - "hostName": { + "serviceType": { SchemaProps: spec.SchemaProps{ Default: "", Type: []string{"string"}, Format: "", }, }, + "hostName": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, "ip": { SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, }, - Required: []string{"gatewayClassName", "hostName", "ip"}, + Required: []string{"gatewayClassName", "serviceType"}, }, }, } diff --git a/vendor/kmodules.xyz/resource-metadata/crds/meta.k8s.appscode.com_gatewayinfoes.yaml b/vendor/kmodules.xyz/resource-metadata/crds/meta.k8s.appscode.com_gatewayinfoes.yaml index 04e908f94..1ae64afca 100644 --- a/vendor/kmodules.xyz/resource-metadata/crds/meta.k8s.appscode.com_gatewayinfoes.yaml +++ b/vendor/kmodules.xyz/resource-metadata/crds/meta.k8s.appscode.com_gatewayinfoes.yaml @@ -38,10 +38,11 @@ spec: type: string ip: type: string + serviceType: + type: string required: - gatewayClassName - - hostName - - ip + - serviceType type: object type: object served: true diff --git a/vendor/modules.txt b/vendor/modules.txt index 47d25d84c..97642b495 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2056,7 +2056,7 @@ kmodules.xyz/monitoring-agent-api/client kmodules.xyz/offshoot-api/api/v1 kmodules.xyz/offshoot-api/api/v2 kmodules.xyz/offshoot-api/util -# kmodules.xyz/resource-metadata v0.22.3-0.20241114050515-5c4c07afd728 +# kmodules.xyz/resource-metadata v0.22.3-0.20241114091625-6c277c3fe863 ## explicit; go 1.22.1 kmodules.xyz/resource-metadata/apis/core/install kmodules.xyz/resource-metadata/apis/core/v1alpha1