Skip to content

sync: Main sync develop #6471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ require (

replace (
github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174
github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
k8s.io/api => k8s.io/api v0.29.7
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU=
github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA=
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2 h1:7jQYKn1eLMIn7QgV13bNhueU+CbbRaSBxkWp+Dp/GTo=
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2 h1:blntkjXNtvA1AccbAcM6TKV+WcbXNyIstSnhDtAfuI8=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174 h1:Tf3xomEdbSkgrxW9mUpuQ6W2f8ZX3rX1fwlY/evEWGU=
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174 h1:0ro/HoPor0pamglXYqe9Z4MlQsO3pyW94C/byzzsxig=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU=
github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y=
github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs=
Expand Down
35 changes: 4 additions & 31 deletions pkg/cluster/ClusterServiceExtended.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"time"

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

}

// if git-ops configured, then only update cluster in ACD, otherwise ignore
// if git-ops configured and ArgoCD module is installed, then only update cluster in ACD, otherwise ignore
if gitOpsConfigurationStatus.IsGitOpsConfiguredAndArgoCdInstalled() {
configMap := bean.Config
serverUrl := bean.ServerUrl
bearerToken := ""
if configMap[commonBean.BearerToken] != "" {
bearerToken = configMap[commonBean.BearerToken]
}

tlsConfig := v1alpha1.TLSClientConfig{
Insecure: bean.InsecureSkipTLSVerify,
}
if !bean.InsecureSkipTLSVerify {
tlsConfig.KeyData = []byte(configMap[commonBean.TlsKey])
tlsConfig.CertData = []byte(configMap[commonBean.CertData])
tlsConfig.CAData = []byte(configMap[commonBean.CertificateAuthorityData])
}

cdClusterConfig := v1alpha1.ClusterConfig{
BearerToken: bearerToken,
TLSClientConfig: tlsConfig,
}

cl := &v1alpha1.Cluster{
Name: bean.ClusterName,
Server: serverUrl,
Config: cdClusterConfig,
}

_, err = impl.argoCDClientWrapper.UpdateCluster(ctx, &cluster3.ClusterUpdateRequest{Cluster: cl})

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

// if git-ops configured, then only add cluster in ACD, otherwise ignore
// if git-ops configured and ArgoCD module is installed, then only add cluster in ACD, otherwise ignore
if gitOpsConfigurationStatus.IsGitOpsConfiguredAndArgoCdInstalled() {
//create it into argo cd as well
cl := impl.ConvertClusterBeanObjectToCluster(bean)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/repository/ClusterRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (impl ClusterRepositoryImpl) FindByClusterURL(clusterURL string) (*Cluster,
err := impl.dbConnection.
Model(cluster).
Where("server_url =?", clusterURL).
Where("active =?", true).
Where("active =?", true).Order("id DESC").Limit(1).
Select()
return cluster, err
}
8 changes: 4 additions & 4 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,15 @@ github.com/davecgh/go-spew/spew
# github.com/deckarep/golang-set v1.8.0
## explicit; go 1.17
github.com/deckarep/golang-set
# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2
# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174
## explicit; go 1.21
github.com/devtron-labs/authenticator/apiToken
github.com/devtron-labs/authenticator/client
github.com/devtron-labs/authenticator/jwt
github.com/devtron-labs/authenticator/middleware
github.com/devtron-labs/authenticator/oidc
github.com/devtron-labs/authenticator/password
# 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
# 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
## explicit; go 1.21
github.com/devtron-labs/common-lib/async
github.com/devtron-labs/common-lib/blob-storage
Expand Down Expand Up @@ -2226,8 +2226,8 @@ xorm.io/xorm/log
xorm.io/xorm/names
xorm.io/xorm/schemas
xorm.io/xorm/tags
# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250317062447-742cf1539ee2
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250317062447-742cf1539ee2
# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250324113450-bdbee9063174
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250324113450-bdbee9063174
# github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
# github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
# k8s.io/api => k8s.io/api v0.29.7
Expand Down
Loading