argocdServer

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 45 Imported by: 28

Documentation

Index

Constants

View Source
const (
	TimeoutSlow                 = 30 * time.Second
	ARGOCD_APPLICATION_TEMPLATE = "./scripts/argo-assets/APPLICATION_TEMPLATE.tmpl"
)
View Source
const DevtronInstalationNs = "devtroncd"
View Source
const (
	ErrorOperationAlreadyInProgress = "another operation is already in progress" // this string is returned from argocd
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACDConfig added in v0.6.28

type ACDConfig struct {
	ArgoCDAutoSyncEnabled     bool `env:"ARGO_AUTO_SYNC_ENABLED" envDefault:"true"` // will gradually switch this flag to false in enterprise
	RegisterRepoMaxRetryCount int  `env:"ARGO_REPO_REGISTER_RETRY_COUNT" envDefault:"3"`
	RegisterRepoMaxRetryDelay int  `env:"ARGO_REPO_REGISTER_RETRY_DELAY" envDefault:"10"`
}

func GetACDDeploymentConfig added in v0.6.28

func GetACDDeploymentConfig() (*ACDConfig, error)

func (*ACDConfig) IsAutoSyncEnabled added in v0.7.0

func (config *ACDConfig) IsAutoSyncEnabled() bool

func (*ACDConfig) IsManualSyncEnabled added in v0.7.0

func (config *ACDConfig) IsManualSyncEnabled() bool

type AppTemplate

type AppTemplate struct {
	ApplicationName string
	Namespace       string
	TargetNamespace string
	TargetServer    string
	Project         string
	ValuesFile      string
	RepoPath        string
	RepoUrl         string
	AutoSyncEnabled bool
}

type ApplicationClientWrapper added in v1.2.2

type ApplicationClientWrapper interface {
	ResourceTree(ctxt context.Context, query *application2.ResourcesQuery) (*v1alpha1.ApplicationTree, error)
	GetArgoClient(ctxt context.Context) (application2.ApplicationServiceClient, *grpc.ClientConn, error)
	GetApplicationResource(ctx context.Context, query *application2.ApplicationResourceRequest) (*application2.ApplicationResourceResponse, error)
	DeleteArgoApp(ctx context.Context, appName string, cascadeDelete bool) (*application2.ApplicationResponse, error)

	// GetArgoAppByName fetches an argoCd app by its name
	GetArgoAppByName(ctx context.Context, appName string) (*v1alpha1.Application, error)

	// SyncArgoCDApplicationIfNeededAndRefresh - if ARGO_AUTO_SYNC_ENABLED=true, app will be refreshed to initiate refresh at argoCD side or else it will be synced and refreshed
	SyncArgoCDApplicationIfNeededAndRefresh(context context.Context, argoAppName string) error

	// UpdateArgoCDSyncModeIfNeeded - if ARGO_AUTO_SYNC_ENABLED=true and app is in manual sync mode or vice versa update app
	UpdateArgoCDSyncModeIfNeeded(ctx context.Context, argoApplication *v1alpha1.Application) (err error)

	// RegisterGitOpsRepoInArgoWithRetry - register a repository in argo-cd with retry mechanism
	RegisterGitOpsRepoInArgoWithRetry(ctx context.Context, gitOpsRepoUrl string, userId int32) error

	// PatchArgoCdApp performs a patch operation on an argoCd app
	PatchArgoCdApp(ctx context.Context, dto *bean.ArgoCdAppPatchReqDto) error

	// IsArgoAppPatchRequired decides weather the v1alpha1.ApplicationSource requires to be updated
	IsArgoAppPatchRequired(argoAppSpec *v1alpha1.ApplicationSource, currentGitRepoUrl, currentChartPath string) bool

	// GetGitOpsRepoName returns the GitOps repository name, configured for the argoCd app
	GetGitOpsRepoNameForApplication(ctx context.Context, appName string) (gitOpsRepoName string, err error)

	GetGitOpsRepoURLForApplication(ctx context.Context, appName string) (gitOpsRepoURL string, err error)
}

type ArgoClientWrapperServiceEAImpl added in v1.2.2

type ArgoClientWrapperServiceEAImpl struct {
	// contains filtered or unexported fields
}

func NewArgoClientWrapperServiceEAImpl added in v1.2.2

func NewArgoClientWrapperServiceEAImpl(
	logger *zap.SugaredLogger,
	repoCredsK8sClient repoCredsK8sClient.RepositoryCredsK8sClient,
	acdConfigGetter config2.ArgoCDConfigGetter,
) *ArgoClientWrapperServiceEAImpl

func (*ArgoClientWrapperServiceEAImpl) AddChartRepository added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) AddChartRepository(request bean2.ChartRepositoryAddRequest) error

func (*ArgoClientWrapperServiceEAImpl) AddOrUpdateOCIRegistry added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) AddOrUpdateOCIRegistry(username, password string, uniqueId int, registryUrl, repo string, isPublic bool) error

func (*ArgoClientWrapperServiceEAImpl) CreateCertificate added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) CreateCluster added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) CreateCluster(ctx context.Context, clusterRequest *cluster2.ClusterCreateRequest) (*v1alpha1.Cluster, error)

func (*ArgoClientWrapperServiceEAImpl) CreateRepoCreds added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) DeleteArgoApp added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) DeleteArgoApp(ctx context.Context, appName string, cascadeDelete bool) (*application2.ApplicationResponse, error)

func (*ArgoClientWrapperServiceEAImpl) DeleteCertificate added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) DeleteChartRepository added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) DeleteChartRepository(name, url string) error

func (*ArgoClientWrapperServiceEAImpl) DeleteOCIRegistry added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) DeleteOCIRegistry(registryURL, repo string, ociRegistryId int) error

func (*ArgoClientWrapperServiceEAImpl) GetApplicationResource added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) GetArgoAppByName added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) GetArgoAppByName(ctx context.Context, appName string) (*v1alpha1.Application, error)

func (*ArgoClientWrapperServiceEAImpl) GetArgoApplication added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) GetArgoClient added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) GetGitOpsRepoNameForApplication added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) GetGitOpsRepoNameForApplication(ctx context.Context, appName string) (gitOpsRepoName string, err error)

func (*ArgoClientWrapperServiceEAImpl) GetGitOpsRepoURLForApplication added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) GetGitOpsRepoURLForApplication(ctx context.Context, appName string) (gitOpsRepoName string, err error)

func (*ArgoClientWrapperServiceEAImpl) IsArgoAppPatchRequired added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) IsArgoAppPatchRequired(argoAppSpec *v1alpha1.ApplicationSource, currentGitRepoUrl, currentChartPath string) bool

func (*ArgoClientWrapperServiceEAImpl) PatchArgoCdApp added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) RegisterGitOpsRepoInArgoWithRetry added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) RegisterGitOpsRepoInArgoWithRetry(ctx context.Context, gitOpsRepoUrl string, userId int32) error

func (*ArgoClientWrapperServiceEAImpl) ResourceTree added in v1.2.2

func (*ArgoClientWrapperServiceEAImpl) SyncArgoCDApplicationIfNeededAndRefresh added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) SyncArgoCDApplicationIfNeededAndRefresh(ctx context.Context, argoAppName string) error

func (*ArgoClientWrapperServiceEAImpl) UpdateArgoCDSyncModeIfNeeded added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) UpdateArgoCDSyncModeIfNeeded(ctx context.Context, argoApplication *v1alpha1.Application) (err error)

func (*ArgoClientWrapperServiceEAImpl) UpdateChartRepository added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) UpdateChartRepository(request bean2.ChartRepositoryUpdateRequest) error

func (*ArgoClientWrapperServiceEAImpl) UpdateCluster added in v1.2.2

func (impl *ArgoClientWrapperServiceEAImpl) UpdateCluster(ctx context.Context, clusterRequest *cluster2.ClusterUpdateRequest) (*v1alpha1.Cluster, error)

type ArgoClientWrapperServiceImpl added in v0.6.24

type ArgoClientWrapperServiceImpl struct {
	CertificateClient certificate2.ServiceClient

	ACDConfig *ACDConfig

	*ArgoClientWrapperServiceEAImpl
	// contains filtered or unexported fields
}

func NewArgoClientWrapperServiceImpl added in v0.6.24

func NewArgoClientWrapperServiceImpl(
	acdClient application.ServiceClient,
	repositoryService repository.ServiceClient,
	clusterClient cluster.ServiceClient,
	repocredsClient repocreds2.ServiceClient,
	CertificateClient certificate2.ServiceClient,
	logger *zap.SugaredLogger,
	ACDConfig *ACDConfig, gitOpsConfigReadService config.GitOpsConfigReadService,
	gitOperationService git.GitOperationService, asyncRunnable *async.Runnable,
	acdConfigGetter config2.ArgoCDConfigGetter,
	ArgoClientWrapperServiceEAImpl *ArgoClientWrapperServiceEAImpl,
) *ArgoClientWrapperServiceImpl

func (*ArgoClientWrapperServiceImpl) AddChartRepository added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) AddChartRepository(request bean2.ChartRepositoryAddRequest) error

func (*ArgoClientWrapperServiceImpl) AddOrUpdateOCIRegistry added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) AddOrUpdateOCIRegistry(username, password string, uniqueId int, registryUrl, repo string, isPublic bool) error

func (*ArgoClientWrapperServiceImpl) CreateCertificate added in v1.2.2

func (*ArgoClientWrapperServiceImpl) CreateCluster added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) CreateCluster(ctx context.Context, clusterRequest *cluster2.ClusterCreateRequest) (*v1alpha1.Cluster, error)

func (*ArgoClientWrapperServiceImpl) CreateRepoCreds added in v1.2.2

func (*ArgoClientWrapperServiceImpl) DeleteArgoApp added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) DeleteArgoApp(ctx context.Context, appName string, cascadeDelete bool) (*application2.ApplicationResponse, error)

func (*ArgoClientWrapperServiceImpl) DeleteCertificate added in v1.2.2

func (*ArgoClientWrapperServiceImpl) DeleteChartRepository added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) DeleteChartRepository(name, url string) error

func (*ArgoClientWrapperServiceImpl) DeleteOCIRegistry added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) DeleteOCIRegistry(registryURL, repo string, ociRegistryId int) error

func (*ArgoClientWrapperServiceImpl) GetApplicationResource added in v1.2.2

func (*ArgoClientWrapperServiceImpl) GetArgoAppByName added in v0.6.29

func (impl *ArgoClientWrapperServiceImpl) GetArgoAppByName(ctx context.Context, appName string) (*v1alpha1.Application, error)

func (*ArgoClientWrapperServiceImpl) GetArgoAppWithNormalRefresh added in v0.6.24

func (impl *ArgoClientWrapperServiceImpl) GetArgoAppWithNormalRefresh(ctx context.Context, grpcConfig *bean.ArgoGRPCConfig, argoAppName string) error

func (*ArgoClientWrapperServiceImpl) GetArgoApplication added in v1.2.2

func (*ArgoClientWrapperServiceImpl) GetArgoClient added in v1.2.2

func (*ArgoClientWrapperServiceImpl) GetGitOpsRepoNameForApplication added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) GetGitOpsRepoNameForApplication(ctx context.Context, appName string) (gitOpsRepoName string, err error)

func (*ArgoClientWrapperServiceImpl) GetGitOpsRepoURLForApplication added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) GetGitOpsRepoURLForApplication(ctx context.Context, appName string) (gitOpsRepoName string, err error)

func (*ArgoClientWrapperServiceImpl) IsArgoAppPatchRequired added in v0.7.0

func (impl *ArgoClientWrapperServiceImpl) IsArgoAppPatchRequired(argoAppSpec *v1alpha1.ApplicationSource, currentGitRepoUrl, currentChartPath string) bool

func (*ArgoClientWrapperServiceImpl) PatchArgoCdApp added in v0.6.29

func (*ArgoClientWrapperServiceImpl) RegisterGitOpsRepoInArgoWithRetry added in v0.6.29

func (impl *ArgoClientWrapperServiceImpl) RegisterGitOpsRepoInArgoWithRetry(ctx context.Context, gitOpsRepoUrl string, userId int32) error

func (*ArgoClientWrapperServiceImpl) ResourceTree added in v1.2.2

func (*ArgoClientWrapperServiceImpl) SyncArgoCDApplicationIfNeededAndRefresh added in v0.6.28

func (impl *ArgoClientWrapperServiceImpl) SyncArgoCDApplicationIfNeededAndRefresh(ctx context.Context, argoAppName string) error

func (*ArgoClientWrapperServiceImpl) UpdateArgoCDSyncModeIfNeeded added in v0.6.28

func (impl *ArgoClientWrapperServiceImpl) UpdateArgoCDSyncModeIfNeeded(ctx context.Context, argoApplication *v1alpha1.Application) (err error)

func (*ArgoClientWrapperServiceImpl) UpdateChartRepository added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) UpdateChartRepository(request bean2.ChartRepositoryUpdateRequest) error

func (*ArgoClientWrapperServiceImpl) UpdateCluster added in v1.2.2

func (impl *ArgoClientWrapperServiceImpl) UpdateCluster(ctx context.Context, clusterRequest *cluster2.ClusterUpdateRequest) (*v1alpha1.Cluster, error)

type ArgoK8sClient

type ArgoK8sClient interface {
	CreateAcdApp(ctx context.Context, appRequest *AppTemplate, applicationTemplatePath string) (string, error)
	GetArgoApplication(namespace string, appName string, cluster *repository.Cluster) (map[string]interface{}, error)
}

type ArgoK8sClientImpl

type ArgoK8sClientImpl struct {
	// contains filtered or unexported fields
}

func NewArgoK8sClientImpl

func NewArgoK8sClientImpl(logger *zap.SugaredLogger,
	k8sUtil *k8s.K8sServiceImpl,
) *ArgoK8sClientImpl

func (ArgoK8sClientImpl) CreateAcdApp

func (impl ArgoK8sClientImpl) CreateAcdApp(ctx context.Context, appRequest *AppTemplate, applicationTemplatePath string) (string, error)

func (ArgoK8sClientImpl) CreateArgoApplication

func (impl ArgoK8sClientImpl) CreateArgoApplication(ctx context.Context, namespace string, application string, config *rest.Config) error

func (ArgoK8sClientImpl) GetArgoApplication added in v0.2.27

func (impl ArgoK8sClientImpl) GetArgoApplication(namespace string, appName string, cluster *repository.Cluster) (map[string]interface{}, error)

type CertificateClientWrapper added in v1.2.2

type CertificateClientWrapper interface {
	CreateCertificate(ctx context.Context, query *certificate.RepositoryCertificateCreateRequest) (*v1alpha1.RepositoryCertificateList, error)
	DeleteCertificate(ctx context.Context, query *certificate.RepositoryCertificateQuery, opts ...grpc.CallOption) (*v1alpha1.RepositoryCertificateList, error)
}

type ClusterClientWrapper added in v1.2.2

type ClusterClientWrapper interface {
	CreateCluster(ctx context.Context, clusterRequest *cluster2.ClusterCreateRequest) (*v1alpha1.Cluster, error)
	UpdateCluster(ctx context.Context, clusterRequest *cluster2.ClusterUpdateRequest) (*v1alpha1.Cluster, error)
}

type RepoCredsClientWrapper added in v1.2.2

type RepoCredsClientWrapper interface {
	CreateRepoCreds(ctx context.Context, query *repocreds.RepoCredsCreateRequest) (*v1alpha1.RepoCreds, error)
	AddOrUpdateOCIRegistry(username, password string, uniqueId int, registryUrl, repo string, isPublic bool) error
	DeleteOCIRegistry(registryURL, repo string, ociRegistryId int) error
	AddChartRepository(request bean2.ChartRepositoryAddRequest) error
	UpdateChartRepository(request bean2.ChartRepositoryUpdateRequest) error
	DeleteChartRepository(name, url string) error
}

type RepositoryClientWrapper added in v1.2.2

type RepositoryClientWrapper interface {
	RegisterGitOpsRepoInArgoWithRetry(ctx context.Context, gitOpsRepoUrl string, userId int32) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL