From ede8502b0a575bc60d22d04460e2d62faec7ee63 Mon Sep 17 00:00:00 2001 From: SATYAsasini Date: Mon, 6 Apr 2026 15:22:05 +0530 Subject: [PATCH] sync: common-lib sync for native sidecar container --- go.mod | 4 ++-- go.sum | 8 ++++---- .../common-lib/utils/k8s/health/health_pod.go | 14 ++++++++++++++ .../utils/k8sObjectsUtil/ResourceTreeUtil.go | 14 ++++++++++++++ vendor/modules.txt | 8 ++++---- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index a509f3e0fa..c47a61b214 100644 --- a/go.mod +++ b/go.mod @@ -338,7 +338,7 @@ require ( replace ( github.com/argoproj/argo-workflows/v3 v3.5.13 => github.com/devtron-labs/argo-workflows/v3 v3.5.13 github.com/cyphar/filepath-securejoin v0.4.1 => github.com/cyphar/filepath-securejoin v0.3.6 // indirect - github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20251217072923-a2f0562a9b35 - github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072923-a2f0562a9b35 + github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20260406084546-2a6a635d1588 + github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260406084546-2a6a635d1588 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 ) diff --git a/go.sum b/go.sum index d000d25122..320fbd2fff 100644 --- a/go.sum +++ b/go.sum @@ -237,10 +237,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-20251217072923-a2f0562a9b35 h1:RUzuJvbT4d8bE94GTl9TbP5h3H5iA2RAPJJt9ip0n1c= -github.com/devtron-labs/devtron-services/authenticator v0.0.0-20251217072923-a2f0562a9b35/go.mod h1:9LCkYfiWaEKIBkmxw9jX1GujvEMyHwmDtVsatffAkeU= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072923-a2f0562a9b35 h1:hEVPoB3ndscqPxZUVGDj9PU8AMjYrCTiie9YnsMNRnE= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072923-a2f0562a9b35/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20260406084546-2a6a635d1588 h1:hZTy+JdBxgPRCaSPBpjC/HMWI7nk7Znoiv3sA0UB2+8= +github.com/devtron-labs/devtron-services/authenticator v0.0.0-20260406084546-2a6a635d1588/go.mod h1:9LCkYfiWaEKIBkmxw9jX1GujvEMyHwmDtVsatffAkeU= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260406084546-2a6a635d1588 h1:Fvt92n5ChmJ9wzzpllLhAKNHuP0zr8wf60S75/vs+ww= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260406084546-2a6a635d1588/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= 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= diff --git a/vendor/github.com/devtron-labs/common-lib/utils/k8s/health/health_pod.go b/vendor/github.com/devtron-labs/common-lib/utils/k8s/health/health_pod.go index d066f20cfa..e2670f6803 100644 --- a/vendor/github.com/devtron-labs/common-lib/utils/k8s/health/health_pod.go +++ b/vendor/github.com/devtron-labs/common-lib/utils/k8s/health/health_pod.go @@ -61,6 +61,20 @@ func getCorev1PodHealth(pod *corev1.Pod) (*HealthStatus, error) { } } + for i, cs := range pod.Status.InitContainerStatuses { + if i < len(pod.Spec.InitContainers) && + pod.Spec.InitContainers[i].RestartPolicy != nil && + *pod.Spec.InitContainers[i].RestartPolicy == corev1.ContainerRestartPolicyAlways { + waiting := cs.State.Waiting + if waiting != nil && (strings.HasPrefix(waiting.Reason, "Err") || + strings.HasSuffix(waiting.Reason, "Error") || + strings.HasSuffix(waiting.Reason, "BackOff")) { + status = HealthStatusDegraded + messages = append(messages, waiting.Message) + } + } + } + if status != "" { return &HealthStatus{ Status: status, diff --git a/vendor/github.com/devtron-labs/common-lib/utils/k8sObjectsUtil/ResourceTreeUtil.go b/vendor/github.com/devtron-labs/common-lib/utils/k8sObjectsUtil/ResourceTreeUtil.go index c2ce6260af..e271541867 100644 --- a/vendor/github.com/devtron-labs/common-lib/utils/k8sObjectsUtil/ResourceTreeUtil.go +++ b/vendor/github.com/devtron-labs/common-lib/utils/k8sObjectsUtil/ResourceTreeUtil.go @@ -217,6 +217,10 @@ func PopulatePodInfo(un *unstructured.Unstructured) ([]commonBean.InfoItem, erro initializing := false for i := range pod.Status.InitContainerStatuses { + if pod.Spec.InitContainers[i].RestartPolicy != nil && + *pod.Spec.InitContainers[i].RestartPolicy == v1.ContainerRestartPolicyAlways { + continue // native sidecar — not a blocking init container + } container := pod.Status.InitContainerStatuses[i] restarts += int(container.RestartCount) switch { @@ -243,6 +247,16 @@ func PopulatePodInfo(un *unstructured.Unstructured) ([]commonBean.InfoItem, erro } break } + for i, cs := range pod.Status.InitContainerStatuses { + if pod.Spec.InitContainers[i].RestartPolicy != nil && + *pod.Spec.InitContainers[i].RestartPolicy == v1.ContainerRestartPolicyAlways { + totalContainers++ + restarts += int(cs.RestartCount) + if cs.Ready && cs.State.Running != nil { + readyContainers++ + } + } + } if !initializing { restarts = 0 hasRunning := false diff --git a/vendor/modules.txt b/vendor/modules.txt index 1e282737fd..7184db669b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -523,7 +523,7 @@ 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-20251217072923-a2f0562a9b35 +# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20260406084546-2a6a635d1588 ## explicit; go 1.24.0 github.com/devtron-labs/authenticator/apiToken github.com/devtron-labs/authenticator/client @@ -531,7 +531,7 @@ 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-20251217072923-a2f0562a9b35 +# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260406084546-2a6a635d1588 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/async github.com/devtron-labs/common-lib/blob-storage @@ -2675,5 +2675,5 @@ 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-20251217072923-a2f0562a9b35 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072923-a2f0562a9b35 +# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20260406084546-2a6a635d1588 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260406084546-2a6a635d1588