From 03efaad4281288a375560287588a05c59c84369e Mon Sep 17 00:00:00 2001 From: Venkatreddy KP Date: Mon, 25 Mar 2024 22:57:50 +0530 Subject: [PATCH] update plugin store default project --- charts/server/values.yaml | 1 + server/pkg/plugin-store/model.go | 3 ++- server/pkg/plugin-store/plugin_store_handler.go | 2 +- server/pkg/store/astra/plugin_store.go | 6 +++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/charts/server/values.yaml b/charts/server/values.yaml index 9b2e48a2..5698ddd1 100644 --- a/charts/server/values.yaml +++ b/charts/server/values.yaml @@ -30,6 +30,7 @@ env: logLevel: info database: astra pluginsStoreProjectMount: /plugin-store + pluginsStoreProjectURL: https://github.com/intelops/capten-plugins extraEnv: - name: AUTH_ENABLED diff --git a/server/pkg/plugin-store/model.go b/server/pkg/plugin-store/model.go index a5e8d452..d7671a0b 100644 --- a/server/pkg/plugin-store/model.go +++ b/server/pkg/plugin-store/model.go @@ -23,7 +23,8 @@ type Config struct { PluginsStoreProjectMount string `envconfig:"PLUGIN_STORE_PROJECT_MOUNT" default:"/plugin-store-clone"` PluginsStorePath string `envconfig:"PLUGIN_STORE_PATH" default:"/plugin-store"` PluginsFileName string `envconfig:"PLUGIN_LIST_FILE" default:"plugin-list.yaml"` - PluginStoreProjectURL string `envconfig:"PLUGIN_STORE_PROJECT_URL" default:"https://github.com/vramk23/capten-plugins"` + PluginStoreProjectURL string `envconfig:"PLUGIN_STORE_PROJECT_URL" default:"https://github.com/intelops/capten-plugins"` + PluginStoreProjectAccess string `envconfig:"PLUGIN_STORE_PROJECT_ACCESS" default:""` PluginStoreProjectID string `envconfig:"PLUGIN_STORE_PROJECT_ID" default:"1cf5201d-5f35-4d5b-afe0-4b9d0e0d4cd2"` GitVaultEntityName string `envconfig:"GIT_VAULT_ENTITY_NAME" default:"git-project"` CaptenOAuthURL string `envconfig:"CAPTEN_OAUTH_URL" default:"https://alpha.optimizor.app/api/.ory"` diff --git a/server/pkg/plugin-store/plugin_store_handler.go b/server/pkg/plugin-store/plugin_store_handler.go index 49ab5a9c..4503cb95 100644 --- a/server/pkg/plugin-store/plugin_store_handler.go +++ b/server/pkg/plugin-store/plugin_store_handler.go @@ -335,7 +335,7 @@ func stringContains(arr []string, target string) bool { func (p *PluginStore) getGitProjectAccessToken(orgId, clusterId, projectId string, storeType pluginstorepb.StoreType) (string, error) { if storeType == pluginstorepb.StoreType_CENTRAL_STORE { - return "", nil + return p.cfg.PluginStoreProjectAccess, nil } agent, err := p.agentHandler.GetAgent(orgId, clusterId) diff --git a/server/pkg/store/astra/plugin_store.go b/server/pkg/store/astra/plugin_store.go index b2e08038..5aec1787 100644 --- a/server/pkg/store/astra/plugin_store.go +++ b/server/pkg/store/astra/plugin_store.go @@ -12,7 +12,7 @@ import ( const ( insertStoreConfig = `INSERT INTO %s.plugin_store_config (cluster_id, store_type, git_project_id, git_project_url, last_updated_time) VALUES (%s, %d, '%s', '%s', '%s') IF NOT EXISTS` - updateStoreConfig = `UPDATE %s.plugin_store_config SET store_type = %d, git_project_id = '%s', git_project_url = '%s', last_updated_time = '%s' WHERE cluster_id = %s` + updateStoreConfig = `UPDATE %s.plugin_store_config SET git_project_id = '%s', git_project_url = '%s', last_updated_time = '%s' WHERE cluster_id = %s and store_type = %d` readStoreConfigForStoreType = `SELECT git_project_id, git_project_url, last_updated_time FROM %s.plugin_store_config WHERE cluster_id = %s and store_type = %d` insertPluginData = `INSERT INTO %s.plugin_data (git_project_id, plugin_name, last_updated_time, store_type, description, category, icon, chart_name, chart_repo, versions, default_namespace, privileged_namespace, api_endpoint, ui_endpoint, capabilities) VALUES (%s, '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', %v, '%s', %t, '%s', '%s', %v) IF NOT EXISTS` @@ -44,8 +44,8 @@ func (a *AstraServerStore) WritePluginStoreConfig(clusterId string, config *plug query = &pb.Query{ Cql: fmt.Sprintf(updateStoreConfig, - a.keyspace, config.StoreType, config.GitProjectId, config.GitProjectURL, - time.Now().Format(time.RFC3339), clusterId), + a.keyspace, config.GitProjectId, config.GitProjectURL, + time.Now().Format(time.RFC3339), clusterId, config.StoreType), } _, err = a.c.Session().ExecuteQuery(query)