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
2 changes: 1 addition & 1 deletion .tools/nvim/__http__/auth/auth.graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ query: |
auth_resetPassword(token: $token, password: $password)
}
variables:
token: "reset-**************"
token: "{{.reset_token}}"
password: "{{.password}}"

---
Expand Down
21 changes: 20 additions & 1 deletion .tools/nvim/__http__/console/environments.graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,24 @@ query: |+
}
variables:
projectName: "{{.projectName}}"
envName: "{{.envName}}"
envName: "{{.clonedEnvName}}"
---

---
label: Clone Environment
query: |+ #graphql
mutation Core_cloneEnvironment($projectName: String!, $sourceEnvName: String!, $destinationEnvName: String!, $displayName: String!, $environmentRoutingMode: Github__com___kloudlite___operator___apis___crds___v1__EnvironmentRoutingMode!) {
core_cloneEnvironment(projectName: $projectName, sourceEnvName: $sourceEnvName, destinationEnvName: $destinationEnvName, displayName: $displayName, environmentRoutingMode: $environmentRoutingMode) {
metadata {
name
}
}
}

variables:
projectName: "{{.projectName}}"
sourceEnvName: "{{.envName}}"
destinationEnvName: "{{.clonedEnvName}}"
displayName: "clone of {{.envName}}"
environmentRoutingMode: "private"
---
6 changes: 3 additions & 3 deletions apps/console/internal/app/graph/schema.resolvers.go

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

6 changes: 3 additions & 3 deletions apps/console/internal/domain/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ type Domain interface {
UpdateVPNDevice(ctx ConsoleContext, device entities.ConsoleVPNDevice) (*entities.ConsoleVPNDevice, error)
DeleteVPNDevice(ctx ConsoleContext, name string) error
UpdateVpnDevicePorts(ctx ConsoleContext, devName string, ports []*wgv1.Port) error
UpdateVpnDeviceEnvironment(ctx ConsoleContext, devName string, projectName string, envName string) error
ActivateVpnDeviceOnEnvironment(ctx ConsoleContext, devName string, projectName string, envName string) error

OnVPNDeviceApplyError(ctx ConsoleContext, errMsg string, name string, opts UpdateAndDeleteOpts) error
OnVPNDeviceDeleteMessage(ctx ConsoleContext, device entities.ConsoleVPNDevice) error
OnVPNDeviceUpdateMessage(ctx ConsoleContext, device entities.ConsoleVPNDevice, status types.ResourceStatus, opts UpdateAndDeleteOpts, clusterName string) error

UpdateVpnDeviceCluster(ctx ConsoleContext, devName string, clusterName string) error
UpdateVpnDeviceNs(ctx ConsoleContext, devName string, namespace string) error
ActivateVpnDeviceOnCluster(ctx ConsoleContext, devName string, clusterName string) error
ActivateVPNDeviceOnNamespace(ctx ConsoleContext, devName string, namespace string) error
}

type PublishMsg string
Expand Down
9 changes: 6 additions & 3 deletions apps/console/internal/domain/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ func (d *domain) CreateApp(ctx ResourceContext, app entities.App) (*entities.App
app.EnvironmentName = ctx.EnvironmentName
app.SyncStatus = t.GenSyncStatus(t.SyncActionApply, app.RecordVersion)

if _, err := d.upsertEnvironmentResourceMapping(ctx, &app); err != nil {
return d.createAndApplyApp(ctx, &app)
}

func (d *domain) createAndApplyApp(ctx ResourceContext, app *entities.App) (*entities.App, error) {
if _, err := d.upsertEnvironmentResourceMapping(ctx, app); err != nil {
return nil, errors.NewE(err)
}

napp, err := d.appRepo.Create(ctx, &app)
napp, err := d.appRepo.Create(ctx, app)
if err != nil {
if d.appRepo.ErrAlreadyExists(err) {
// TODO: better insights into error, when it is being caused by duplicated indexes
Expand All @@ -96,7 +100,6 @@ func (d *domain) CreateApp(ctx ResourceContext, app entities.App) (*entities.App
if err := d.applyApp(ctx, napp); err != nil {
return nil, errors.NewE(err)
}

return napp, nil
}

Expand Down
14 changes: 9 additions & 5 deletions apps/console/internal/domain/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package domain

import (
"maps"

"github.com/kloudlite/api/apps/console/internal/entities"
fc "github.com/kloudlite/api/apps/console/internal/entities/field-constants"
"github.com/kloudlite/api/common"
Expand All @@ -10,7 +12,6 @@ import (
"github.com/kloudlite/api/pkg/repos"
t "github.com/kloudlite/api/pkg/types"
"github.com/kloudlite/operator/operators/resource-watcher/types"
"maps"
)

func (d *domain) ListConfigs(ctx ResourceContext, search map[string]repos.MatchFilter, pq repos.CursorPagination) (*repos.PaginatedRecord[*entities.Config], error) {
Expand Down Expand Up @@ -106,13 +107,17 @@ func (d *domain) CreateConfig(ctx ResourceContext, config entities.Config) (*ent
maps.Copy(config.Annotations, types.ConfigWatchingAnnotation)
}

config.SyncStatus = t.GenSyncStatus(t.SyncActionApply, config.RecordVersion)
return d.createAndApplyConfig(ctx, &config)
}

func (d *domain) createAndApplyConfig(ctx ResourceContext, config *entities.Config) (*entities.Config, error) {
config.SyncStatus = t.GenSyncStatus(t.SyncActionApply, 0)

if _, err := d.upsertEnvironmentResourceMapping(ctx, &config); err != nil {
if _, err := d.upsertEnvironmentResourceMapping(ctx, config); err != nil {
return nil, errors.NewE(err)
}

cfg, err := d.configRepo.Create(ctx, &config)
cfg, err := d.configRepo.Create(ctx, config)
if err != nil {
if d.configRepo.ErrAlreadyExists(err) {
// TODO: better insights into error, when it is being caused by duplicated indexes
Expand Down Expand Up @@ -171,7 +176,6 @@ func (d *domain) DeleteConfig(ctx ResourceContext, name string) error {
ctx.DBFilters().Add(fields.MetadataName, name),
common.PatchForMarkDeletion(),
)

if err != nil {
return errors.NewE(err)
}
Expand Down
Loading