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

+2-2
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

+4-4
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

+4-31
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

+1-1
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

+4-4
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)