Skip to content

misc: Merge remote-tracking branch 'main' into develop #6467

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 4 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
44 changes: 44 additions & 0 deletions api/helm-app/HelmAppRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type HelmAppRestHandler interface {
UpdateApplication(w http.ResponseWriter, r *http.Request)
TemplateChart(w http.ResponseWriter, r *http.Request)
SaveHelmAppDetailsViewedTelemetryData(w http.ResponseWriter, r *http.Request)
ListHelmApplicationsForEnvironment(w http.ResponseWriter, r *http.Request)
}

const HELM_APP_ACCESS_COUNTER = "HelmAppAccessCounter"
Expand Down Expand Up @@ -588,3 +589,46 @@ func (handler *HelmAppRestHandlerImpl) SaveHelmAppDetailsViewedTelemetryData(w h
common.WriteJsonResp(w, err, nil, http.StatusOK)

}

func (handler *HelmAppRestHandlerImpl) ListHelmApplicationsForEnvironment(w http.ResponseWriter, r *http.Request) {

query := r.URL.Query()

clusterIdString := query.Get("clusterId")
var (
clusterId int
envId int
err error
)

if len(clusterIdString) != 0 {
clusterId, err = strconv.Atoi(clusterIdString)
if err != nil {
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
}

envIdString := query.Get("envId")
if len(envIdString) != 0 {
envId, err = strconv.Atoi(envIdString)
if err != nil {
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
}

token := r.Header.Get("token")
if ok := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*"); !ok {
common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden)
return
}
releaseList, err := handler.helmAppService.ListHelmApplicationsForClusterOrEnv(r.Context(), clusterId, envId)
if err != nil {
handler.logger.Errorw("error in fetching helm release for given env", "err", err)
common.WriteJsonResp(w, err, "error in fetching helm release", http.StatusInternalServerError)
return
}
common.WriteJsonResp(w, nil, releaseList, http.StatusOK)
return
}
4 changes: 4 additions & 0 deletions api/helm-app/HelmAppRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func (impl *HelmAppRouterImpl) InitAppListRouter(helmRouter *mux.Router) {
helmRouter.Path("/hibernate").Queries("appType", "{appType}").HandlerFunc(impl.helmAppRestHandler.Hibernate).Methods("POST")
helmRouter.Path("/unhibernate").Queries("appType", "{appType}").HandlerFunc(impl.helmAppRestHandler.UnHibernate).Methods("POST")

helmRouter.Path("/external-helm-release").
HandlerFunc(impl.helmAppRestHandler.ListHelmApplicationsForEnvironment).
Methods("GET")

// GetReleaseInfo used only for external apps
helmRouter.Path("/release-info").Queries("appId", "{appId}").
HandlerFunc(impl.helmAppRestHandler.GetReleaseInfo).Methods("GET")
Expand Down
1 change: 1 addition & 0 deletions api/helm-app/bean/bean.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
SOURCE_DEVTRON_APP SourceAppType = "devtron-app"
SOURCE_HELM_APP SourceAppType = "helm-app"
SOURCE_EXTERNAL_HELM_APP SourceAppType = "external-helm-app"
SOURCE_LINKED_HELM_APP SourceAppType = "linked-helm-app"
SOURCE_UNKNOWN SourceAppType = "unknown"
ErrReleaseNotFound string = "release: not found"
)
Expand Down
14 changes: 14 additions & 0 deletions api/helm-app/gRPC/applicationClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type HelmAppClient interface {
InstallReleaseWithCustomChart(ctx context.Context, in *HelmInstallCustomRequest) (*HelmInstallCustomResponse, error)
GetNotes(ctx context.Context, request *InstallReleaseRequest) (*ChartNotesResponse, error)
ValidateOCIRegistry(ctx context.Context, OCIRegistryRequest *RegistryCredential) (*OCIRegistryResponse, error)
GetReleaseDetails(ctx context.Context, in *ReleaseIdentifier) (*DeployedAppDetail, error)
GetExternalFluxAppDetail(ctx context.Context, in *FluxAppDetailRequest) (*FluxAppDetail, error)
}

Expand Down Expand Up @@ -395,6 +396,19 @@ func (impl *HelmAppClientImpl) ListFluxApplication(ctx context.Context, req *App
}
return stream, nil
}

func (impl *HelmAppClientImpl) GetReleaseDetails(ctx context.Context, in *ReleaseIdentifier) (*DeployedAppDetail, error) {
applicationClient, err := impl.getApplicationClient()
if err != nil {
return nil, err
}
response, err := applicationClient.GetReleaseDetails(ctx, in)
if err != nil {
return nil, err
}
return response, nil
}

func (impl *HelmAppClientImpl) GetExternalFluxAppDetail(ctx context.Context, in *FluxAppDetailRequest) (*FluxAppDetail, error) {
applicationClient, err := impl.getApplicationClient()
if err != nil {
Expand Down
1,200 changes: 610 additions & 590 deletions api/helm-app/gRPC/applist.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions api/helm-app/gRPC/applist.proto
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ message DeployedAppDetail {
EnvironmentDetails environmentDetail = 5;
google.protobuf.Timestamp LastDeployed = 6;
string chartVersion = 7;
string releaseStatus = 8;
string home = 9;
}
message EnvironmentDetails{
string clusterName = 1;
Expand Down
131 changes: 80 additions & 51 deletions api/helm-app/gRPC/applist_grpc.pb.go

Large diffs are not rendered by default.

Loading
Loading