-
Notifications
You must be signed in to change notification settings - Fork 524
/
Copy pathArgoClientWrapperServiceEA.go
173 lines (145 loc) · 7.16 KB
/
ArgoClientWrapperServiceEA.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package argocdServer
import (
"context"
application2 "github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/certificate"
cluster2 "github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/repocreds"
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/devtron-labs/devtron/client/argocdServer/bean"
config2 "github.com/devtron-labs/devtron/client/argocdServer/config"
"github.com/devtron-labs/devtron/client/argocdServer/repoCredsK8sClient"
bean2 "github.com/devtron-labs/devtron/client/argocdServer/repoCredsK8sClient/bean"
"go.uber.org/zap"
"google.golang.org/grpc"
)
type ArgoClientWrapperServiceEAImpl struct {
logger *zap.SugaredLogger
repoCredsK8sClient repoCredsK8sClient.RepositoryCredsK8sClient
acdConfigGetter config2.ArgoCDConfigGetter
}
func NewArgoClientWrapperServiceEAImpl(
logger *zap.SugaredLogger,
repoCredsK8sClient repoCredsK8sClient.RepositoryCredsK8sClient,
acdConfigGetter config2.ArgoCDConfigGetter,
) *ArgoClientWrapperServiceEAImpl {
return &ArgoClientWrapperServiceEAImpl{
logger: logger,
repoCredsK8sClient: repoCredsK8sClient,
acdConfigGetter: acdConfigGetter,
}
}
func (impl *ArgoClientWrapperServiceEAImpl) ResourceTree(ctxt context.Context, query *application2.ResourcesQuery) (*v1alpha1.ApplicationTree, error) {
impl.logger.Info("not implemented")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) GetArgoClient(ctxt context.Context) (application2.ApplicationServiceClient, *grpc.ClientConn, error) {
impl.logger.Info("not implemented")
return nil, nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) GetApplicationResource(ctx context.Context, query *application2.ApplicationResourceRequest) (*application2.ApplicationResourceResponse, error) {
impl.logger.Info("not implemented")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) GetArgoApplication(ctx context.Context, query *application2.ApplicationQuery) (*v1alpha1.Application, error) {
impl.logger.Info("not implemented")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) DeleteArgoApp(ctx context.Context, appName string, cascadeDelete bool) (*application2.ApplicationResponse, error) {
impl.logger.Info("not implemented")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) DeleteArgoAppWithK8sClient(ctx context.Context, clusterId int, namespace, appName string, cascadeDelete bool) error {
return nil
}
func (impl *ArgoClientWrapperServiceEAImpl) SyncArgoCDApplicationAndRefreshWithK8sClient(ctx context.Context, clusterId int, namespace, appName string) error {
impl.logger.Info("not implemented")
return nil
}
func (impl *ArgoClientWrapperServiceEAImpl) UpdateArgoCDSyncModeIfNeeded(ctx context.Context, argoApplication *v1alpha1.Application) (err error) {
impl.logger.Info("not implemented")
return nil
}
func (impl *ArgoClientWrapperServiceEAImpl) RegisterGitOpsRepoInArgoWithRetry(ctx context.Context, gitOpsRepoUrl, targetRevision string, userId int32) error {
impl.logger.Info("not implemented")
return nil
}
func (impl *ArgoClientWrapperServiceEAImpl) CreateRepoCreds(ctx context.Context, query *repocreds.RepoCredsCreateRequest) (*v1alpha1.RepoCreds, error) {
impl.logger.Info("not implemented")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) AddOrUpdateOCIRegistry(username, password string, uniqueId int, registryUrl, repo string, isPublic bool) error {
argoK8sConfig, err := impl.acdConfigGetter.GetK8sConfig()
if err != nil {
impl.logger.Errorw("error in getting k8s config", "err", err)
}
return impl.repoCredsK8sClient.AddOrUpdateOCIRegistry(argoK8sConfig, username, password, uniqueId, registryUrl, repo, isPublic)
}
func (impl *ArgoClientWrapperServiceEAImpl) DeleteOCIRegistry(registryURL, repo string, ociRegistryId int) error {
argoK8sConfig, err := impl.acdConfigGetter.GetK8sConfig()
if err != nil {
impl.logger.Errorw("error in getting k8s config", "err", err)
}
return impl.repoCredsK8sClient.DeleteOCIRegistry(argoK8sConfig, registryURL, repo, ociRegistryId)
}
func (impl *ArgoClientWrapperServiceEAImpl) AddChartRepository(request bean2.ChartRepositoryAddRequest) error {
argoK8sConfig, err := impl.acdConfigGetter.GetK8sConfig()
if err != nil {
impl.logger.Errorw("error in getting k8s config", "err", err)
}
return impl.repoCredsK8sClient.AddChartRepository(argoK8sConfig, request)
}
func (impl *ArgoClientWrapperServiceEAImpl) UpdateChartRepository(request bean2.ChartRepositoryUpdateRequest) error {
argoK8sConfig, err := impl.acdConfigGetter.GetK8sConfig()
if err != nil {
return err
}
return impl.repoCredsK8sClient.UpdateChartRepository(argoK8sConfig, request)
}
func (impl *ArgoClientWrapperServiceEAImpl) DeleteChartRepository(name, url string) error {
argoK8sConfig, err := impl.acdConfigGetter.GetK8sConfig()
if err != nil {
return err
}
return impl.repoCredsK8sClient.DeleteChartRepository(argoK8sConfig, name, url)
}
func (impl *ArgoClientWrapperServiceEAImpl) GetArgoAppByName(ctx context.Context, appName string) (*v1alpha1.Application, error) {
impl.logger.Info("not implemented for EA mode")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) GetArgoAppByNameWithK8sClient(ctx context.Context, clusterId int, namespace, appName string) (*v1alpha1.Application, error) {
impl.logger.Info("not implemented for EA mode")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) IsArgoAppPatchRequired(argoAppSpec *v1alpha1.ApplicationSource, currentGitRepoUrl, currentTargetRevision, currentChartPath string) bool {
impl.logger.Info("not implemented for EA mode")
return false
}
func (impl *ArgoClientWrapperServiceEAImpl) PatchArgoCdApp(ctx context.Context, dto *bean.ArgoCdAppPatchReqDto) error {
impl.logger.Info("not implemented for EA mode")
return nil
}
func (impl *ArgoClientWrapperServiceEAImpl) GetGitOpsRepoNameForApplication(ctx context.Context, appName string) (gitOpsRepoName string, err error) {
impl.logger.Info("not implemented for EA mode")
return "", nil
}
func (impl *ArgoClientWrapperServiceEAImpl) GetGitOpsRepoURLForApplication(ctx context.Context, appName string) (gitOpsRepoName string, err error) {
impl.logger.Info("not implemented for EA mode")
return "", nil
}
func (impl *ArgoClientWrapperServiceEAImpl) CreateCluster(ctx context.Context, clusterRequest *cluster2.ClusterCreateRequest) (*v1alpha1.Cluster, error) {
impl.logger.Info("not implemented for EA mode")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) UpdateCluster(ctx context.Context, clusterRequest *cluster2.ClusterUpdateRequest) (*v1alpha1.Cluster, error) {
impl.logger.Info("not implemented for EA mode")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) CreateCertificate(ctx context.Context, query *certificate.RepositoryCertificateCreateRequest) (*v1alpha1.RepositoryCertificateList, error) {
impl.logger.Info("not implemented for EA mode")
return nil, nil
}
func (impl *ArgoClientWrapperServiceEAImpl) DeleteCertificate(ctx context.Context, query *certificate.RepositoryCertificateQuery, opts ...grpc.CallOption) (*v1alpha1.RepositoryCertificateList, error) {
impl.logger.Info("not implemented for EA mode")
return nil, nil
}