Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Nov 14, 2024
1 parent 33b9d5c commit 50670fc
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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))
Expand Down
8 changes: 5 additions & 3 deletions pkg/registry/meta/gatewayinfo/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ spec:
type: string
ip:
type: string
serviceType:
type: string
required:
- gatewayClassName
- hostName
- ip
- serviceType
type: object
type: object
served: true
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 50670fc

Please sign in to comment.