Skip to content

Commit

Permalink
Merge pull request #444 from kube-tarian/update-store-project
Browse files Browse the repository at this point in the history
update plugin store default project
  • Loading branch information
vramk23 authored Mar 25, 2024
2 parents 123a5dd + 03efaad commit bee31af
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions charts/server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ env:
logLevel: info
database: astra
pluginsStoreProjectMount: /plugin-store
pluginsStoreProjectURL: https://github.com/intelops/capten-plugins

extraEnv:
- name: AUTH_ENABLED
Expand Down
3 changes: 2 additions & 1 deletion server/pkg/plugin-store/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 1 addition & 1 deletion server/pkg/plugin-store/plugin_store_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions server/pkg/store/astra/plugin_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit bee31af

Please sign in to comment.