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
71 changes: 71 additions & 0 deletions .tools/nvim/__http__/console/import-mres.graphql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
label: List Imported Managed Resources
query: |+ #graphql
query Core_listImportedManagedResources($envName: String!, $search: SearchImportedManagedResources) {
core_listImportedManagedResources(envName: $envName, search: $search) {
edges {
node {
name
accountName
environmentName
displayName
createdBy {
userEmail
}
managedResource {
spec {
resourceTemplate {
kind
}
}
}
}
}
}
}
variables:
envName: "nxt-dev-1"
search: {}

---

label: Read Secret for Imported Managed Resource
query: |+ #graphql
query Core_getSecret($envName: String!, $name: String!) {
core_getSecret(envName: $envName, name: $name) {
metadata {
name
}
stringData
}
}
variables:
envName: "nxt-dev-1"
name: "copy-root-mongo"

---
label: Delete Imported Managed Resources
query: |+ #graphql
mutation Core_deleteImportedManagedResource($envName: String!, $importName: String!) {
core_deleteImportedManagedResource(envName: $envName, importName: $importName)
}
variables:
envName: "nxt-dev-1"
importName: "copy-root-pg"
---

label: Import Managed Resources
query: |+ #graphql
mutation Core_ImportManagedResource($envName: String!, $msvcName: String!, $mresName: String!, $importName: String!) {
core_importManagedResource(envName: $envName, msvcName: $msvcName, mresName: $mresName, importName: $importName) {
accountName
environmentName
}
}
variables:
envName: "nxt-dev-1"
# msvcName: "t-postgres"
msvcName: "sample"
mresName: "root-credentials"
importName: "copy-root-mongo"
---
2 changes: 1 addition & 1 deletion .tools/nvim/__http__/console/msvc.graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ global:
label: List Managed Service Templates
query: |+
query Core_listManagedServiceTemplates {
core_listManagedServiceTemplates {
infra_listManagedServiceTemplates {
category
displayName
items {
Expand Down
3 changes: 2 additions & 1 deletion apps/console/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ tasks:
--struct github.com/kloudlite/api/apps/console/internal/domain.ManagedResourceKeyValueRef
--struct github.com/kloudlite/api/apps/console/internal/entities.Router
--struct github.com/kloudlite/api/apps/console/internal/entities.ManagedResource
--struct github.com/kloudlite/api/apps/console/internal/entities.ImportedManagedResource
--struct github.com/kloudlite/api/apps/console/internal/entities.ImagePullSecret
--struct github.com/kloudlite/api/pkg/repos.MatchFilter
--struct github.com/kloudlite/api/pkg/repos.CursorPagination
> ./internal/app/_struct-to-graphql/main.go
- |+
pushd ./internal/app/_struct-to-graphql
go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Environment,App,ExternalApp,Secret,Config,Router,ManagedResource,ImagePullSecret,ConsoleVPNDevice
go run main.go --dev --out-dir ../graph/struct-to-graphql --with-pagination Environment,App,ExternalApp,Secret,Config,Router,ManagedResource,ImportedManagedResource,ImagePullSecret,ConsoleVPNDevice
popd
- rm -rf ./internal/app/_struct-to-graphql

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ type ResourceEventPublisherImpl struct {
logger logging.Logger
}

func (r *ResourceEventPublisherImpl) PublishClusterManagedServiceEvent(ctx domain.ConsoleContext, msvcName string, resourceType entities.ResourceType, name string, update domain.PublishMsg) {
subject := fmt.Sprintf("res-updates.account.%s.cluster_managed_service.%s.%s.%s", ctx.AccountName, msvcName, resourceType, name)
r.publish(subject, update)
}

func (r *ResourceEventPublisherImpl) PublishEnvironmentResourceEvent(ctx domain.ConsoleContext, envName string, resourceType entities.ResourceType, name string, update domain.PublishMsg) {
subject := fmt.Sprintf("res-updates.account.%s.environment.%s.%s.%s", ctx.AccountName, envName, resourceType, name)
r.publish(subject, update)
Expand Down
4 changes: 2 additions & 2 deletions apps/console/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
"context"

"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/console"
"github.com/kloudlite/api/pkg/k8s"

Expand Down Expand Up @@ -53,14 +54,13 @@ func toConsoleContext(requestCtx context.Context, accountCookieName string) (dom
}

var Module = fx.Module("app",
// repos.NewFxMongoRepo[*entities.Project]("projects", "prj", entities.ProjectIndexes),
// repos.NewFxMongoRepo[*entities.ProjectManagedService]("project_managed_service", "pmsvc", entities.ProjectManagedServiceIndices),
repos.NewFxMongoRepo[*entities.Environment]("environments", "env", entities.EnvironmentIndexes),
repos.NewFxMongoRepo[*entities.App]("apps", "app", entities.AppIndexes),
repos.NewFxMongoRepo[*entities.ExternalApp]("ext_apps", "extapp", entities.ExternalAppIndexes),
repos.NewFxMongoRepo[*entities.Config]("configs", "cfg", entities.ConfigIndexes),
repos.NewFxMongoRepo[*entities.Secret]("secrets", "scrt", entities.SecretIndexes),
repos.NewFxMongoRepo[*entities.ManagedResource]("managed_resources", "mres", entities.MresIndexes),
repos.NewFxMongoRepo[*entities.ImportedManagedResource]("imported_managed_resources", "impmres", entities.ImportedManagedResourceIndexes),
repos.NewFxMongoRepo[*entities.Router]("routers", "rt", entities.RouterIndexes),
repos.NewFxMongoRepo[*entities.ImagePullSecret]("image_pull_secrets", "ips", entities.ImagePullSecretIndexes),
repos.NewFxMongoRepo[*entities.ResourceMapping]("resource_mappings", "rmap", entities.ResourceMappingIndices),
Expand Down
6 changes: 6 additions & 0 deletions apps/console/internal/app/gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ models:
model: github.com/kloudlite/api/apps/console/internal/entities.ManagedResource
ManagedResourceIn: *managed-resource-model

ImportedManagedResource: &managed-resource-model
model: github.com/kloudlite/api/apps/console/internal/entities.ImportedManagedResource
fields:
managedResource:
resolver: true

ManagedResourceKeyRefIn:
model: github.com/kloudlite/api/apps/console/internal/domain.ManagedResourceKeyRef

Expand Down
16 changes: 16 additions & 0 deletions apps/console/internal/app/graph/common-types.resolvers.go

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

Loading