Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/app deployment #204

Merged
merged 6 commits into from
Aug 27, 2023
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
36 changes: 36 additions & 0 deletions capten/agent/pkg/agent/agent_app_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,48 @@ func (a *Agent) InstallApp(ctx context.Context, request *agentpb.InstallAppReque

run, err := worker.SendEvent(ctx, "install", config)
if err != nil {
a.log.Errorf("failed to send store app install event, %v", err)
return &agentpb.InstallAppResponse{
Status: agentpb.StatusCode_INTERNRAL_ERROR,
StatusMessage: "Internall error in create install app job",
}, err
}

syncConfig := &agentpb.SyncAppData{
Config: &agentpb.AppConfig{
ReleaseName: request.AppConfig.ReleaseName,
AppName: request.AppConfig.AppName,
Version: request.AppConfig.Version,
Category: request.AppConfig.Category,
Description: request.AppConfig.Description,
ChartName: request.AppConfig.ChartName,
RepoName: request.AppConfig.RepoName,
RepoURL: request.AppConfig.RepoURL,
Namespace: request.AppConfig.Namespace,
CreateNamespace: request.AppConfig.CreateNamespace,
PrivilegedNamespace: request.AppConfig.PrivilegedNamespace,
Icon: request.AppConfig.Icon,
LaunchURL: request.AppConfig.LaunchURL,
LaunchUIDescription: request.AppConfig.LaunchUIDescription,
InstallStatus: "Installed",
DefualtApp: request.AppConfig.DefualtApp,
},
Values: &agentpb.AppValues{
OverrideValues: request.OverrideValues,
LaunchUIValues: request.LaunchUIValues,
},
}

if err := a.as.UpsertAppConfig(syncConfig); err != nil {
a.log.Errorf("failed to update sync app config, %v", err)
return &agentpb.InstallAppResponse{
Status: agentpb.StatusCode_INTERNRAL_ERROR,
StatusMessage: "failed to sync app config",
}, err
}

a.log.Infof("Sync app [%s] successful", request.AppConfig.ReleaseName)

return &agentpb.InstallAppResponse{
Status: agentpb.StatusCode_OK,
StatusMessage: "success",
Expand Down
383 changes: 197 additions & 186 deletions capten/agent/pkg/agentpb/agent.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion capten/agent/pkg/workers/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"time"

"github.com/google/uuid"
"github.com/intelops/go-common/logging"
"github.com/kube-tarian/kad/capten/agent/pkg/agentpb"
"github.com/kube-tarian/kad/capten/agent/pkg/model"
"github.com/kube-tarian/kad/capten/agent/pkg/temporalclient"
"github.com/intelops/go-common/logging"
"github.com/kube-tarian/kad/capten/deployment-worker/pkg/workflows"
"go.temporal.io/sdk/client"
)
Expand Down
13 changes: 7 additions & 6 deletions capten/common-pkg/plugins/helm/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ func (h *HelmCLient) Create(req *model.CreteRequestPayload) (json.RawMessage, er
}

chartSpec := helmclient.ChartSpec{
ReleaseName: req.ReleaseName,
ChartName: req.ChartName,
Namespace: req.Namespace,
Version: req.Version,
Wait: true,
Timeout: time.Duration(req.Timeout) * time.Minute,
ReleaseName: req.ReleaseName,
ChartName: req.ChartName,
Namespace: req.Namespace,
Version: req.Version,
Wait: true,
Timeout: time.Duration(req.Timeout) * time.Minute,
CreateNamespace: true,
} // Use an unpacked chart directory.

if req.ValuesYaml != "" {
Expand Down
2 changes: 2 additions & 0 deletions capten/model/climon_deploy_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type CreteRequestPayload struct {

ClusterName string `json:"cluster_name" required:"false"`
ValuesYaml string `json:"values_yaml" required:"false"`

// CreateNamespace bool `json:"createNamespace"`
}

type DeleteRequestPayload struct {
Expand Down
1 change: 1 addition & 0 deletions proto/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ message GetClusterAppValuesResponse {
message InstallAppRequest {
AppConfig appConfig =1;
bytes overrideValues = 2;
bytes launchUIValues = 3;
}

message InstallAppResponse {
Expand Down
1 change: 1 addition & 0 deletions proto/server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ message GetStoreAppValuesResponse {
message DeployStoreAppRequest {
StoreAppConfig appConfig = 1;
bytes overrideValues = 2;
bytes launchUIValues = 3;
}

message DeployStoreAppResponse{
Expand Down
6 changes: 3 additions & 3 deletions server/data/store-apps/app_list.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
enabledApps:
- falco
- loki
- argo-cd
- crossplane
- tekton

disabledApps:
- signoz
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Name: "falco"
ChartName: "tools/falco"
Category: "Security"
Name: "argo-cd"
ChartName: "tools/argo-cd"
Category: "CI/CD"
Description: ""
RepoName: "tools"
RepoURL: "https://kube-tarian.github.io/helmrepo-supporting-tools"
Namespace: "falco"
ReleaseName: "falco"
Version: "0.0.1"
Namespace: "argo-cd"
ReleaseName: "argo-cd"
Version: "1.0.0"
CreateNamespace: true
OverrideValues:
driver:
Expand Down
11 changes: 11 additions & 0 deletions server/data/store-apps/conf/crossplane.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Name: "crossplane"
ChartName: "tools/crossplane"
Category: "iaas"
Description: ""
RepoName: "tools"
RepoURL: "https://kube-tarian.github.io/helmrepo-supporting-tools"
Namespace: "crossplane"
ReleaseName: "crossplane"
Version: "1.0.0"
CreateNamespace: true
OverrideValues:
35 changes: 0 additions & 35 deletions server/data/store-apps/conf/loki.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions server/data/store-apps/conf/signoz.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions server/data/store-apps/conf/tekton.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Name: "tekton"
ChartName: "tools/tekton"
Category: "CI/CD"
Description: ""
RepoName: "tools"
RepoURL: "https://kube-tarian.github.io/helmrepo-supporting-tools"
Namespace: "tekton"
ReleaseName: "tekton"
Version: "1.0.0"
CreateNamespace: true
OverrideValues:
11 changes: 11 additions & 0 deletions server/data/store-apps/conf/testkube.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Name: "testkube"
ChartName: "tools/testkube"
Category: "Testing framework"
Description: ""
RepoName: "tools"
RepoURL: "https://kube-tarian.github.io/helmrepo-supporting-tools"
Namespace: "testkube"
ReleaseName: "testkube"
Version: "1.0.0"
CreateNamespace: true
OverrideValues:
2 changes: 2 additions & 0 deletions server/pkg/api/store_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,10 @@ func (s *Server) DeployStoreApp(ctx context.Context, request *serverpb.DeploySto
Icon: []byte(request.AppConfig.Icon),
LaunchURL: request.AppConfig.LaunchURL,
LaunchUIDescription: request.AppConfig.LaunchUIDescription,
DefualtApp: request.AppConfig.DefualtApp,
},
OverrideValues: request.OverrideValues,
LaunchUIValues: request.LaunchUIValues,
}

_, err = agent.GetClient().InstallApp(ctx, req)
Expand Down
Loading
Loading