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
Show all changes
17 commits
Select commit Hold shift + click to select a range
0ea3863
feat: [WIP] environments on kloudlite edge clusters
nxtcoder17 Sep 4, 2024
144ab05
feat(grpc): adds support for custom grpc errors parsing
nxtcoder17 Sep 5, 2024
1e0a79f
fix(mongo): fixes mongodb groupByAndCount result parsing
nxtcoder17 Sep 5, 2024
51b111d
feat(message-office): adds platform edge clusters support
nxtcoder17 Sep 5, 2024
0f0ae41
feat(console): adds kloudlite edge clusters support for environments
nxtcoder17 Sep 5, 2024
fffd46b
chore: `log/slog` logging for grpc and http servers
nxtcoder17 Sep 13, 2024
4b21e99
chore(apps/webhook): startup message updates
nxtcoder17 Sep 13, 2024
c1534e4
feat(message-office): platform edge clusters support, and grpc protob…
nxtcoder17 Sep 13, 2024
524cac8
feat(console): supoprts environment creation on kloudlite clusters
nxtcoder17 Sep 13, 2024
f3628f0
feat(infra): adds support for gateway creation on kloudlite edge clus…
nxtcoder17 Sep 13, 2024
76452a1
feat(tenant-agent): improves logging
nxtcoder17 Sep 13, 2024
1a3c6fc
feat(accounts): removes container registry api requirements
nxtcoder17 Sep 17, 2024
fd9b0ae
feat(infra): updates gateway syncing, and supports edge on platform
nxtcoder17 Sep 17, 2024
45924f7
feat(auth): supports enabling/disabling auth email verification
nxtcoder17 Sep 17, 2024
df918ed
refactor(console): removes unused env vars
nxtcoder17 Sep 17, 2024
6802a6b
chore: message-office, tenant-agent and observability improvements
nxtcoder17 Sep 17, 2024
d5c1324
chore: updates github.com/kloudlite/operator
nxtcoder17 Sep 17, 2024
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
5 changes: 3 additions & 2 deletions .tools/nvim/__http__/accounts/accounts.graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ query: |
accounts_createAccount(account: $account) {
id
isActive
kloudliteGatewayRegion
}
}
variables:
account:
contactEmail: "{{.email}}"
displayName: "Example Account Name"
displayName: "test account - nxt"
metadata:
name: "{{.accountName}}"
kloudliteGatewayRegion: "k3d/mt1"

---

Expand Down
17 changes: 13 additions & 4 deletions .tools/nvim/__http__/console/apps.graphql.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
global:
name: sample-app
envName: "test-env5"
---

label: List Apps
Expand Down Expand Up @@ -84,7 +85,7 @@ variables:
app:
displayName: "sample app"
metadata:
name: "{{.name}}"
name: "{{.name}}1"
spec:
services:
- port: 80
Expand Down Expand Up @@ -117,9 +118,7 @@ variables:
name: '{{.name}}'
spec:
services:
- type: tcp
port: 80
targetPort: 80
- port: 80
containers:
- name: main
image: kong/httpbin
Expand All @@ -146,3 +145,13 @@ variables:
envName: "{{.envName}}"
appName: "{{.name}}"
---

label: Resync App
query: |+
query Query($envName: String!, $name: String!) {
core_resyncApp(envName: $envName, name: $name)
}
variables:
envName: "{{.envName}}"
name: "{{.name}}"
---
23 changes: 11 additions & 12 deletions .tools/nvim/__http__/console/environments.graphql.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
global:
envTargetNamespace: "nxtcoder17"
envName: "test-env"
global: {}
---

label: List Environments
Expand Down Expand Up @@ -41,6 +39,10 @@ query: |+ #graphql
action
}
recordVersion
onlineStatus {
lastOnlineAt
willBeOfflineAt
}
}
}
pageInfo {
Expand All @@ -62,7 +64,7 @@ query: |+ #graphql
apiVersion
kind
spec {
targetNamespace
targetNamespace
}
syncStatus {
state
Expand All @@ -76,11 +78,9 @@ query: |+ #graphql
variables:
env:
displayName: Display Name of a sample environment
clusterName: "{{.gcpClusterName}}"
clusterName: "__kloudlite_enabled_cluster"
metadata:
name: "{{.envName}}"
# spec:
# projectName: "{{.projectName}}"
name: "{{.envName}}8"
---

label: resync environment
Expand Down Expand Up @@ -121,12 +121,11 @@ variables:

label: "delete environment"
query: |+
mutation Core_deleteEnvironment($projectName: String!, $envName: String!) {
core_deleteEnvironment(projectName: $projectName, envName: $envName)
mutation Core_deleteEnvironment($envName: String!) {
core_deleteEnvironment(envName: $envName)
}
variables:
projectName: "{{.projectName}}"
envName: "{{.clonedEnvName}}"
envName: "{{.envName}}4"
---

---
Expand Down
9 changes: 6 additions & 3 deletions apps/accounts/internal/app/graph/schema.resolvers.go

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

67 changes: 33 additions & 34 deletions apps/accounts/internal/domain/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
iamT "github.com/kloudlite/api/apps/iam/types"
"github.com/kloudlite/api/common"
"github.com/kloudlite/api/constants"
"github.com/kloudlite/api/grpc-interfaces/container_registry"
"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/iam"
fn "github.com/kloudlite/api/pkg/functions"
"github.com/kloudlite/api/pkg/repos"
Expand Down Expand Up @@ -108,33 +107,33 @@ func (d *domain) ensureKloudliteRegistryCredentials(ctx UserContext, account *en
return nil
}

out, err := d.containerRegistryClient.CreateReadOnlyCredential(ctx, &container_registry.CreateReadOnlyCredentialIn{
AccountName: account.Name,
UserId: string(ctx.UserId),
CredentialName: credentialsName,
RegistryUsername: fmt.Sprintf("account_%s", account.Name),
})
if err != nil {
return err
}

if err := d.k8sClient.Create(ctx, &corev1.Secret{
TypeMeta: metav1.TypeMeta{
Kind: "Secret",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: credentialsName,
Namespace: account.TargetNamespace,
},
Immutable: new(bool),
Data: map[string][]byte{
corev1.DockerConfigJsonKey: []byte(out.DockerConfigJson),
},
Type: corev1.SecretTypeDockerConfigJson,
}); err != nil {
return err
}
// out, err := d.containerRegistryClient.CreateReadOnlyCredential(ctx, &container_registry.CreateReadOnlyCredentialIn{
// AccountName: account.Name,
// UserId: string(ctx.UserId),
// CredentialName: credentialsName,
// RegistryUsername: fmt.Sprintf("account_%s", account.Name),
// })
// if err != nil {
// return err
// }

// if err := d.k8sClient.Create(ctx, &corev1.Secret{
// TypeMeta: metav1.TypeMeta{
// Kind: "Secret",
// APIVersion: "v1",
// },
// ObjectMeta: metav1.ObjectMeta{
// Name: credentialsName,
// Namespace: account.TargetNamespace,
// },
// Immutable: new(bool),
// Data: map[string][]byte{
// corev1.DockerConfigJsonKey: []byte(out.DockerConfigJson),
// },
// Type: corev1.SecretTypeDockerConfigJson,
// }); err != nil {
// return err
// }

return nil
}
Expand Down Expand Up @@ -167,13 +166,13 @@ func (d *domain) CreateAccount(ctx UserContext, account entities.Account) (*enti
return nil, errors.NewE(err)
}

if err := d.ensureNamespaceForAccount(ctx, account.Name, account.TargetNamespace); err != nil {
return nil, errors.NewE(err)
}
// if err := d.ensureNamespaceForAccount(ctx, account.Name, account.TargetNamespace); err != nil {
// return nil, errors.NewE(err)
// }

if err := d.ensureKloudliteRegistryCredentials(ctx, &account); err != nil {
return nil, errors.NewE(err)
}
// if err := d.ensureKloudliteRegistryCredentials(ctx, &account); err != nil {
// return nil, errors.NewE(err)
// }

return acc, nil
}
Expand Down
23 changes: 11 additions & 12 deletions apps/accounts/internal/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/kloudlite/api/apps/accounts/internal/entities"
"github.com/kloudlite/api/apps/accounts/internal/env"
iamT "github.com/kloudlite/api/apps/iam/types"
"github.com/kloudlite/api/grpc-interfaces/container_registry"
"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/auth"
"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/comms"
"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/console"
Expand Down Expand Up @@ -73,11 +72,11 @@ type Domain interface {
}

type domain struct {
authClient auth.AuthClient
iamClient iam.IAMClient
consoleClient console.ConsoleClient
containerRegistryClient container_registry.ContainerRegistryClient
commsClient comms.CommsClient
authClient auth.AuthClient
iamClient iam.IAMClient
consoleClient console.ConsoleClient
// containerRegistryClient container_registry.ContainerRegistryClient
commsClient comms.CommsClient

accountRepo repos.DbRepo[*entities.Account]
invitationRepo repos.DbRepo[*entities.Invitation]
Expand All @@ -93,7 +92,7 @@ type domain struct {
func NewDomain(
iamCli iam.IAMClient,
consoleClient console.ConsoleClient,
containerRegistryClient container_registry.ContainerRegistryClient,
// containerRegistryClient container_registry.ContainerRegistryClient,
authClient auth.AuthClient,
commsClient comms.CommsClient,

Expand All @@ -108,11 +107,11 @@ func NewDomain(
logger logging.Logger,
) Domain {
return &domain{
authClient: authClient,
iamClient: iamCli,
consoleClient: consoleClient,
commsClient: commsClient,
containerRegistryClient: containerRegistryClient,
authClient: authClient,
iamClient: iamCli,
consoleClient: consoleClient,
commsClient: commsClient,
// containerRegistryClient: containerRegistryClient,

k8sClient: k8sClient,

Expand Down
10 changes: 5 additions & 5 deletions apps/accounts/internal/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ type Env struct {

CookieDomain string `env:"COOKIE_DOMAIN" required:"true"`

IamGrpcAddr string `env:"IAM_GRPC_ADDR" required:"true"`
CommsGrpcAddr string `env:"COMMS_GRPC_ADDR" required:"true"`
ContainerRegistryGrpcAddr string `env:"CONTAINER_REGISTRY_GRPC_ADDR" required:"true"`
ConsoleGrpcAddr string `env:"CONSOLE_GRPC_ADDR" required:"true"`
AuthGrpcAddr string `env:"AUTH_GRPC_ADDR" required:"true"`
IamGrpcAddr string `env:"IAM_GRPC_ADDR" required:"true"`
CommsGrpcAddr string `env:"COMMS_GRPC_ADDR" required:"true"`
// ContainerRegistryGrpcAddr string `env:"CONTAINER_REGISTRY_GRPC_ADDR" required:"true"`
ConsoleGrpcAddr string `env:"CONSOLE_GRPC_ADDR" required:"true"`
AuthGrpcAddr string `env:"AUTH_GRPC_ADDR" required:"true"`

SessionKVBucket string `env:"SESSION_KV_BUCKET" required:"true"`
NatsURL string `env:"NATS_URL" required:"true"`
Expand Down
15 changes: 8 additions & 7 deletions apps/accounts/internal/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@ var Module = fx.Module("framework",
return grpc.NewGrpcClient(ev.CommsGrpcAddr)
}),

fx.Provide(func(ev *env.Env) (app.ContainerRegistryClient, error) {
return grpc.NewGrpcClient(ev.ContainerRegistryGrpcAddr)
}),
// fx.Provide(func(ev *env.Env) (app.ContainerRegistryClient, error) {
// return grpc.NewGrpcClient(ev.ContainerRegistryGrpcAddr)
// }),

fx.Provide(func(ev *env.Env) (app.ConsoleClient, error) {
return grpc.NewGrpcClient(ev.ConsoleGrpcAddr)
}),

app.Module,

fx.Invoke(func(c1 app.AuthClient, c2 app.IAMClient, c3 app.CommsClient, c4 app.ContainerRegistryClient, c5 app.ConsoleClient, lf fx.Lifecycle) {
// fx.Invoke(func(c1 app.AuthClient, c2 app.IAMClient, c3 app.CommsClient, c4 app.ContainerRegistryClient, c5 app.ConsoleClient, lf fx.Lifecycle) {
fx.Invoke(func(c1 app.AuthClient, c2 app.IAMClient, c3 app.CommsClient, c5 app.ConsoleClient, lf fx.Lifecycle) {
lf.Append(fx.Hook{
OnStop: func(context.Context) error {
if err := c1.Close(); err != nil {
Expand All @@ -90,9 +91,9 @@ var Module = fx.Module("framework",
if err := c3.Close(); err != nil {
return errors.NewE(err)
}
if err := c4.Close(); err != nil {
return errors.NewE(err)
}
// if err := c4.Close(); err != nil {
// return errors.NewE(err)
// }
if err := c5.Close(); err != nil {
return errors.NewE(err)
}
Expand Down
1 change: 1 addition & 0 deletions apps/auth/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/99designs/gqlgen/graphql"
"github.com/gofiber/fiber/v2"
"github.com/kloudlite/api/apps/auth/internal/app/graph"
Expand Down
7 changes: 5 additions & 2 deletions apps/auth/internal/app/graph/schema.resolvers.go

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

3 changes: 2 additions & 1 deletion apps/auth/internal/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package domain

import (
"context"

"github.com/kloudlite/api/apps/auth/internal/entities"
"github.com/kloudlite/api/common"
"github.com/kloudlite/api/pkg/repos"
Expand Down Expand Up @@ -38,7 +39,7 @@ type Domain interface {

CreateInviteCode(ctx context.Context, name string, inviteCode string) (*entities.InviteCode, error)
DeleteInviteCode(ctx context.Context, invCodeId string) error
//UpdateInviteCode(ctx context.Context, invCode entities.InviteCode) (*entities.InviteCode, error)
// UpdateInviteCode(ctx context.Context, invCode entities.InviteCode) (*entities.InviteCode, error)

VerifyInviteCode(ctx context.Context, userId repos.ID, invitationCode string) (bool, error)
}
Expand Down
Loading