diff --git a/go.mod b/go.mod index c1e0c8b685..340affe566 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,7 @@ require ( kmodules.xyz/custom-resources v0.30.0 kmodules.xyz/go-containerregistry v0.0.12 kmodules.xyz/monitoring-agent-api v0.29.0 - kmodules.xyz/resource-metadata v0.18.13-0.20240904102543-ace8c94cfd3d + kmodules.xyz/resource-metadata v0.18.13-0.20240906124638-46438a4d2a94 kmodules.xyz/resource-metrics v0.30.4 kmodules.xyz/resource-metrics/utils v0.30.4 kmodules.xyz/sets v0.29.0 diff --git a/go.sum b/go.sum index 60e0c9cc18..2d00c52456 100644 --- a/go.sum +++ b/go.sum @@ -922,8 +922,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9 kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI= kmodules.xyz/offshoot-api v0.30.0 h1:dq9F93pu4Q8rL9oTcCk+vGGy8vpS7RNt0GSwx7Bvhec= kmodules.xyz/offshoot-api v0.30.0/go.mod h1:o9VoA3ImZMDBp3lpLb8+kc2d/KBxioRwCpaKDfLIyDw= -kmodules.xyz/resource-metadata v0.18.13-0.20240904102543-ace8c94cfd3d h1:2TzGz3I9AZ+Eb/0XY5hXsHcMCHkczlrkSE/lBEp002s= -kmodules.xyz/resource-metadata v0.18.13-0.20240904102543-ace8c94cfd3d/go.mod h1:KC8yk1AaAMRht7mLVPA6iP2U6n9qIAzR89I8IMejLgs= +kmodules.xyz/resource-metadata v0.18.13-0.20240906124638-46438a4d2a94 h1:bmvgJv6ZPyzy1+fqI7+6H3ACvEDuG+RKCdj4ryYJDlI= +kmodules.xyz/resource-metadata v0.18.13-0.20240906124638-46438a4d2a94/go.mod h1:KC8yk1AaAMRht7mLVPA6iP2U6n9qIAzR89I8IMejLgs= kmodules.xyz/resource-metrics v0.30.4 h1:8HBPtYmo9ETY91gsc55JE8Z986+3ZuRq57M0wZ9npqI= kmodules.xyz/resource-metrics v0.30.4/go.mod h1:w9+rz7/s/kGP1GWzYSuRdCn+l7EwpesmESSEHkLBnIQ= kmodules.xyz/resource-metrics/utils v0.30.4 h1:bJS/x0Qr7N1FFdxugFbzZ/Es6HVs4ptsFlhkmgj3jac= diff --git a/vendor/kmodules.xyz/resource-metadata/hub/menuoutlines/ace/ocm-hub.yaml b/vendor/kmodules.xyz/resource-metadata/hub/menuoutlines/ace/ocm-hub.yaml index cc71a5e477..8111064165 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/menuoutlines/ace/ocm-hub.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/menuoutlines/ace/ocm-hub.yaml @@ -84,6 +84,7 @@ spec: items: - name: User Permissions path: /access + required: true name: Access - icons: - src: https://cdn.appscode.com/k8s/icons/menu/helm.svg @@ -93,4 +94,5 @@ spec: items: - name: Issue License path: /license + required: true name: License diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps.k8s.appscode.com/v1/petsets.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps.k8s.appscode.com/v1/petsets.yaml index 6a51d9484e..e7fa04f5dc 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps.k8s.appscode.com/v1/petsets.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps.k8s.appscode.com/v1/petsets.yaml @@ -61,7 +61,7 @@ spec: - name: Images pathTemplate: '{{ .spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Service Name pathTemplate: '{{ .spec.serviceName }}' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/daemonsets.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/daemonsets.yaml index 94472e26ff..b537d37282 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/daemonsets.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/daemonsets.yaml @@ -73,7 +73,7 @@ spec: - name: Images pathTemplate: '{{ .spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Security Context pathTemplate: '{ "runAsUser": "{{ jp "{.spec.template.spec.securityContext.runAsUser}" . }}", "runAsGroup": "{{ jp "{.spec.template.spec.securityContext.runAsGroup}" . }}","fsGroup": "{{ jp "{.spec.template.spec.securityContext.fsGroup}" . }}" }' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/deployments.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/deployments.yaml index cf81f8e622..69e794ff8b 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/deployments.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/deployments.yaml @@ -61,7 +61,7 @@ spec: - name: Images pathTemplate: '{{ .spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Security Context pathTemplate: '{ "runAsUser": "{{ jp "{.spec.template.spec.securityContext.runAsUser}" . }}", "runAsGroup": "{{ jp "{.spec.template.spec.securityContext.runAsGroup}" . }}","fsGroup": "{{ jp "{.spec.template.spec.securityContext.fsGroup}" . }}" }' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/replicasets.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/replicasets.yaml index b66bc63ac3..59aea694ea 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/replicasets.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/replicasets.yaml @@ -49,7 +49,7 @@ spec: - name: Images pathTemplate: '{{ .spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Security Context pathTemplate: '{ "runAsUser": "{{ jp "{.spec.template.spec.securityContext.runAsUser}" . }}", "runAsGroup": "{{ jp "{.spec.template.spec.securityContext.runAsGroup}" . }}","fsGroup": "{{ jp "{.spec.template.spec.securityContext.fsGroup}" . }}" }' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/statefulsets.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/statefulsets.yaml index a54cb1f840..855a2b733b 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/statefulsets.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/apps/v1/statefulsets.yaml @@ -61,7 +61,7 @@ spec: - name: Images pathTemplate: '{{ .spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Service Name pathTemplate: '{{ .spec.serviceName }}' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/cronjobs.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/cronjobs.yaml index 1cb55b5802..b2a299527d 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/cronjobs.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/cronjobs.yaml @@ -45,7 +45,7 @@ spec: - name: Images pathTemplate: '{{ .spec.jobTemplate.spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Security Context pathTemplate: '{ "runAsUser": "{{ jp "{.spec.jobTemplate.spec.template.spec.securityContext.runAsUser}" . }}", "runAsGroup": "{{ jp "{.spec.jobTemplate.spec.template.spec.securityContext.runAsGroup}" . }}","fsGroup": "{{ jp "{.spec.jobTemplate.spec.template.spec.securityContext.fsGroup}" . }}" }' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/jobs.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/jobs.yaml index a508bd3c25..1f8c5a4a80 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/jobs.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1/jobs.yaml @@ -45,7 +45,7 @@ spec: - name: Images pathTemplate: '{{ .spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Security Context pathTemplate: '{ "runAsUser": "{{ jp "{.spec.template.spec.securityContext.runAsUser}" . }}", "runAsGroup": "{{ jp "{.spec.template.spec.securityContext.runAsGroup}" . }}","fsGroup": "{{ jp "{.spec.template.spec.securityContext.fsGroup}" . }}" }' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1beta1/cronjobs.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1beta1/cronjobs.yaml index 61ba1f96e7..71a9a84abc 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1beta1/cronjobs.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/batch/v1beta1/cronjobs.yaml @@ -45,7 +45,7 @@ spec: - name: Images pathTemplate: '{{ .spec.jobTemplate.spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Security Context pathTemplate: '{ "runAsUser": "{{ jp "{.spec.jobTemplate.spec.template.spec.securityContext.runAsUser}" . }}", "runAsGroup": "{{ jp "{.spec.jobTemplate.spec.template.spec.securityContext.runAsGroup}" . }}","fsGroup": "{{ jp "{.spec.jobTemplate.spec.template.spec.securityContext.fsGroup}" . }}" }' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/pods.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/pods.yaml index 33f4d8cc85..5db627432a 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/pods.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/pods.yaml @@ -54,7 +54,7 @@ spec: - name: Images pathTemplate: '{{ .spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Restart Policy pathTemplate: '{{ .spec.restartPolicy }}' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/replicationcontrollers.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/replicationcontrollers.yaml index 35ecfa8c66..344a4e8115 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/replicationcontrollers.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/replicationcontrollers.yaml @@ -49,7 +49,7 @@ spec: - name: Images pathTemplate: '{{ .spec.template.spec.containers | k8s_container_images }}' priority: 2 - type: string + type: object - name: Security Context pathTemplate: '{ "runAsUser": "{{ jp "{.spec.template.spec.securityContext.runAsUser}" . }}", "runAsGroup": "{{ jp "{.spec.template.spec.securityContext.runAsGroup}" . }}","fsGroup": "{{ jp "{.spec.template.spec.securityContext.fsGroup}" . }}" }' priority: 1 diff --git a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/services.yaml b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/services.yaml index b55df1f25d..1b614db874 100644 --- a/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/services.yaml +++ b/vendor/kmodules.xyz/resource-metadata/hub/resourcetabledefinitions/core/v1/services.yaml @@ -42,8 +42,9 @@ spec: priority: 2 type: string - name: Selector + pathTemplate: '{{ .spec.selector | toRawJson }}' priority: 3 - type: string + type: object - name: Age pathTemplate: '{{ .metadata.creationTimestamp | k8s_age }}' priority: 3 diff --git a/vendor/kmodules.xyz/resource-metadata/pkg/tableconvertor/templates.go b/vendor/kmodules.xyz/resource-metadata/pkg/tableconvertor/templates.go index f6d15e72a2..59d0ad5fcb 100644 --- a/vendor/kmodules.xyz/resource-metadata/pkg/tableconvertor/templates.go +++ b/vendor/kmodules.xyz/resource-metadata/pkg/tableconvertor/templates.go @@ -17,7 +17,6 @@ limitations under the License. package tableconvertor import ( - "bytes" "fmt" "strconv" "strings" @@ -328,27 +327,56 @@ func promNamespaceSelectorFn(data interface{}) (string, error) { } func containerImagesFn(data interface{}) (string, error) { - var containers []core.Container + var images []map[string]string + appendImage := func(name, image string) { + images = append(images, map[string]string{ + "container": name, + "image": image, + }) + } + if s, ok := data.(string); ok && s != "" { - err := json.Unmarshal([]byte(s), &containers) - if err != nil { - return "", err + var containers []map[string]interface{} + if err := json.Unmarshal([]byte(s), &containers); err != nil { + return "", fmt.Errorf("failed to unmarshal containers JSON: %w", err) + } + for _, container := range containers { + if name, ok := container["name"].(string); ok { + if image, ok := container["image"].(string); ok { + appendImage(name, image) + } + } } - } else if _, ok := data.(map[string]interface{}); ok { - err := meta_util.DecodeObject(data, &containers) - if err != nil { - return "", err + } else if m, ok := data.(map[string]interface{}); ok { + if containerList, ok := m["containers"].([]interface{}); ok { + for _, c := range containerList { + if container, ok := c.(map[string]interface{}); ok { + if name, ok := container["name"].(string); ok { + if image, ok := container["image"].(string); ok { + appendImage(name, image) + } + } + } + } + } + } else if slice, ok := data.([]interface{}); ok { + for _, item := range slice { + if container, ok := item.(map[string]interface{}); ok { + if name, ok := container["name"].(string); ok { + if image, ok := container["image"].(string); ok { + appendImage(name, image) + } + } + } } } - var imagesBuffer bytes.Buffer - for i, container := range containers { - imagesBuffer.WriteString(container.Image) - if i != len(containers)-1 { - imagesBuffer.WriteString(",") - } + imagesJSON, err := json.Marshal(images) + if err != nil { + return "", err } - return imagesBuffer.String(), nil + + return string(imagesJSON), nil } func durationFn(start interface{}, end ...interface{}) (string, error) { diff --git a/vendor/modules.txt b/vendor/modules.txt index 2ec9a88487..285ab84e95 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2011,7 +2011,7 @@ kmodules.xyz/monitoring-agent-api/client ## explicit; go 1.22.0 kmodules.xyz/offshoot-api/api/v1 kmodules.xyz/offshoot-api/api/v2 -# kmodules.xyz/resource-metadata v0.18.13-0.20240904102543-ace8c94cfd3d +# kmodules.xyz/resource-metadata v0.18.13-0.20240906124638-46438a4d2a94 ## explicit; go 1.22.1 kmodules.xyz/resource-metadata/apis/core/install kmodules.xyz/resource-metadata/apis/core/v1alpha1