Skip to content

Commit

Permalink
removed table column repo_name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
share2kanna committed Jun 14, 2024
1 parent 3938b09 commit 1b32e3d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
13 changes: 0 additions & 13 deletions capten/agent/internal/api/app_config_sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package api

import (
"context"
"strings"

"github.com/kube-tarian/kad/capten/common-pkg/credential"
"github.com/kube-tarian/kad/capten/common-pkg/pb/agentpb"
Expand All @@ -25,8 +24,6 @@ func (a *Agent) ConfigureAppSSO(ctx context.Context,
}, nil
}

a.prepareRepoName(appConfig)

if err := credential.StoreAppOauthCredential(ctx, req.ReleaseName, req.ClientId, req.ClientSecret); err != nil {
a.log.Errorf("failed to store oauth credential for app %s, %v", req.ReleaseName, err)
return &agentpb.ConfigureAppSSOResponse{
Expand Down Expand Up @@ -86,16 +83,6 @@ func (a *Agent) ConfigureAppSSO(ctx context.Context,
}, nil
}

func (a *Agent) prepareRepoName(appConfig *agentpb.SyncAppData) {
repoInfo := strings.Split(appConfig.Config.AppName, "/")

if len(repoInfo) != 2 {
a.log.Infof("App don't have repo name %s, using chartName as repoName", appConfig.Config.AppName)
repoInfo = []string{appConfig.Config.ChartName, appConfig.Config.AppName}
}
appConfig.Config.RepoName = repoInfo[0]
}

func (a *Agent) upgradeAppWithWorkflow(req *model.ApplicationInstallRequest,
appConfig *agentpb.SyncAppData) {
wd := workers.NewDeployment(a.tc, a.log)
Expand Down
12 changes: 11 additions & 1 deletion capten/agent/internal/api/app_values_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func deriveTemplateValues(overrideValues, templateValues []byte) ([]byte, error)
func prepareAppDeployRequestFromSyncApp(data *agentpb.SyncAppData, values []byte) *model.ApplicationInstallRequest {
return &model.ApplicationInstallRequest{
PluginName: "helm",
RepoName: data.Config.RepoName,
RepoName: prepareRepoName(data),
RepoURL: data.Config.RepoURL,
ChartName: data.Config.ChartName,
Namespace: data.Config.Namespace,
Expand All @@ -268,3 +268,13 @@ func prepareAppDeployRequestFromSyncApp(data *agentpb.SyncAppData, values []byte
Timeout: 10,
}
}

func prepareRepoName(appConfig *agentpb.SyncAppData) string {
repoInfo := strings.Split(appConfig.Config.AppName, "/")

if len(repoInfo) != 2 {
// AppName don't have repo name, so using chartName as repoName
repoInfo = []string{appConfig.Config.ChartName, appConfig.Config.AppName}
}
return repoInfo[0]
}
3 changes: 0 additions & 3 deletions capten/common-pkg/capten-store/app_config_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func (a *Store) UpsertAppConfig(appData *agentpb.SyncAppData) error {
appConfig.Description = appData.Config.Description
appConfig.Icon = appData.Config.Icon
appConfig.AppName = appData.Config.ChartName
appConfig.RepoName = appData.Config.RepoName
appConfig.RepoURL = appData.Config.RepoURL
appConfig.Namespace = appData.Config.Namespace
appConfig.PrivilegedNamespace = appData.Config.PrivilegedNamespace
Expand Down Expand Up @@ -87,7 +86,6 @@ func (a *Store) GetAppConfig(appReleaseName string) (*agentpb.SyncAppData, error
Description: appConfig.Description,
Icon: appConfig.Icon,
ChartName: appConfig.AppName,
RepoName: appConfig.RepoName,
RepoURL: appConfig.RepoURL,
Namespace: appConfig.Namespace,
PrivilegedNamespace: appConfig.PrivilegedNamespace,
Expand Down Expand Up @@ -138,7 +136,6 @@ func (a *Store) GetAllApps() ([]*agentpb.SyncAppData, error) {
Description: ac.Description,
Icon: ac.Icon,
ChartName: ac.AppName,
RepoName: ac.RepoName,
RepoURL: ac.RepoURL,
Namespace: ac.Namespace,
PrivilegedNamespace: ac.PrivilegedNamespace,
Expand Down
1 change: 0 additions & 1 deletion capten/common-pkg/capten-store/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ type ClusterAppConfig struct {
PluginStoreType int `json:"plugin_store_type" gorm:"column:plugin_store_type"`
Category string `json:"category" gorm:"column:category"`
Description string `json:"description" gorm:"column:description"`
RepoName string `json:"repo_name" gorm:"column:repo_name"`
RepoURL string `json:"repo_url" gorm:"column:repo_url"`
Version string `json:"version" gorm:"column:version"`
Namespace string `json:"namespace" gorm:"column:namespace"`
Expand Down
1 change: 0 additions & 1 deletion capten/common-pkg/pb/agentpb/agent.pb.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ func executeAppDeployment(
Category: req.Category,
Description: req.Description,
ChartName: req.ChartName + "/" + req.ChartName,
RepoName: req.ChartName,
RepoURL: req.ChartRepo,
Namespace: req.DefaultNamespace,
CreateNamespace: true,
Expand Down

0 comments on commit 1b32e3d

Please sign in to comment.