Skip to content

Commit

Permalink
chore: Argocd repository secret creation service refactoring (#6229)
Browse files Browse the repository at this point in the history
* extracting out chart repository methods

* moving repository creation to argocd client package and secret delete code for oci
  • Loading branch information
iamayushm authored Jan 2, 2025
1 parent 69097b9 commit de8652b
Show file tree
Hide file tree
Showing 13 changed files with 796 additions and 649 deletions.
6 changes: 3 additions & 3 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import (
"github.com/devtron-labs/devtron/client/argocdServer/certificate"
cluster2 "github.com/devtron-labs/devtron/client/argocdServer/cluster"
"github.com/devtron-labs/devtron/client/argocdServer/connection"
"github.com/devtron-labs/devtron/client/argocdServer/repoCredsK8sClient"
repocreds "github.com/devtron-labs/devtron/client/argocdServer/repocreds"
repository2 "github.com/devtron-labs/devtron/client/argocdServer/repository"
session2 "github.com/devtron-labs/devtron/client/argocdServer/session"
Expand Down Expand Up @@ -118,7 +119,6 @@ import (
repository9 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository"
deployment3 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deployment"
"github.com/devtron-labs/devtron/pkg/appWorkflow"
"github.com/devtron-labs/devtron/pkg/argoRepositoryCreds"
"github.com/devtron-labs/devtron/pkg/asyncProvider"
"github.com/devtron-labs/devtron/pkg/attributes"
"github.com/devtron-labs/devtron/pkg/build"
Expand Down Expand Up @@ -950,8 +950,8 @@ func InitializeApp() (*App, error) {
common.NewDeploymentConfigServiceImpl,
wire.Bind(new(common.DeploymentConfigService), new(*common.DeploymentConfigServiceImpl)),

argoRepositoryCreds.NewRepositorySecret,
wire.Bind(new(argoRepositoryCreds.RepositorySecret), new(*argoRepositoryCreds.RepositorySecretImpl)),
repoCredsK8sClient.NewRepositorySecret,
wire.Bind(new(repoCredsK8sClient.RepositoryCreds), new(*repoCredsK8sClient.RepositorySecretImpl)),

repocreds.NewServiceClientImpl,
wire.Bind(new(repocreds.ServiceClient), new(*repocreds.ServiceClientImpl)),
Expand Down
53 changes: 53 additions & 0 deletions client/argocdServer/repoCredsK8sClient/bean/bean.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package bean

const (
REPOSITORY_SECRET_NAME_KEY = "name"
REPOSITORY_SECRET_URL_KEY = "url"
REPOSITORY_SECRET_USERNAME_KEY = "username"
REPOSITORY_SECRET_PASSWORD_KEY = "password"
REPOSITORY_SECRET_ENABLE_OCI_KEY = "enableOCI"
REPOSITORY_SECRET_TYPE_KEY = "type"
REPOSITORY_TYPE_HELM = "helm"
ARGOCD_REPOSITORY_SECRET_KEY = "argocd.argoproj.io/secret-type"
ARGOCD_REPOSITORY_SECRET_VALUE = "repository"
REPOSITORY_SECRET_INSECURE_KEY = "insecure"
)

type ChartRepositoryAddRequest struct {
Name string
Username string
Password string
URL string
AllowInsecureConnection bool
IsPrivateChart bool
}

type ChartRepositoryUpdateRequest struct {
PreviousName string
PreviousURL string
Name string
AuthMode string
Username string
Password string
SSHKey string
URL string
AllowInsecureConnection bool
IsPrivateChart bool
}

type KeyDto struct {
Name string `json:"name,omitempty"`
Key string `json:"key,omitempty"`
Url string `json:"url,omitempty"`
}

type AcdConfigMapRepositoriesDto struct {
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
UsernameSecret *KeyDto `json:"usernameSecret,omitempty"`
PasswordSecret *KeyDto `json:"passwordSecret,omitempty"`
CaSecret *KeyDto `json:"caSecret,omitempty"`
CertSecret *KeyDto `json:"certSecret,omitempty"`
KeySecret *KeyDto `json:"keySecret,omitempty"`
}
Loading

0 comments on commit de8652b

Please sign in to comment.