mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-09-02 09:25:59 +00:00
fix: use apiVersion to disambiguate CRDs with same kind (#504)
When multiple CRDs share the same kind but different API groups (e.g. Traefik's Middleware under traefik.io and traefik.containo.us), the dashboard failed to look up the correct resource. Thread apiVersion through the resource fetch chain and use group-qualified kind (e.g. Widget.new.example.com) for kubectl lookups. Closes #504 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
62cf1dfc3e
commit
4fb2eb099a
@@ -159,7 +159,8 @@ func (h *HelmHandler) Resources(c *gin.Context) {
|
||||
if ns == "" {
|
||||
ns = c.Param("ns")
|
||||
}
|
||||
info, err := app.K8s.GetResourceInfo(obj.Kind, ns, obj.Name)
|
||||
kind := utils.QualifiedKind(obj.Kind, obj.APIVersion)
|
||||
info, err := app.K8s.GetResourceInfo(kind, ns, obj.Name)
|
||||
if err != nil {
|
||||
log.Warnf("Failed to get resource info for %s %s/%s: %+v", obj.Name, ns, obj.Name, err)
|
||||
info = &v1.Carp{}
|
||||
|
||||
@@ -47,7 +47,8 @@ func (h *KubeHandler) GetResourceInfo(c *gin.Context) {
|
||||
return // sets error inside
|
||||
}
|
||||
|
||||
res, err := app.K8s.GetResourceInfo(c.Param("kind"), qp.Namespace, qp.Name)
|
||||
kind := utils.QualifiedKind(c.Param("kind"), qp.APIVersion)
|
||||
res, err := app.K8s.GetResourceInfo(kind, qp.Namespace, qp.Name)
|
||||
if errors.IsNotFound(err) {
|
||||
res = &v12.Carp{Status: v12.CarpStatus{Phase: "NotFound", Message: err.Error()}}
|
||||
//_ = c.AbortWithError(http.StatusNotFound, err)
|
||||
@@ -160,7 +161,8 @@ func (h *KubeHandler) Describe(c *gin.Context) {
|
||||
return // sets error inside
|
||||
}
|
||||
|
||||
res, err := app.K8s.DescribeResource(c.Param("kind"), qp.Namespace, qp.Name)
|
||||
kind := utils.QualifiedKind(c.Param("kind"), qp.APIVersion)
|
||||
res, err := app.K8s.DescribeResource(kind, qp.Namespace, qp.Name)
|
||||
if err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user