Skip to content

Commit

Permalink
Fix not found error and fix column name backend -> `default_backend…
Browse files Browse the repository at this point in the history
…` in `kubernetes_ingress` table. Fixes #91 (#98)

Even though there is a column rename, the `backend` column was checking the incorrect property name and thus had no data, so we are treating the rename as a bug fix instead.
  • Loading branch information
bigdatasourav authored Jan 4, 2023
1 parent 8a665d6 commit a058ca5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions kubernetes/table_kubernetes_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"strings"

"k8s.io/api/extensions/v1beta1"
v1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
Expand Down Expand Up @@ -33,10 +33,10 @@ func tableKubernetesIngress(ctx context.Context) *plugin.Table {
Transform: transform.FromField("Spec.IngressClassName"),
},
{
Name: "backend",
Name: "default_backend",
Type: proto.ColumnType_JSON,
Description: "A default backend capable of servicing requests that don't match any rule. At least one of 'backend' or 'rules' must be specified.",
Transform: transform.FromField("Spec.Backend"),
Transform: transform.FromField("Spec.DefaultBackend"),
},
{
Name: "tls",
Expand Down Expand Up @@ -109,11 +109,11 @@ func listK8sIngresses(ctx context.Context, d *plugin.QueryData, _ *plugin.Hydrat
}
}

var response *v1beta1.IngressList
var response *v1.IngressList
pageLeft := true

for pageLeft {
response, err = clientset.ExtensionsV1beta1().Ingresses("").List(ctx, input)
response, err = clientset.NetworkingV1().Ingresses("").List(ctx, input)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func getK8sIngress(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDa
return nil, nil
}

ingress, err := clientset.ExtensionsV1beta1().Ingresses(namespace).Get(ctx, name, metav1.GetOptions{})
ingress, err := clientset.NetworkingV1().Ingresses(namespace).Get(ctx, name, metav1.GetOptions{})
if err != nil && !isNotFoundError(err) {
return nil, err
}
Expand All @@ -165,6 +165,6 @@ func getK8sIngress(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDa
//// TRANSFORM FUNCTIONS

func transformIngressTags(_ context.Context, d *transform.TransformData) (interface{}, error) {
obj := d.HydrateItem.(v1beta1.Ingress)
obj := d.HydrateItem.(v1.Ingress)
return mergeTags(obj.Labels, obj.Annotations), nil
}

0 comments on commit a058ca5

Please sign in to comment.