Skip to content

Commit

Permalink
Merge pull request #443 from kube-tarian/fix-store-type-config
Browse files Browse the repository at this point in the history
fix store type in store config response
  • Loading branch information
vramk23 authored Mar 25, 2024
2 parents aa02eec + 7590437 commit 123a5dd
Show file tree
Hide file tree
Showing 20 changed files with 1,487 additions and 1,490 deletions.
1 change: 1 addition & 0 deletions capten/agent/internal/api/agent_cluster_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func (a *Agent) SyncApp(ctx context.Context, request *agentpb.SyncAppRequest) (
}, nil
}

request.Data.Config.PluginStoreType = agentpb.PluginStoreType_DEFAULT_CAPTEN_STORE
if err := a.as.UpsertAppConfig(request.Data); err != nil {
a.log.Errorf("failed to update sync app config, %v", err)
return &agentpb.SyncAppResponse{
Expand Down
9 changes: 7 additions & 2 deletions capten/agent/internal/capten-store/app_config_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
updateTime = "update_time"
usecase, projectUrl, status, details = "usecase", "project_url", "status", "details"
pluginName, pluginDescription = "plugin_name", "plugin_description"
apiEndpoint = "api_endpoint"
apiEndpoint, pluginStoreType = "api_endpoint", "plugin_store_type"
)

var (
Expand All @@ -57,7 +57,7 @@ var (
templateValues, defaultApp,
icon, installStatus,
updateTime, pluginName, pluginDescription,
apiEndpoint,
apiEndpoint, pluginStoreType,
}
)

Expand Down Expand Up @@ -104,6 +104,7 @@ func (a *Store) GetAppConfig(appReleaseName string) (*agentpb.SyncAppData, error
&config.Icon, &config.InstallStatus,
&config.LastUpdateTime, &config.PluginName,
&config.PluginDescription, &config.ApiEndpoint,
&config.PluginStoreType,
); err != nil {
return nil, err
}
Expand Down Expand Up @@ -141,6 +142,7 @@ func (a *Store) GetAllApps() ([]*agentpb.SyncAppData, error) {
&config.Icon, &config.InstallStatus,
&config.LastUpdateTime, &config.PluginName,
&config.PluginDescription, &config.ApiEndpoint,
&config.PluginStoreType,
) {
configCopy := config
overrideValuesCopy, _ := base64.StdEncoding.DecodeString(overrideValues)
Expand Down Expand Up @@ -265,6 +267,9 @@ func formUpdateKvPairs(config *agentpb.SyncAppData) (string, bool) {
fmt.Sprintf("%s = '%s'", apiEndpoint, config.Config.ApiEndpoint))
}

params = append(params,
fmt.Sprintf("%s = %d", pluginStoreType, config.Config.PluginStoreType))

params = append(params,
fmt.Sprintf("%s = '%s'", updateTime, time.Now().Format(time.RFC3339)))

Expand Down
795 changes: 432 additions & 363 deletions capten/common-pkg/agentpb/agent.pb.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE ClusterAppConfig DROP COLUMN plugin_store_type;
1 change: 1 addition & 0 deletions capten/database/cassandra/migrations/014_app_config.up.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE ClusterAppConfig ADD plugin_store_type INT;
7 changes: 7 additions & 0 deletions proto/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ message AppStatus {
string runtimeStatus = 1;
}

enum PluginStoreType {
DEFAULT_CAPTEN_STORE = 0;
CENTRAL_CAPTEN_STORE = 1;
LOCAL_CAPTEN_STORE = 2;
}

message AppConfig {
string releaseName = 1;
string appName = 2;
Expand All @@ -210,6 +216,7 @@ message AppConfig {
string pluginName = 19;
string pluginDescription = 20;
string apiEndpoint = 21;
PluginStoreType pluginStoreType = 22;
}

message AppValues {
Expand Down
5 changes: 3 additions & 2 deletions proto/plugin_store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ enum StatusCode {
}

enum StoreType {
CENTRAL_STORE = 0;
LOCAL_STORE = 1;
DEFAULT_STORE = 0;
CENTRAL_STORE = 1;
LOCAL_STORE = 2;
}

message PluginStoreConfig {
Expand Down
7 changes: 7 additions & 0 deletions proto/server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ message ClusterAttribute {
string value = 2;
}

enum PluginStoreType {
DEFAULT_STORE = 0;
CENTRAL_STORE = 1;
LOCAL_STORE = 2;
}

message ClusterAppConfig {
string releaseName = 1;
string appName = 2;
Expand All @@ -177,6 +183,7 @@ message ClusterAppConfig {
string runtimeStatus = 16;
bool defualtApp = 17;
string pluginName = 18;
PluginStoreType pluginStoreType = 19;
}

message AddStoreAppRequest {
Expand Down
66 changes: 0 additions & 66 deletions server/examples/agent/agent_client.go

This file was deleted.

46 changes: 0 additions & 46 deletions server/examples/astra/astra-client.go

This file was deleted.

121 changes: 0 additions & 121 deletions server/examples/server/server_client.go

This file was deleted.

1 change: 1 addition & 0 deletions server/pkg/api/app_config_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func mapAgentAppsToServerResp(appDataList []*agentpb.AppData) []*serverpb.Cluste
clusterAppConfig.RuntimeStatus = ""
clusterAppConfig.DefualtApp = appConfig.Config.DefualtApp
clusterAppConfig.PluginName = appConfig.Config.PluginName
clusterAppConfig.PluginStoreType = serverpb.PluginStoreType(appConfig.Config.PluginStoreType)
clusterAppConfigs[index] = &clusterAppConfig
}
return clusterAppConfigs
Expand Down
Loading

0 comments on commit 123a5dd

Please sign in to comment.