Feat: add flags to disable slow health and latest version checks (#493) (#644)

* added more info to features.md

* added details to FEATURES.md

* .

* reset to last commit

* Update FEATURES.md

* feat: add flags to disable slow health and latest version checks

- Introduce --no-health and --no-latest CLI flags
- Support HD_NO_HEALTH and HD_NO_LATEST environment variables
- Skip slow k8s health checks and latest version fetching when flags are set
- Optimize frontend data fetching based on these flags

* chore: fix lint errors in InstalledPackageCard.tsx

* chore: remove accidental lockfile changes
This commit is contained in:
S Kumar Dhananjaya
2026-01-17 17:34:55 +05:30
committed by GitHub
parent 323a60fe31
commit 65a250e2a4
7 changed files with 26 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ export interface ApplicationStatus {
ClusterMode: boolean; ClusterMode: boolean;
CurVer: string; CurVer: string;
LatestVer: string; LatestVer: string;
NoHealth: boolean;
NoLatest: boolean;
} }
export interface KubectlContexts { export interface KubectlContexts {

View File

@@ -16,6 +16,7 @@ import { isNewerVersion } from "../../utils";
import type { LatestChartVersion } from "../../API/interfaces"; import type { LatestChartVersion } from "../../API/interfaces";
import useNavigateWithSearchParams from "../../hooks/useNavigateWithSearchParams"; import useNavigateWithSearchParams from "../../hooks/useNavigateWithSearchParams";
import { useInView } from "react-intersection-observer"; import { useInView } from "react-intersection-observer";
import { useGetApplicationStatus } from "../../API/other";
type InstalledPackageCardProps = { type InstalledPackageCardProps = {
release: Release; release: Release;
@@ -31,14 +32,17 @@ export default function InstalledPackageCard({
threshold: 0.3, threshold: 0.3,
triggerOnce: true, triggerOnce: true,
}); });
const { data: status } = useGetApplicationStatus();
const { data: latestVersionResult } = useGetLatestVersion(release.chartName, { const { data: latestVersionResult } = useGetLatestVersion(release.chartName, {
queryKey: ["chartName", release.chartName], queryKey: ["chartName", release.chartName],
enabled: !status?.NoLatest,
}); });
const { data: statusData = [], isLoading } = useQuery<ReleaseHealthStatus[]>({ const { data: statusData = [], isLoading } = useQuery<ReleaseHealthStatus[]>({
queryKey: ["resourceStatus", release], queryKey: ["resourceStatus", release],
queryFn: () => apiService.getResourceStatus({ release }), queryFn: () => apiService.getResourceStatus({ release }),
enabled: inView, enabled: inView && !status?.NoHealth,
}); });
const latestVersionData: LatestChartVersion | undefined = const latestVersionData: LatestChartVersion | undefined =

View File

@@ -104,6 +104,8 @@ export type Status = {
Analytics: boolean; Analytics: boolean;
CacheHitRatio: number; CacheHitRatio: number;
ClusterMode: boolean; ClusterMode: boolean;
NoHealth: boolean;
NoLatest: boolean;
}; };
export type ChartVersion = { export type ChartVersion = {

View File

@@ -34,6 +34,8 @@ type options struct {
Namespace string `short:"n" long:"namespace" description:"Namespace for HELM operations"` Namespace string `short:"n" long:"namespace" description:"Namespace for HELM operations"`
Devel bool `long:"devel" description:"Include development versions of charts"` Devel bool `long:"devel" description:"Include development versions of charts"`
LocalChart []string `long:"local-chart" description:"Specify location of local chart to include into UI"` LocalChart []string `long:"local-chart" description:"Specify location of local chart to include into UI"`
NoHealth bool `long:"no-health" description:"Disable health checks for installed charts"`
NoLatest bool `long:"no-latest" description:"Disable latest version checks for installed charts"`
} }
func main() { func main() {
@@ -62,6 +64,8 @@ func main() {
NoTracking: opts.NoTracking, NoTracking: opts.NoTracking,
Devel: opts.Devel, Devel: opts.Devel,
LocalCharts: opts.LocalChart, LocalCharts: opts.LocalChart,
NoHealth: opts.NoHealth,
NoLatest: opts.NoLatest,
} }
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())

View File

@@ -148,7 +148,7 @@ func (h *HelmHandler) Resources(c *gin.Context) {
//return //return
} }
if c.Query("health") != "" { // we need to query k8s for health status if c.Query("health") != "" && !h.Data.StatusInfo.NoHealth { // we need to query k8s for health status
app := h.GetApp(c) app := h.GetApp(c)
if app == nil { if app == nil {
_ = c.AbortWithError(http.StatusInternalServerError, err) _ = c.AbortWithError(http.StatusInternalServerError, err)
@@ -216,6 +216,11 @@ func (h *HelmHandler) RepoLatestVer(c *gin.Context) {
return // sets error inside return // sets error inside
} }
if h.Data.StatusInfo.NoLatest {
c.Status(http.StatusNoContent)
return
}
rep, err := app.Repositories.Containing(qp.Name) rep, err := app.Repositories.Containing(qp.Name)
if err != nil { if err != nil {
_ = c.AbortWithError(http.StatusInternalServerError, err) _ = c.AbortWithError(http.StatusInternalServerError, err)

View File

@@ -41,6 +41,8 @@ type StatusInfo struct {
Analytics bool Analytics bool
CacheHitRatio float64 CacheHitRatio float64
ClusterMode bool ClusterMode bool
NoHealth bool
NoLatest bool
} }
func NewDataLayer(ns []string, ver string, cg HelmConfigGetter, devel bool) (*DataLayer, error) { func NewDataLayer(ns []string, ver string, cg HelmConfigGetter, devel bool) (*DataLayer, error) {

View File

@@ -29,6 +29,8 @@ type Server struct {
NoTracking bool NoTracking bool
Devel bool Devel bool
LocalCharts []string LocalCharts []string
NoHealth bool
NoLatest bool
} }
func (s *Server) StartServer(ctx context.Context, cancel context.CancelFunc) (string, utils.ControlChan, error) { func (s *Server) StartServer(ctx context.Context, cancel context.CancelFunc) (string, utils.ControlChan, error) {
@@ -40,6 +42,9 @@ func (s *Server) StartServer(ctx context.Context, cancel context.CancelFunc) (st
data.LocalCharts = s.LocalCharts data.LocalCharts = s.LocalCharts
data.StatusInfo.Analytics = (!s.NoTracking && s.Version != "0.0.0") || utils.EnvAsBool("HD_DEV_ANALYTICS", false) data.StatusInfo.Analytics = (!s.NoTracking && s.Version != "0.0.0") || utils.EnvAsBool("HD_DEV_ANALYTICS", false)
data.StatusInfo.NoHealth = s.NoHealth || utils.EnvAsBool("HD_NO_HEALTH", false)
data.StatusInfo.NoLatest = s.NoLatest || utils.EnvAsBool("HD_NO_LATEST", false)
err = s.detectClusterMode(data) err = s.detectClusterMode(data)
if err != nil { if err != nil {
return "", nil, errorx.Decorate(err, "Failed to detect cluster mode") return "", nil, errorx.Decorate(err, "Failed to detect cluster mode")