Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.
Merged
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
9 changes: 6 additions & 3 deletions apps/infra/internal/app/graph/globalvpn.resolvers.go

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

7 changes: 6 additions & 1 deletion apps/infra/internal/domain/byok-clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ func (d *domain) CreateBYOKCluster(ctx InfraContext, cluster entities.BYOKCluste

cluster.MessageQueueTopicName = common.SendToAgentSubjectPrefix(ctx.AccountName, cluster.Name)

gvpnConn, err := d.ensureGlobalVPNConnection(ctx, cluster.Name, cluster.GlobalVPN, nil)
gvpnConn, err := d.ensureGlobalVPNConnection(ctx, ensureGlobalVPNConnectionArgs{
ClusterName: cluster.Name,
GlobalVPNName: cluster.GlobalVPN,
DispatchAddr: nil,
Visibility: cluster.Visibility,
})
if err != nil {
return nil, errors.NewE(err)
}
Expand Down
7 changes: 6 additions & 1 deletion apps/infra/internal/domain/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,12 @@ func (d *domain) CreateCluster(ctx InfraContext, cluster entities.Cluster) (*ent
cluster.SyncStatus = t.GenSyncStatus(t.SyncActionApply, 0)

// FIXME: removing public DNS host for now
gvpnConn, err := d.ensureGlobalVPNConnection(ctx, cluster.Name, *cluster.GlobalVPN, nil)
gvpnConn, err := d.ensureGlobalVPNConnection(ctx, ensureGlobalVPNConnectionArgs{
ClusterName: cluster.Name,
GlobalVPNName: *cluster.GlobalVPN,
DispatchAddr: nil,
Visibility: entities.ClusterVisbility{},
})
if err != nil {
return nil, errors.NewE(err)
}
Expand Down
33 changes: 23 additions & 10 deletions apps/infra/internal/domain/global-vpn-cluster-connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,27 @@ func (d *domain) deleteGlobalVPNConnection(ctx InfraContext, clusterName string,
}

func (d *domain) EnsureGlobalVPNConnection(ctx InfraContext, clusterName string, groupName string, dispatchAddr *entities.DispatchAddr) (*entities.GlobalVPNConnection, error) {
return d.ensureGlobalVPNConnection(ctx, clusterName, groupName, dispatchAddr)
// return d.ensureGlobalVPNConnection(ctx, clusterName, groupName, dispatchAddr)
return d.ensureGlobalVPNConnection(ctx, ensureGlobalVPNConnectionArgs{
ClusterName: clusterName,
GlobalVPNName: groupName,
DispatchAddr: dispatchAddr,
Visibility: entities.ClusterVisbility{},
})
}

type ensureGlobalVPNConnectionArgs struct {
ClusterName string
GlobalVPNName string
DispatchAddr *entities.DispatchAddr
Visibility entities.ClusterVisbility
}

func (d *domain) ensureGlobalVPNConnection(ctx InfraContext, clusterName string, groupName string, dispatchAddr *entities.DispatchAddr) (*entities.GlobalVPNConnection, error) {
func (d *domain) ensureGlobalVPNConnection(ctx InfraContext, args ensureGlobalVPNConnectionArgs) (*entities.GlobalVPNConnection, error) {
gvpnConn, err := d.gvpnConnRepo.FindOne(ctx, repos.Filter{
fields.AccountName: ctx.AccountName,
fields.ClusterName: clusterName,
fields.MetadataName: groupName,
fields.ClusterName: args.ClusterName,
fields.MetadataName: args.GlobalVPNName,
})
if err != nil {
return nil, errors.NewE(err)
Expand All @@ -414,19 +427,19 @@ func (d *domain) ensureGlobalVPNConnection(ctx InfraContext, clusterName string,
}

gvpnGateway := networkingv1.Gateway{ObjectMeta: metav1.ObjectMeta{
Name: groupName,
// Name: fmt.Sprintf("%s-%s", ctx.AccountName, groupName),
Name: args.GlobalVPNName,
// Name: fmt.Sprintf("%s-%s", ctx.AccountName, groupName),
}}
gvpnGateway.EnsureGVK()

return d.createGlobalVPNConnection(ctx, entities.GlobalVPNConnection{
Gateway: gvpnGateway,
GlobalVPNName: groupName,
ResourceMetadata: common.ResourceMetadata{DisplayName: groupName, CreatedBy: common.CreatedOrUpdatedByKloudlite, LastUpdatedBy: common.CreatedOrUpdatedByKloudlite},
GlobalVPNName: args.GlobalVPNName,
ResourceMetadata: common.ResourceMetadata{DisplayName: args.GlobalVPNName, CreatedBy: common.CreatedOrUpdatedByKloudlite, LastUpdatedBy: common.CreatedOrUpdatedByKloudlite},
AccountName: ctx.AccountName,
ClusterName: clusterName,
DispatchAddr: dispatchAddr,
ClusterName: args.ClusterName,
DispatchAddr: args.DispatchAddr,
Visibility: args.Visibility,
ParsedWgParams: nil,
})
}
Expand Down