Skip to content

Commit

Permalink
fix: introduced setting of apiVersion becuase it is missing..
Browse files Browse the repository at this point in the history
  • Loading branch information
mogenius git-user committed Apr 3, 2024
1 parent 9877c36 commit 34a44d7
Show file tree
Hide file tree
Showing 35 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kubernetes/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/cluster-role-bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/cluster-roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/clusterIssuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/cronjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/csr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/daemonsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
3 changes: 3 additions & 0 deletions kubernetes/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}

Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/ingressClass.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down
2 changes: 2 additions & 0 deletions kubernetes/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/leases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down
2 changes: 2 additions & 0 deletions kubernetes/networkpolicies.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/persistent-volume-claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/persistent-volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions kubernetes/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/priorityclasses.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/replicasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down
Loading

0 comments on commit 34a44d7

Please sign in to comment.