From 34a44d714c97ea9e18b14bfc9fd215d56f53e768 Mon Sep 17 00:00:00 2001 From: mogenius git-user Date: Wed, 3 Apr 2024 14:15:43 +0200 Subject: [PATCH] fix: introduced setting of apiVersion becuase it is missing.. --- kubernetes/certificates.go | 2 ++ kubernetes/cluster-role-bindings.go | 2 ++ kubernetes/cluster-roles.go | 2 ++ kubernetes/clusterIssuer.go | 2 ++ kubernetes/configmap.go | 2 ++ kubernetes/cronjobs.go | 2 ++ kubernetes/csr.go | 2 ++ kubernetes/daemonsets.go | 2 ++ kubernetes/deployment.go | 3 +++ kubernetes/endpoints.go | 2 ++ kubernetes/events.go | 2 ++ kubernetes/hpa.go | 2 ++ kubernetes/ingress.go | 2 ++ kubernetes/ingressClass.go | 2 ++ kubernetes/issuer.go | 2 ++ kubernetes/jobs.go | 2 ++ kubernetes/leases.go | 2 ++ kubernetes/namespace.go | 2 ++ kubernetes/networkpolicies.go | 2 ++ kubernetes/orders.go | 2 ++ kubernetes/persistent-volume-claim.go | 2 ++ kubernetes/persistent-volume.go | 2 ++ kubernetes/pods.go | 1 + kubernetes/priorityclasses.go | 2 ++ kubernetes/replicasets.go | 2 ++ kubernetes/resourcequotas.go | 2 ++ kubernetes/role-bindings.go | 2 ++ kubernetes/roles.go | 2 ++ kubernetes/secret.go | 2 ++ kubernetes/service-accounts.go | 2 ++ kubernetes/service.go | 1 + kubernetes/statefulsets.go | 2 ++ kubernetes/storageClass.go | 2 ++ kubernetes/volume-attachments.go | 2 ++ kubernetes/volume-snapshots.go | 2 ++ 35 files changed, 69 insertions(+) diff --git a/kubernetes/certificates.go b/kubernetes/certificates.go index a0e62d9..77e2503 100644 --- a/kubernetes/certificates.go +++ b/kubernetes/certificates.go @@ -28,6 +28,7 @@ func AllCertificates(namespaceName string, contextId *string) []cmapi.Certificat for _, certificate := range certificatesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, certificate.ObjectMeta.Namespace) { certificate.Kind = "Certificate" + certificate.APIVersion = "cert-manager.io/v1" result = append(result, certificate) } } @@ -63,6 +64,7 @@ func AllK8sCertificates(namespaceName string, contextId *string) utils.K8sWorklo for _, certificate := range certificatesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, certificate.ObjectMeta.Namespace) { certificate.Kind = "Certificate" + certificate.APIVersion = "cert-manager.io/v1" result = append(result, certificate) } } diff --git a/kubernetes/cluster-role-bindings.go b/kubernetes/cluster-role-bindings.go index f59e76e..4acc66b 100644 --- a/kubernetes/cluster-role-bindings.go +++ b/kubernetes/cluster-role-bindings.go @@ -26,6 +26,7 @@ func AllClusterRoleBindings(contextId *string) []v1.ClusterRoleBinding { for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "ClusterRoleBinding" + role.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, role) } } @@ -48,6 +49,7 @@ func AllK8sClusterRoleBindings(contextId *string) utils.K8sWorkloadResult { for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "ClusterRoleBinding" + role.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, role) } } diff --git a/kubernetes/cluster-roles.go b/kubernetes/cluster-roles.go index 24f04f9..2f7ce62 100644 --- a/kubernetes/cluster-roles.go +++ b/kubernetes/cluster-roles.go @@ -29,6 +29,7 @@ func AllClusterRoles(contextId *string) []v1.ClusterRole { for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "ClusterRole" + role.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, role) } } @@ -51,6 +52,7 @@ func AllK8sClusterRoles(contextId *string) utils.K8sWorkloadResult { for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "ClusterRole" + role.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, role) } } diff --git a/kubernetes/clusterIssuer.go b/kubernetes/clusterIssuer.go index 146cefd..b9ef920 100644 --- a/kubernetes/clusterIssuer.go +++ b/kubernetes/clusterIssuer.go @@ -28,6 +28,7 @@ func AllClusterIssuers(contextId *string) []cmapi.ClusterIssuer { for _, issuer := range issuersList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, issuer.ObjectMeta.Namespace) { issuer.Kind = "ClusterIssuer" + issuer.APIVersion = "cert-manager.io/v1" result = append(result, issuer) } } @@ -50,6 +51,7 @@ func AllK8sClusterIssuers(contextId *string) utils.K8sWorkloadResult { for _, issuer := range issuersList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, issuer.ObjectMeta.Namespace) { issuer.Kind = "ClusterIssuer" + issuer.APIVersion = "cert-manager.io/v1" result = append(result, issuer) } } diff --git a/kubernetes/configmap.go b/kubernetes/configmap.go index 642e5ee..6a7c8c7 100644 --- a/kubernetes/configmap.go +++ b/kubernetes/configmap.go @@ -44,6 +44,7 @@ func AllConfigmaps(namespaceName string, contextId *string) []v1.ConfigMap { for _, configmap := range configmapList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, configmap.ObjectMeta.Namespace) { configmap.Kind = "ConfigMap" + configmap.APIVersion = "v1" result = append(result, configmap) } } @@ -66,6 +67,7 @@ func AllK8sConfigmaps(namespaceName string, contextId *string) utils.K8sWorkload for _, configmap := range configmapList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, configmap.ObjectMeta.Namespace) { configmap.Kind = "ConfigMap" + configmap.APIVersion = "v1" result = append(result, configmap) } } diff --git a/kubernetes/cronjobs.go b/kubernetes/cronjobs.go index 8ee1a24..86f6b45 100644 --- a/kubernetes/cronjobs.go +++ b/kubernetes/cronjobs.go @@ -28,6 +28,7 @@ func AllCronjobs(namespaceName string, contextId *string) []v1.CronJob { for _, cronJob := range cronJobList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, cronJob.ObjectMeta.Namespace) { cronJob.Kind = "CronJob" + cronJob.APIVersion = "batch/v1" result = append(result, cronJob) } } @@ -50,6 +51,7 @@ func AllK8sCronjobs(namespaceName string, contextId *string) utils.K8sWorkloadRe for _, cronJob := range cronJobList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, cronJob.ObjectMeta.Namespace) { cronJob.Kind = "CronJob" + cronJob.APIVersion = "batch/v1" result = append(result, cronJob) } } diff --git a/kubernetes/csr.go b/kubernetes/csr.go index 879e5dc..e188176 100644 --- a/kubernetes/csr.go +++ b/kubernetes/csr.go @@ -28,6 +28,7 @@ func AllCertificateSigningRequests(namespaceName string, contextId *string) []cm for _, certificate := range certificatesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, certificate.ObjectMeta.Namespace) { certificate.Kind = "CertificateSigningRequest" + certificate.APIVersion = "cert-manager.io/v1" result = append(result, certificate) } } @@ -50,6 +51,7 @@ func AllK8sCertificateSigningRequests(namespaceName string, contextId *string) u for _, certificate := range certificatesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, certificate.ObjectMeta.Namespace) { certificate.Kind = "CertificateSigningRequest" + certificate.APIVersion = "cert-manager.io/v1" result = append(result, certificate) } } diff --git a/kubernetes/daemonsets.go b/kubernetes/daemonsets.go index d86f467..f8d0935 100644 --- a/kubernetes/daemonsets.go +++ b/kubernetes/daemonsets.go @@ -28,6 +28,7 @@ func AllDaemonsets(namespaceName string, contextId *string) []v1.DaemonSet { for _, daemonset := range daemonsetList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, daemonset.ObjectMeta.Namespace) { daemonset.Kind = "DaemonSet" + daemonset.APIVersion = "apps/v1" result = append(result, daemonset) } } @@ -50,6 +51,7 @@ func AllK8sDaemonsets(namespaceName string, contextId *string) utils.K8sWorkload for _, daemonset := range daemonsetList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, daemonset.ObjectMeta.Namespace) { daemonset.Kind = "DaemonSet" + daemonset.APIVersion = "apps/v1" result = append(result, daemonset) } } diff --git a/kubernetes/deployment.go b/kubernetes/deployment.go index 0ae3d22..13f12ba 100644 --- a/kubernetes/deployment.go +++ b/kubernetes/deployment.go @@ -27,6 +27,7 @@ func AllDeployments(namespaceName string, contextId *string) []v1.Deployment { for _, deployment := range deploymentList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, deployment.ObjectMeta.Namespace) { deployment.Kind = "Deployment" + deployment.APIVersion = "apps/v1" result = append(result, deployment) } } @@ -47,6 +48,7 @@ func AllDeploymentsIncludeIgnored(namespaceName string, contextId *string) []v1. for _, deployment := range deploymentList.Items { deployment.Kind = "Deployment" + deployment.APIVersion = "apps/v1" result = append(result, deployment) } @@ -69,6 +71,7 @@ func AllK8sDeployments(namespaceName string, contextId *string) utils.K8sWorkloa for _, deployment := range deploymentList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, deployment.ObjectMeta.Namespace) { deployment.Kind = "Deployment" + deployment.APIVersion = "apps/v1" result = append(result, deployment) } } diff --git a/kubernetes/endpoints.go b/kubernetes/endpoints.go index 46354f6..b35adde 100644 --- a/kubernetes/endpoints.go +++ b/kubernetes/endpoints.go @@ -27,6 +27,7 @@ func AllEndpoints(namespaceName string, contextId *string) []corev1.Endpoints { for _, endpoint := range endpointList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, endpoint.ObjectMeta.Namespace) { endpoint.Kind = "Endpoints" + endpoint.APIVersion = "v1" result = append(result, endpoint) } } @@ -49,6 +50,7 @@ func AllK8sEndpoints(namespaceName string, contextId *string) utils.K8sWorkloadR for _, endpoint := range endpointList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, endpoint.ObjectMeta.Namespace) { endpoint.Kind = "Endpoints" + endpoint.APIVersion = "v1" result = append(result, endpoint) } } diff --git a/kubernetes/events.go b/kubernetes/events.go index 4bbeb7a..6e6976e 100644 --- a/kubernetes/events.go +++ b/kubernetes/events.go @@ -27,6 +27,7 @@ func AllEvents(namespaceName string, contextId *string) []v1Core.Event { for _, event := range eventList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, event.ObjectMeta.Namespace) { event.Kind = "Event" + event.APIVersion = "v1" result = append(result, event) } } @@ -49,6 +50,7 @@ func AllK8sEvents(namespaceName string, contextId *string) utils.K8sWorkloadResu for _, event := range eventList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, event.ObjectMeta.Namespace) { event.Kind = "Event" + event.APIVersion = "v1" result = append(result, event) } } diff --git a/kubernetes/hpa.go b/kubernetes/hpa.go index 922285d..04e7a3d 100644 --- a/kubernetes/hpa.go +++ b/kubernetes/hpa.go @@ -28,6 +28,7 @@ func AllHpas(namespaceName string, contextId *string) []v2.HorizontalPodAutoscal for _, hpa := range hpaList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, hpa.ObjectMeta.Namespace) { hpa.Kind = "HorizontalPodAutoscaler" + hpa.APIVersion = "autoscaling/v2" result = append(result, hpa) } } @@ -50,6 +51,7 @@ func AllK8sHpas(namespaceName string, contextId *string) utils.K8sWorkloadResult for _, hpa := range hpaList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, hpa.ObjectMeta.Namespace) { hpa.Kind = "HorizontalPodAutoscaler" + hpa.APIVersion = "autoscaling/v2" result = append(result, hpa) } } diff --git a/kubernetes/ingress.go b/kubernetes/ingress.go index c300615..e255e9d 100644 --- a/kubernetes/ingress.go +++ b/kubernetes/ingress.go @@ -31,6 +31,7 @@ func AllIngresses(namespaceName string, contextId *string) []v1.Ingress { for _, ingress := range ingressList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, ingress.ObjectMeta.Namespace) { ingress.Kind = "Ingress" + ingress.APIVersion = "networking.k8s.io/v1" result = append(result, ingress) } } @@ -53,6 +54,7 @@ func AllK8sIngresses(namespaceName string, contextId *string) utils.K8sWorkloadR for _, ingress := range ingressList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, ingress.ObjectMeta.Namespace) { ingress.Kind = "Ingress" + ingress.APIVersion = "networking.k8s.io/v1" result = append(result, ingress) } } diff --git a/kubernetes/ingressClass.go b/kubernetes/ingressClass.go index 99e4700..43e50ca 100644 --- a/kubernetes/ingressClass.go +++ b/kubernetes/ingressClass.go @@ -26,6 +26,7 @@ func AllIngressClasses(contextId *string) []v1.IngressClass { for _, ingress := range ingressList.Items { ingress.Kind = "IngressClass" + ingress.APIVersion = "networking.k8s.io/v1" result = append(result, ingress) } @@ -47,6 +48,7 @@ func AllK8sIngressClasses(contextId *string) utils.K8sWorkloadResult { for _, ingress := range ingressList.Items { ingress.Kind = "IngressClass" + ingress.APIVersion = "networking.k8s.io/v1" result = append(result, ingress) } diff --git a/kubernetes/issuer.go b/kubernetes/issuer.go index 739573c..844b8ed 100644 --- a/kubernetes/issuer.go +++ b/kubernetes/issuer.go @@ -28,6 +28,7 @@ func AllIssuer(namespaceName string, contextId *string) []cmapi.Issuer { for _, issuer := range issuersList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, issuer.ObjectMeta.Namespace) { issuer.Kind = "Issuer" + issuer.APIVersion = "cert-manager.io/v1" result = append(result, issuer) } } @@ -50,6 +51,7 @@ func AllK8sIssuer(namespaceName string, contextId *string) utils.K8sWorkloadResu for _, issuer := range issuersList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, issuer.ObjectMeta.Namespace) { issuer.Kind = "Issuer" + issuer.APIVersion = "cert-manager.io/v1" result = append(result, issuer) } } diff --git a/kubernetes/jobs.go b/kubernetes/jobs.go index 7741738..57ed120 100644 --- a/kubernetes/jobs.go +++ b/kubernetes/jobs.go @@ -28,6 +28,7 @@ func AllJobs(namespaceName string, contextId *string) []v1job.Job { for _, job := range jobList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, job.ObjectMeta.Namespace) { job.Kind = "Job" + job.APIVersion = "batch/v1" result = append(result, job) } } @@ -50,6 +51,7 @@ func AllK8sJobs(namespaceName string, contextId *string) utils.K8sWorkloadResult for _, job := range jobList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, job.ObjectMeta.Namespace) { job.Kind = "Job" + job.APIVersion = "batch/v1" result = append(result, job) } } diff --git a/kubernetes/leases.go b/kubernetes/leases.go index df4104b..2b89480 100644 --- a/kubernetes/leases.go +++ b/kubernetes/leases.go @@ -29,6 +29,7 @@ func AllLeases(namespaceName string, contextId *string) []v1.Lease { for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "Lease" + role.APIVersion = "coordination.k8s.io/v1" result = append(result, role) } } @@ -51,6 +52,7 @@ func AllK8sLeases(namespaceName string, contextId *string) utils.K8sWorkloadResu for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "Lease" + role.APIVersion = "coordination.k8s.io/v1" result = append(result, role) } } diff --git a/kubernetes/namespace.go b/kubernetes/namespace.go index 540682b..d63ec2f 100644 --- a/kubernetes/namespace.go +++ b/kubernetes/namespace.go @@ -52,6 +52,7 @@ func ListAllNamespace(contextId *string) []v1.Namespace { for _, namespace := range namespaceList.Items { namespace.Kind = "Namespace" + namespace.APIVersion = "v1" result = append(result, namespace) } @@ -75,6 +76,7 @@ func AllK8sNamespace(contextId *string) utils.K8sWorkloadResult { for _, namespace := range namespaceList.Items { namespace.Kind = "Namespace" + namespace.APIVersion = "v1" result = append(result, namespace) } diff --git a/kubernetes/networkpolicies.go b/kubernetes/networkpolicies.go index eda7484..4057ffb 100644 --- a/kubernetes/networkpolicies.go +++ b/kubernetes/networkpolicies.go @@ -28,6 +28,7 @@ func AllNetworkPolicies(namespaceName string, contextId *string) []v1.NetworkPol for _, netpol := range netPolist.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, netpol.ObjectMeta.Namespace) { netpol.Kind = "NetworkPolicy" + netpol.APIVersion = "networking.k8s.io/v1" result = append(result, netpol) } } @@ -50,6 +51,7 @@ func AllK8sNetworkPolicies(namespaceName string, contextId *string) utils.K8sWor for _, netpol := range netPolist.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, netpol.ObjectMeta.Namespace) { netpol.Kind = "NetworkPolicy" + netpol.APIVersion = "networking.k8s.io/v1" result = append(result, netpol) } } diff --git a/kubernetes/orders.go b/kubernetes/orders.go index 723dee7..bb9aeb6 100644 --- a/kubernetes/orders.go +++ b/kubernetes/orders.go @@ -28,6 +28,7 @@ func AllOrders(namespaceName string, contextId *string) []v1.Order { for _, order := range orderList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, order.ObjectMeta.Namespace) { order.Kind = "Order" + order.APIVersion = "acme.cert-manager.io/v1" result = append(result, order) } } @@ -50,6 +51,7 @@ func AllK8sOrders(namespaceName string, contextId *string) utils.K8sWorkloadResu for _, order := range orderList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, order.ObjectMeta.Namespace) { order.Kind = "Order" + order.APIVersion = "acme.cert-manager.io/v1" result = append(result, order) } } diff --git a/kubernetes/persistent-volume-claim.go b/kubernetes/persistent-volume-claim.go index 40421a1..3eb073e 100644 --- a/kubernetes/persistent-volume-claim.go +++ b/kubernetes/persistent-volume-claim.go @@ -27,6 +27,7 @@ func AllPersistentVolumeClaims(namespaceName string, contextId *string) []core.P for _, v := range pvList.Items { v.Kind = "PersistentVolumeClaim" + v.APIVersion = "v1" result = append(result, v) } @@ -56,6 +57,7 @@ func AllK8sPersistentVolumeClaims(namespaceName string, contextId *string) utils for _, v := range pvList.Items { v.Kind = "PersistentVolumeClaim" + v.APIVersion = "v1" result = append(result, v) } return WorkloadResult(result, nil) diff --git a/kubernetes/persistent-volume.go b/kubernetes/persistent-volume.go index 20179bf..38b2359 100644 --- a/kubernetes/persistent-volume.go +++ b/kubernetes/persistent-volume.go @@ -26,6 +26,7 @@ func AllPersistentVolumesRaw(contextId *string) []core.PersistentVolume { } for _, v := range pvList.Items { v.Kind = "PersistentVolume" + v.APIVersion = "v1" result = append(result, v) } @@ -47,6 +48,7 @@ func AllK8sPersistentVolumes(contextId *string) utils.K8sWorkloadResult { for _, v := range pvList.Items { v.Kind = "PersistentVolume" + v.APIVersion = "v1" result = append(result, v) } return WorkloadResult(result, nil) diff --git a/kubernetes/pods.go b/kubernetes/pods.go index 31de0e3..47b82ab 100644 --- a/kubernetes/pods.go +++ b/kubernetes/pods.go @@ -212,6 +212,7 @@ func AllPods(namespaceName string, contextId *string) []v1.Pod { for _, pod := range podsList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, pod.ObjectMeta.Namespace) { pod.Kind = "Pod" + pod.APIVersion = "v1" result = append(result, pod) } } diff --git a/kubernetes/priorityclasses.go b/kubernetes/priorityclasses.go index 623fd3e..4f318a5 100644 --- a/kubernetes/priorityclasses.go +++ b/kubernetes/priorityclasses.go @@ -29,6 +29,7 @@ func AllPriorityClasses(contextId *string) []v1.PriorityClass { for _, prioClass := range pcList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, prioClass.ObjectMeta.Namespace) { prioClass.Kind = "PriorityClass" + prioClass.APIVersion = "scheduling.k8s.io/v1" result = append(result, prioClass) } } @@ -51,6 +52,7 @@ func AllK8sPriorityClasses(contextId *string) utils.K8sWorkloadResult { for _, prioClass := range pcList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, prioClass.ObjectMeta.Namespace) { prioClass.Kind = "PriorityClass" + prioClass.APIVersion = "scheduling.k8s.io/v1" result = append(result, prioClass) } } diff --git a/kubernetes/replicasets.go b/kubernetes/replicasets.go index 53371f0..597346a 100644 --- a/kubernetes/replicasets.go +++ b/kubernetes/replicasets.go @@ -28,6 +28,7 @@ func AllReplicasets(namespaceName string, contextId *string) []v1.ReplicaSet { for _, replicaSet := range replicaSetList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, replicaSet.ObjectMeta.Namespace) { replicaSet.Kind = "ReplicaSet" + replicaSet.APIVersion = "apps/v1" result = append(result, replicaSet) } } @@ -58,6 +59,7 @@ func AllK8sReplicasets(namespaceName string, contextId *string) utils.K8sWorkloa for _, replicaSet := range replicaSetList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, replicaSet.ObjectMeta.Namespace) { replicaSet.Kind = "ReplicaSet" + replicaSet.APIVersion = "apps/v1" result = append(result, replicaSet) } } diff --git a/kubernetes/resourcequotas.go b/kubernetes/resourcequotas.go index 2f3c30f..a7db98b 100644 --- a/kubernetes/resourcequotas.go +++ b/kubernetes/resourcequotas.go @@ -29,6 +29,7 @@ func AllResourceQuotas(namespaceName string, contextId *string) []core.ResourceQ for _, rq := range rqList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, rq.ObjectMeta.Namespace) { rq.Kind = "ResourceQuota" + rq.APIVersion = "v1" result = append(result, rq) } } @@ -51,6 +52,7 @@ func AllK8sResourceQuotas(namespaceName string, contextId *string) utils.K8sWork for _, rq := range rqList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, rq.ObjectMeta.Namespace) { rq.Kind = "ResourceQuota" + rq.APIVersion = "v1" result = append(result, rq) } } diff --git a/kubernetes/role-bindings.go b/kubernetes/role-bindings.go index 9a00249..6642c15 100644 --- a/kubernetes/role-bindings.go +++ b/kubernetes/role-bindings.go @@ -28,6 +28,7 @@ func AllRoleBindings(namespaceName string, contextId *string) []v1.RoleBinding { for _, roleBinding := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, roleBinding.ObjectMeta.Namespace) { roleBinding.Kind = "RoleBinding" + roleBinding.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, roleBinding) } } @@ -50,6 +51,7 @@ func AllK8sRoleBindings(namespaceName string, contextId *string) utils.K8sWorklo for _, roleBinding := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, roleBinding.ObjectMeta.Namespace) { roleBinding.Kind = "RoleBinding" + roleBinding.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, roleBinding) } } diff --git a/kubernetes/roles.go b/kubernetes/roles.go index ece18db..b273ec3 100644 --- a/kubernetes/roles.go +++ b/kubernetes/roles.go @@ -28,6 +28,7 @@ func AllRoles(namespaceName string, contextId *string) []v1.Role { for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "Role" + role.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, role) } } @@ -50,6 +51,7 @@ func AllK8sRoles(namespaceName string, contextId *string) utils.K8sWorkloadResul for _, role := range rolesList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, role.ObjectMeta.Namespace) { role.Kind = "Role" + role.APIVersion = "rbac.authorization.k8s.io/v1" result = append(result, role) } } diff --git a/kubernetes/secret.go b/kubernetes/secret.go index 3c57f59..c6c37c8 100644 --- a/kubernetes/secret.go +++ b/kubernetes/secret.go @@ -30,6 +30,7 @@ func AllSecrets(namespaceName string, contextId *string) []v1.Secret { for _, secret := range secretList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, secret.ObjectMeta.Namespace) { secret.Kind = "Secret" + secret.APIVersion = "v1" result = append(result, secret) } } @@ -98,6 +99,7 @@ func AllK8sSecrets(namespaceName string, contextId *string) utils.K8sWorkloadRes for _, secret := range secretList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, secret.ObjectMeta.Namespace) { secret.Kind = "Secret" + secret.APIVersion = "v1" result = append(result, secret) } } diff --git a/kubernetes/service-accounts.go b/kubernetes/service-accounts.go index ecae598..e551fc6 100644 --- a/kubernetes/service-accounts.go +++ b/kubernetes/service-accounts.go @@ -29,6 +29,7 @@ func AllServiceAccounts(namespaceName string, contextId *string) []v1.ServiceAcc for _, srvAcc := range srvAccList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, srvAcc.ObjectMeta.Namespace) { srvAcc.Kind = "ServiceAccount" + srvAcc.APIVersion = "v1" result = append(result, srvAcc) } } @@ -51,6 +52,7 @@ func AllK8sServiceAccounts(namespaceName string, contextId *string) utils.K8sWor for _, srvAcc := range srvAccList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, srvAcc.ObjectMeta.Namespace) { srvAcc.Kind = "ServiceAccount" + srvAcc.APIVersion = "v1" result = append(result, srvAcc) } } diff --git a/kubernetes/service.go b/kubernetes/service.go index 9a6e55d..b85d50f 100644 --- a/kubernetes/service.go +++ b/kubernetes/service.go @@ -63,6 +63,7 @@ func AllServices(namespaceName string, contextId *string) []v1.Service { for _, service := range serviceList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, service.ObjectMeta.Namespace) { service.Kind = "Service" + service.APIVersion = "v1" result = append(result, service) } } diff --git a/kubernetes/statefulsets.go b/kubernetes/statefulsets.go index 092e720..272c0f4 100644 --- a/kubernetes/statefulsets.go +++ b/kubernetes/statefulsets.go @@ -28,6 +28,7 @@ func AllK8sStatefulSets(namespaceName string, contextId *string) []v1.StatefulSe for _, statefulSet := range statefulSetList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, statefulSet.ObjectMeta.Namespace) { statefulSet.Kind = "StatefulSet" + statefulSet.APIVersion = "apps/v1" result = append(result, statefulSet) } } @@ -50,6 +51,7 @@ func AllStatefulSets(namespaceName string, contextId *string) utils.K8sWorkloadR for _, statefulSet := range statefulSetList.Items { if !utils.Contains(utils.CONFIG.Misc.IgnoreNamespaces, statefulSet.ObjectMeta.Namespace) { statefulSet.Kind = "StatefulSet" + statefulSet.APIVersion = "apps/v1" result = append(result, statefulSet) } } diff --git a/kubernetes/storageClass.go b/kubernetes/storageClass.go index 5b0f313..ac68145 100644 --- a/kubernetes/storageClass.go +++ b/kubernetes/storageClass.go @@ -27,6 +27,7 @@ func AllStorageClasses(contextId *string) []storage.StorageClass { for _, v := range scList.Items { v.Kind = "StorageClass" + v.APIVersion = "storage.k8s.io/v1" result = append(result, v) } return result @@ -47,6 +48,7 @@ func AllK8sStorageClasses(contextId *string) utils.K8sWorkloadResult { for _, v := range scList.Items { v.Kind = "StorageClass" + v.APIVersion = "storage.k8s.io/v1" result = append(result, v) } return WorkloadResult(result, nil) diff --git a/kubernetes/volume-attachments.go b/kubernetes/volume-attachments.go index 4321daf..c8d8597 100644 --- a/kubernetes/volume-attachments.go +++ b/kubernetes/volume-attachments.go @@ -26,6 +26,7 @@ func AllVolumeAttachments(contextId *string) []storage.VolumeAttachment { for _, v := range volAttachList.Items { v.Kind = "VolumeAttachment" + v.APIVersion = "storage.k8s.io/v1" result = append(result, v) } return result @@ -46,6 +47,7 @@ func AllK8sVolumeAttachments(contextId *string) utils.K8sWorkloadResult { for _, v := range volAttachList.Items { v.Kind = "VolumeAttachment" + v.APIVersion = "storage.k8s.io/v1" result = append(result, v) } return WorkloadResult(result, nil) diff --git a/kubernetes/volume-snapshots.go b/kubernetes/volume-snapshots.go index 9af0b89..3e13a3d 100644 --- a/kubernetes/volume-snapshots.go +++ b/kubernetes/volume-snapshots.go @@ -26,6 +26,7 @@ func AllVolumeSnapshots(namespace string, contextId *string) []snap.VolumeSnapsh for _, v := range volSnapshotsList.Items { v.Kind = "VolumeSnapshot" + v.APIVersion = "snapshot.storage.k8s.io/v1" result = append(result, v) } return result @@ -46,6 +47,7 @@ func AllK8sVolumeSnapshots(namespace string, contextId *string) utils.K8sWorkloa for _, v := range volSnapshotsList.Items { v.Kind = "VolumeSnapshot" + v.APIVersion = "snapshot.storage.k8s.io/v1" result = append(result, v) } return WorkloadResult(result, nil)