Skip to content

Commit 952a12d

Browse files
Merge pull request #6471 from devtron-labs/main-sync-develop-24mar
sync: Main sync develop
2 parents 26c7555 + f33304b commit 952a12d

File tree

5 files changed

+15
-42
lines changed

5 files changed

+15
-42
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ require (
291291

292292
replace (
293293
github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13
294-
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2
295-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2
294+
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174
295+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174
296296
github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
297297
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
298298
k8s.io/api => k8s.io/api v0.29.7

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -792,10 +792,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq
792792
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
793793
github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU=
794794
github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA=
795-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2 h1:7jQYKn1eLMIn7QgV13bNhueU+CbbRaSBxkWp+Dp/GTo=
796-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
797-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2 h1:blntkjXNtvA1AccbAcM6TKV+WcbXNyIstSnhDtAfuI8=
798-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
795+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174 h1:Tf3xomEdbSkgrxW9mUpuQ6W2f8ZX3rX1fwlY/evEWGU=
796+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
797+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174 h1:0ro/HoPor0pamglXYqe9Z4MlQsO3pyW94C/byzzsxig=
798+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
799799
github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU=
800800
github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y=
801801
github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs=

pkg/cluster/ClusterServiceExtended.go

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"time"
3030

3131
cluster3 "github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster"
32-
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
3332
"github.com/devtron-labs/devtron/client/grafana"
3433
"github.com/devtron-labs/devtron/internal/constants"
3534
"github.com/devtron-labs/devtron/internal/util"
@@ -236,37 +235,11 @@ func (impl *ClusterServiceImplExtended) Update(ctx context.Context, bean *bean.C
236235

237236
}
238237

239-
// if git-ops configured, then only update cluster in ACD, otherwise ignore
238+
// if git-ops configured and ArgoCD module is installed, then only update cluster in ACD, otherwise ignore
240239
if gitOpsConfigurationStatus.IsGitOpsConfiguredAndArgoCdInstalled() {
241-
configMap := bean.Config
242-
serverUrl := bean.ServerUrl
243-
bearerToken := ""
244-
if configMap[commonBean.BearerToken] != "" {
245-
bearerToken = configMap[commonBean.BearerToken]
246-
}
247-
248-
tlsConfig := v1alpha1.TLSClientConfig{
249-
Insecure: bean.InsecureSkipTLSVerify,
250-
}
251-
if !bean.InsecureSkipTLSVerify {
252-
tlsConfig.KeyData = []byte(configMap[commonBean.TlsKey])
253-
tlsConfig.CertData = []byte(configMap[commonBean.CertData])
254-
tlsConfig.CAData = []byte(configMap[commonBean.CertificateAuthorityData])
255-
}
256-
257-
cdClusterConfig := v1alpha1.ClusterConfig{
258-
BearerToken: bearerToken,
259-
TLSClientConfig: tlsConfig,
260-
}
261-
262-
cl := &v1alpha1.Cluster{
263-
Name: bean.ClusterName,
264-
Server: serverUrl,
265-
Config: cdClusterConfig,
266-
}
267-
268-
_, err = impl.argoCDClientWrapper.UpdateCluster(ctx, &cluster3.ClusterUpdateRequest{Cluster: cl})
269240

241+
cl := impl.ConvertClusterBeanObjectToCluster(bean)
242+
_, err = impl.argoCDClientWrapper.CreateCluster(ctx, &cluster3.ClusterCreateRequest{Upsert: true, Cluster: cl})
270243
if err != nil {
271244
impl.logger.Errorw("service err, Update", "error", err, "payload", cl)
272245
userMsg := "failed to update on cluster via ACD"
@@ -351,7 +324,7 @@ func (impl *ClusterServiceImplExtended) Save(ctx context.Context, bean *bean.Clu
351324
return nil, err
352325
}
353326

354-
// if git-ops configured, then only add cluster in ACD, otherwise ignore
327+
// if git-ops configured and ArgoCD module is installed, then only add cluster in ACD, otherwise ignore
355328
if gitOpsConfigurationStatus.IsGitOpsConfiguredAndArgoCdInstalled() {
356329
//create it into argo cd as well
357330
cl := impl.ConvertClusterBeanObjectToCluster(bean)

pkg/cluster/repository/ClusterRepository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (impl ClusterRepositoryImpl) FindByClusterURL(clusterURL string) (*Cluster,
212212
err := impl.dbConnection.
213213
Model(cluster).
214214
Where("server_url =?", clusterURL).
215-
Where("active =?", true).
215+
Where("active =?", true).Order("id DESC").Limit(1).
216216
Select()
217217
return cluster, err
218218
}

vendor/modules.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,15 @@ github.com/davecgh/go-spew/spew
342342
# github.com/deckarep/golang-set v1.8.0
343343
## explicit; go 1.17
344344
github.com/deckarep/golang-set
345-
# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2
345+
# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174
346346
## explicit; go 1.21
347347
github.com/devtron-labs/authenticator/apiToken
348348
github.com/devtron-labs/authenticator/client
349349
github.com/devtron-labs/authenticator/jwt
350350
github.com/devtron-labs/authenticator/middleware
351351
github.com/devtron-labs/authenticator/oidc
352352
github.com/devtron-labs/authenticator/password
353-
# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2
353+
# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174
354354
## explicit; go 1.21
355355
github.com/devtron-labs/common-lib/async
356356
github.com/devtron-labs/common-lib/blob-storage
@@ -2226,8 +2226,8 @@ xorm.io/xorm/log
22262226
xorm.io/xorm/names
22272227
xorm.io/xorm/schemas
22282228
xorm.io/xorm/tags
2229-
# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2
2230-
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2
2229+
# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174
2230+
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174
22312231
# github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
22322232
# github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
22332233
# k8s.io/api => k8s.io/api v0.29.7

0 commit comments

Comments
 (0)