Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Ingress API to use NetworkingV1 package & Fix the backend column in kubernetes_ingress table. Fixes #91 #98

Merged
merged 3 commits into from
Jan 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}