Skip to content

Commit 2b436e8

Browse files
authored
wip: reverting acd token fetch logic (#5614)
1 parent f5b51f7 commit 2b436e8

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

pkg/gitops/GitOpsConfigService.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,6 @@ func (impl *GitOpsConfigServiceImpl) createGitOpsConfig(ctx context.Context, req
276276

277277
if model.EnableTLSVerification {
278278

279-
acdToken, err := impl.argoUserService.GetLatestDevtronArgoCdUserToken()
280-
if err != nil {
281-
impl.logger.Errorw("error in getting acd token", "err", err)
282-
return nil, err
283-
}
284-
ctx = context.WithValue(ctx, "token", acdToken)
285-
286279
err = impl.gitOperationService.UpdateGitHostUrlByProvider(request)
287280
if err != nil {
288281
return nil, err

util/argo/ArgoUserService.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package argo
1818

1919
import (
2020
"context"
21-
"errors"
2221
"fmt"
2322
"github.com/argoproj/argo-cd/v2/pkg/apiclient/account"
2423
"github.com/devtron-labs/authenticator/client"
@@ -30,7 +29,6 @@ import (
3029
"github.com/devtron-labs/devtron/pkg/deployment/gitOps/config"
3130
"github.com/devtron-labs/devtron/pkg/module"
3231
util2 "github.com/devtron-labs/devtron/util"
33-
"github.com/go-pg/pg"
3432
"go.uber.org/zap"
3533
"golang.org/x/crypto/bcrypt"
3634
apiv1 "k8s.io/api/core/v1"
@@ -211,19 +209,15 @@ func (impl *ArgoUserServiceImpl) createNewArgoCdTokenForDevtron(username, passwo
211209

212210
// note: this function also called for no gitops case, where apps are installed via helm
213211
func (impl *ArgoUserServiceImpl) GetLatestDevtronArgoCdUserToken() (string, error) {
214-
215-
moduleInfo, err := impl.moduleService.GetModuleInfo(module.ModuleNameArgoCd)
216-
if err != nil && !errors.Is(err, pg.ErrNoRows) {
212+
gitOpsConfigurationStatus, err := impl.gitOpsConfigReadService.IsGitOpsConfigured()
213+
if err != nil {
217214
impl.logger.Errorw("error while checking if gitOps is configured", "err", err)
218215
return "", err
219216
}
220-
if moduleInfo == nil {
221-
return "", errors.New("argocd module not installed")
222-
}
223-
if moduleInfo.Status != connection.ModuleStatusInstalled {
217+
if !gitOpsConfigurationStatus.IsGitOpsConfigured {
218+
//here acd token only required in context for argo cd calls
224219
return "", nil
225220
}
226-
227221
k8sClient, err := impl.k8sUtil.GetClientForInCluster()
228222
if err != nil {
229223
impl.logger.Errorw("error in getting k8s client for default cluster", "err", err)

0 commit comments

Comments
 (0)