Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
42 changes: 25 additions & 17 deletions pkg/appStore/deployment/service/InstalledAppService.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
util3 "github.com/devtron-labs/devtron/util"
"github.com/devtron-labs/devtron/util/argo"
"github.com/tidwall/gjson"
"k8s.io/apimachinery/pkg/version"
"net/http"
"regexp"
"sync"
Expand Down Expand Up @@ -947,23 +948,7 @@ func (impl *InstalledAppServiceImpl) FindNotesForArgoApplication(installedAppId,
impl.logger.Errorw("exception caught in getting k8sServerVersion", "err", err)
return notes, appName, err
}

installReleaseRequest := &client.InstallReleaseRequest{
ChartName: appStoreAppVersion.Name,
ChartVersion: appStoreAppVersion.Version,
ValuesYaml: installedAppVerison.ValuesYaml,
K8SVersion: k8sServerVersion.String(),
ChartRepository: &client.ChartRepository{
Name: appStoreAppVersion.AppStore.ChartRepo.Name,
Url: appStoreAppVersion.AppStore.ChartRepo.Url,
Username: appStoreAppVersion.AppStore.ChartRepo.UserName,
Password: appStoreAppVersion.AppStore.ChartRepo.Password,
},
ReleaseIdentifier: &client.ReleaseIdentifier{
ReleaseNamespace: installedAppVerison.InstalledApp.Environment.Namespace,
ReleaseName: installedAppVerison.InstalledApp.App.AppName,
},
}
installReleaseRequest := setInstallReleaseRequest(appStoreAppVersion, installedAppVerison, k8sServerVersion)

clusterId := installedAppVerison.InstalledApp.Environment.ClusterId
config, err := impl.helmAppService.GetClusterConf(clusterId)
Expand All @@ -988,6 +973,29 @@ func (impl *InstalledAppServiceImpl) FindNotesForArgoApplication(installedAppId,
return notes, appName, nil
}

func setInstallReleaseRequest(appStoreAppVersion *appStoreDiscoverRepository.AppStoreApplicationVersion, installedAppVerison *repository2.InstalledAppVersions, k8sServerVersion *version.Info) *client.InstallReleaseRequest {
installReleaseRequest := &client.InstallReleaseRequest{
ChartName: appStoreAppVersion.Name,
ChartVersion: appStoreAppVersion.Version,
ValuesYaml: installedAppVerison.ValuesYaml,
K8SVersion: k8sServerVersion.String(),
ChartRepository: &client.ChartRepository{
Name: appStoreAppVersion.AppStore.ChartRepo.Name,
Url: appStoreAppVersion.AppStore.ChartRepo.Url,
Username: appStoreAppVersion.AppStore.ChartRepo.UserName,
Password: appStoreAppVersion.AppStore.ChartRepo.Password,
},
ReleaseIdentifier: &client.ReleaseIdentifier{
ReleaseNamespace: installedAppVerison.InstalledApp.Environment.Namespace,
ReleaseName: installedAppVerison.InstalledApp.App.AppName,
ClusterConfig: &client.ClusterConfig{
ClusterId: int32(installedAppVerison.InstalledApp.Environment.ClusterId),
},
},
}
return installReleaseRequest
}

func (impl InstalledAppServiceImpl) GetInstalledAppVersionHistory(installedAppId int) (*appStoreBean.InstallAppVersionHistoryDto, error) {
result := &appStoreBean.InstallAppVersionHistoryDto{}
var history []*appStoreBean.IAVHistory
Expand Down
30 changes: 15 additions & 15 deletions pkg/bean/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ const (
)

const (
NORMAL PipelineType = "NORMAL"
LINKED PipelineType = "LINKED"
EXTERNAL PipelineType = "EXTERNAL"
CI_JOB PipelineType = "CI_JOB"
NORMAL PipelineType = "NORMAL"
LINKED PipelineType = "LINKED"
EXTERNAL PipelineType = "EXTERNAL"
CI_JOB PipelineType = "CI_JOB"
)

const (
Expand Down Expand Up @@ -272,16 +272,16 @@ type CiMaterialPatchResponse struct {
}

type CiPatchRequest struct {
CiPipeline *CiPipeline `json:"ciPipeline"`
AppId int `json:"appId,omitempty"`
Action PatchAction `json:"action"`
AppWorkflowId int `json:"appWorkflowId,omitempty"`
UserId int32 `json:"-"`
IsJob bool `json:"-"`
IsCloneJob bool `json:"isCloneJob,omitempty"`

ParentCDPipeline int `json:"parentCDPipeline"`
DeployEnvId int `json:"deployEnvId"`
CiPipeline *CiPipeline `json:"ciPipeline"`
AppId int `json:"appId,omitempty"`
Action PatchAction `json:"action"`
AppWorkflowId int `json:"appWorkflowId,omitempty"`
UserId int32 `json:"-"`
IsJob bool `json:"-"`
IsCloneJob bool `json:"isCloneJob,omitempty"`

ParentCDPipeline int `json:"parentCDPipeline"`
DeployEnvId int `json:"deployEnvId"`
SwitchFromCiPipelineId int `json:"switchFromCiPipelineId"`
SwitchFromExternalCiPipelineId int `json:"switchFromExternalCiPipelineId"`
SwitchFromCiPipelineType PipelineType `json:"-"`
Expand Down Expand Up @@ -368,7 +368,7 @@ type CiConfigRequest struct {
CiGitMaterialId int `json:"ciGitConfiguredId"`
IsCloneJob bool `json:"isCloneJob,omitempty"`
AppWorkflowMapping *appWorkflow.AppWorkflowMapping `json:"-"`
Artifact *repository3.CiArtifact `json:"-"`
Artifact *repository3.CiArtifact `json:"-"`
}

type CiPipelineMinResponse struct {
Expand Down
5 changes: 3 additions & 2 deletions pkg/cluster/ClusterService.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type PrometheusAuth struct {
Password string `json:"password,omitempty"`
TlsClientCert string `json:"tlsClientCert,omitempty"`
TlsClientKey string `json:"tlsClientKey,omitempty"`
IsAnonymous bool `json:"isAnonymous"`
}

type ClusterBean struct {
Expand Down Expand Up @@ -493,10 +494,10 @@ func (impl *ClusterServiceImpl) Update(ctx context.Context, bean *ClusterBean, u
model.PrometheusEndpoint = bean.PrometheusUrl

if bean.PrometheusAuth != nil {
if bean.PrometheusAuth.UserName != "" {
if bean.PrometheusAuth.UserName != "" || bean.PrometheusAuth.IsAnonymous {
model.PUserName = bean.PrometheusAuth.UserName
}
if bean.PrometheusAuth.Password != "" {
if bean.PrometheusAuth.Password != "" || bean.PrometheusAuth.IsAnonymous {
model.PPassword = bean.PrometheusAuth.Password
}
if bean.PrometheusAuth.TlsClientCert != "" {
Expand Down