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

Impersonate api call to grafana dashboard #346

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ helm install kube-ui-server appscode/kube-ui-server
## Usage

```console
$ kubectl create -f artifacts/whoami.yaml -o yaml
$ kubectl create -f artifacts/whoami.yaml -o yaml --validate=false

apiVersion: authentication.k8s.io/v1
kind: SelfSubjectReview
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ require (
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
kmodules.xyz/apiversion v0.2.0
kmodules.xyz/authorizer v0.29.1
kmodules.xyz/client-go v0.30.37
kmodules.xyz/client-go v0.30.38
kmodules.xyz/custom-resources v0.30.0
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.30.2
kmodules.xyz/monitoring-agent-api v0.30.4
kmodules.xyz/offshoot-api v0.30.1
kmodules.xyz/resource-metadata v0.22.3-0.20241114091625-6c277c3fe863
kmodules.xyz/resource-metadata v0.22.3
kmodules.xyz/resource-metrics v0.30.5
kmodules.xyz/resource-metrics/utils v0.30.4
kmodules.xyz/sets v0.29.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -927,20 +927,20 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
kmodules.xyz/authorizer v0.29.1 h1:uByGGoryKbZcfiEAhjcK/Y345I9mygNQP7DVpkMbNQQ=
kmodules.xyz/authorizer v0.29.1/go.mod h1:kZRhclL8twzyt2bQuJQJbpYww2sc+qFr8I5PPoq/sWY=
kmodules.xyz/client-go v0.30.37 h1:hj4BMsNDgRVc2aDPB6Y3x5iCylXTZDZeQPJp/oA6lxs=
kmodules.xyz/client-go v0.30.37/go.mod h1:CAu+JlA8RVGtj6LQHu0Q1w2mnFUajuti49c7T1AvGdM=
kmodules.xyz/client-go v0.30.38 h1:kAQ3FdgX2HbkmfFGEoeKz7fmJYWo1Ndgdum50aaHyI0=
kmodules.xyz/client-go v0.30.38/go.mod h1:CAu+JlA8RVGtj6LQHu0Q1w2mnFUajuti49c7T1AvGdM=
kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs=
kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE=
kmodules.xyz/custom-resources v0.30.0 h1:vR3CbseHMLwR4GvtcJJuRuwIV8voKqFqNii27rMcm1o=
kmodules.xyz/custom-resources v0.30.0/go.mod h1:ZsTuI2mLG2s3byre7bHmpxJ9w0HDqAkRTL1+izGFI24=
kmodules.xyz/go-containerregistry v0.0.12 h1:Tl32QGmSqRVm9PUEb/f3dgDeu9zW5fVzt3qmAFIE37I=
kmodules.xyz/go-containerregistry v0.0.12/go.mod h1:KgeNg0hDsgeda+qc0NzWk0iVRdF0+ZIg/oRzGoYh78I=
kmodules.xyz/monitoring-agent-api v0.30.2 h1:sAgz5P5EXZqhlj1NzJ+QltAgeIx5bGSMj+aYy2EiKaw=
kmodules.xyz/monitoring-agent-api v0.30.2/go.mod h1:BoZFPDDRB7J39CcUsSDlzgW8PQCwik4ILPleyUob+Mg=
kmodules.xyz/monitoring-agent-api v0.30.4 h1:6CTKxYJKpWDsDYb0WRBHGFoW3xQof05d+W8CC34BZMc=
kmodules.xyz/monitoring-agent-api v0.30.4/go.mod h1:ZuTQ5uGi6H80QLsOTuuC7m58dfXDGUv0YB+s059gnr4=
kmodules.xyz/offshoot-api v0.30.1 h1:TrulAYO+oBsXe9sZZGTmNWIuI8qD2izMpgcTSPvgAmI=
kmodules.xyz/offshoot-api v0.30.1/go.mod h1:T3mpjR6fui0QzOcmQvIuANytW48fe9ytmy/1cgx6D4g=
kmodules.xyz/resource-metadata v0.22.3-0.20241114091625-6c277c3fe863 h1:dfsQYd8Uk8iQ/kcwddhL8GNXTN/i8e6UB3C4t0ArwyM=
kmodules.xyz/resource-metadata v0.22.3-0.20241114091625-6c277c3fe863/go.mod h1:G57v46vQOq5P1HIs9Rl7lJ5Y4dBcjJG5OyxApTdSyNs=
kmodules.xyz/resource-metadata v0.22.3 h1:cDxIvOYcWPnv372puDmhB0klHXaaQrV98JloeTkC4wU=
kmodules.xyz/resource-metadata v0.22.3/go.mod h1:zq0gtycDR21iPzhhqrbOGF4lwffIgQ9xiS8T34aJqjk=
kmodules.xyz/resource-metrics v0.30.5 h1:ZhpGeR9DCz1HTrKUg/mWhr95wlFzCPRdgVAqwaggy1o=
kmodules.xyz/resource-metrics v0.30.5/go.mod h1:w9+rz7/s/kGP1GWzYSuRdCn+l7EwpesmESSEHkLBnIQ=
kmodules.xyz/resource-metrics/utils v0.30.4 h1:bJS/x0Qr7N1FFdxugFbzZ/Es6HVs4ptsFlhkmgj3jac=
Expand Down
9 changes: 2 additions & 7 deletions pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ import (
"github.com/pkg/errors"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
openvizapi "go.openviz.dev/apimachinery/apis/openviz/v1alpha1"
openvizcs "go.openviz.dev/apimachinery/client/clientset/versioned"
crdinstall "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/install"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -242,10 +241,6 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) {
if err != nil {
return nil, fmt.Errorf("unable to create discovery client, reason: %v", err)
}
oc, err := openvizcs.NewForConfig(cfg)
if err != nil {
return nil, fmt.Errorf("unable to create openviz client, reason: %v", err)
}

cid, err := clustermeta.ClusterUID(mgr.GetAPIReader())
if err != nil {
Expand Down Expand Up @@ -331,9 +326,9 @@ func (c completedConfig) New(ctx context.Context) (*UIServer, error) {
v1alpha1storage := map[string]rest.Storage{}
v1alpha1storage[rsapi.ResourceChartPresetQueries] = chartpresetquery.NewStorage(ctrlClient)
v1alpha1storage[rsapi.ResourceClusterStatuses] = clusterstatusstorage.NewStorage(ctrlClient, kc)
v1alpha1storage[rsapi.ResourceRenderDashboards] = renderdashboard.NewStorage(ctrlClient, oc)
v1alpha1storage[rsapi.ResourceRenderDashboards] = renderdashboard.NewStorage(ctrlClient)
v1alpha1storage[rsapi.ResourceRenderRawGraphs] = renderrawgraph.NewStorage(ctrlClient)
v1alpha1storage[rsapi.ResourceRenders] = render.NewStorage(ctrlClient, oc, rbacAuthorizer)
v1alpha1storage[rsapi.ResourceRenders] = render.NewStorage(ctrlClient, rbacAuthorizer)
v1alpha1storage[rsapi.ResourceResourceBlockDefinitions] = resourceblockdefinition.NewStorage()
v1alpha1storage[rsapi.ResourceResourceCalculators] = resourcecalculatorstorage.NewStorage(ctrlClient, cid, rbacAuthorizer)
v1alpha1storage[rsapi.ResourceResourceDescriptors] = resourcedescriptor.NewStorage()
Expand Down
28 changes: 21 additions & 7 deletions pkg/graph/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import (

"github.com/pkg/errors"
openvizauipi "go.openviz.dev/apimachinery/apis/ui/v1alpha1"
openvizcs "go.openviz.dev/apimachinery/client/clientset/versioned"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
kmapi "kmodules.xyz/client-go/api/v1"
sharedapi "kmodules.xyz/resource-metadata/apis/shared"
uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1"
Expand All @@ -37,7 +36,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

func renderDashboard(kc client.Client, oc openvizcs.Interface, srcObj *unstructured.Unstructured) tableconvertor.DashboardRendererFunc {
func renderDashboard(ctx context.Context, kc client.Client, srcObj *unstructured.Unstructured) tableconvertor.DashboardRendererFunc {
return func(name string) (*uiapi.ResourceDashboard, string, error) {
rd, err := resourcedashboards.LoadByName(kc, name)
if err != nil {
Expand All @@ -52,15 +51,15 @@ func renderDashboard(kc client.Client, oc openvizcs.Interface, srcObj *unstructu
if len(rd.Spec.Dashboards) > 1 {
return nil, "", fmt.Errorf("multiple dashboards configured for %s", name)
}
dg, err := RenderDashboard(kc, oc, rd, srcObj, false)
dg, err := RenderDashboard(ctx, kc, rd, srcObj, false)
if err != nil {
return nil, "", err
}
return rd, dg.Response.Dashboards[0].URL, nil
}
}

func RenderDashboard(kc client.Client, oc openvizcs.Interface, rd *uiapi.ResourceDashboard, src *unstructured.Unstructured, embeddedLink bool) (*openvizauipi.DashboardGroup, error) {
func RenderDashboard(ctx context.Context, kc client.Client, rd *uiapi.ResourceDashboard, src *unstructured.Unstructured, embeddedLink bool) (*openvizauipi.DashboardGroup, error) {
if rd.Spec.Provider != uiapi.DashboardProviderGrafana {
return nil, fmt.Errorf("dashboard %s uses unsupported provider %q", rd.Name, rd.Spec.Provider)
}
Expand All @@ -85,7 +84,7 @@ func RenderDashboard(kc client.Client, oc openvizcs.Interface, rd *uiapi.Resourc
result = strings.TrimSpace(result)
cond = strings.EqualFold(result, "true")
} else if d.If.Connected != nil {
_, targets, err := ExecRawQuery(kc, kmapi.NewObjectID(src).OID(), *d.If.Connected)
_, targets, err := ExecRawQuery(ctx, kc, kmapi.NewObjectID(src).OID(), *d.If.Connected)
if err != nil {
return nil, errors.Wrapf(err, "failed to check connection for dashboard with title %s", d.Title)
}
Expand Down Expand Up @@ -124,5 +123,20 @@ func RenderDashboard(kc client.Client, oc openvizcs.Interface, rd *uiapi.Resourc
}
dg.Request.Dashboards = append(dg.Request.Dashboards, out)
}
return oc.UiV1alpha1().DashboardGroups().Create(context.TODO(), dg, metav1.CreateOptions{})

content, err := runtime.DefaultUnstructuredConverter.ToUnstructured(dg)
if err != nil {
return nil, err
}
req := unstructured.Unstructured{Object: content}
req.SetGroupVersionKind(openvizauipi.SchemeGroupVersion.WithKind(openvizauipi.ResourceKindDashboardGroup))
err = kc.Create(ctx, &req)
if err != nil {
return nil, err
}
err = runtime.DefaultUnstructuredConverter.FromUnstructured(req.UnstructuredContent(), dg)
if err != nil {
return nil, err
}
return dg, err
}
2 changes: 1 addition & 1 deletion pkg/graph/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func LocatePods(ctx context.Context, kc client.Client, req *kmapi.ObjectInfo) ([
},
}

_, refs, err := ExecRawQuery(kc, src.OID(), target)
_, refs, err := ExecRawQuery(ctx, kc, src.OID(), target)
if err != nil {
return nil, err
}
Expand Down
60 changes: 34 additions & 26 deletions pkg/graph/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"kubeops.dev/ui-server/pkg/shared"

"github.com/pkg/errors"
openvizcs "go.openviz.dev/apimachinery/client/clientset/versioned"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
Expand All @@ -43,8 +42,8 @@ import (
)

func RenderLayout(
ctx context.Context,
kc client.Client,
oc openvizcs.Interface,
src kmapi.ObjectInfo,
layoutName string, // optional
pageName string, // optional
Expand All @@ -57,7 +56,7 @@ func RenderLayout(
}
var srcObj unstructured.Unstructured
srcObj.SetGroupVersionKind(srcRID.GroupVersionKind())
err = kc.Get(context.TODO(), src.Ref.ObjectKey(), &srcObj)
err = kc.Get(ctx, src.Ref.ObjectKey(), &srcObj)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -118,14 +117,14 @@ func RenderLayout(
}

if layout.Spec.Header != nil && okToRender(layout.Spec.Header.Kind, renderBlocks) {
if bv, err := renderPageBlock(kc, oc, srcRID, &srcObj, layout.Spec.Header, convertToTable); err != nil {
if bv, err := renderPageBlock(ctx, kc, srcRID, &srcObj, layout.Spec.Header, convertToTable); err != nil {
return nil, err
} else {
out.Header = bv
}
}
if layout.Spec.TabBar != nil && okToRender(layout.Spec.TabBar.Kind, renderBlocks) {
if bv, err := renderPageBlock(kc, oc, srcRID, &srcObj, layout.Spec.TabBar, convertToTable); err != nil {
if bv, err := renderPageBlock(ctx, kc, srcRID, &srcObj, layout.Spec.TabBar, convertToTable); err != nil {
return nil, err
} else {
out.TabBar = bv
Expand All @@ -151,14 +150,14 @@ func RenderLayout(
Blocks: nil,
}
if sectionLayout.Info != nil && okToRender(sectionLayout.Info.Kind, renderBlocks) {
if bv, err := renderPageBlock(kc, oc, srcRID, &srcObj, sectionLayout.Info, convertToTable); err != nil {
if bv, err := renderPageBlock(ctx, kc, srcRID, &srcObj, sectionLayout.Info, convertToTable); err != nil {
return nil, err
} else {
section.Info = bv
}
}
if sectionLayout.Insight != nil && okToRender(sectionLayout.Insight.Kind, renderBlocks) {
if bv, err := renderPageBlock(kc, oc, srcRID, &srcObj, sectionLayout.Insight, convertToTable); err != nil {
if bv, err := renderPageBlock(ctx, kc, srcRID, &srcObj, sectionLayout.Insight, convertToTable); err != nil {
return nil, err
} else {
section.Insight = bv
Expand All @@ -168,7 +167,7 @@ func RenderLayout(
blocks := make([]rsapi.PageBlockView, 0, len(sectionLayout.Blocks))
for _, block := range sectionLayout.Blocks {
if okToRender(block.Kind, renderBlocks) {
if bv, err := renderPageBlock(kc, oc, srcRID, &srcObj, &block, convertToTable); err != nil {
if bv, err := renderPageBlock(ctx, kc, srcRID, &srcObj, &block, convertToTable); err != nil {
return nil, err
} else {
blocks = append(blocks, *bv)
Expand All @@ -190,23 +189,23 @@ func okToRender(kind rsapi.TableKind, renderBlocks sets.Set[string]) bool {
return renderBlocks.Len() == 0 || renderBlocks.Has(string(kind))
}

func RenderPageBlock(kc client.Client, oc openvizcs.Interface, src kmapi.ObjectInfo, block *rsapi.PageBlockLayout, convertToTable bool) (*rsapi.PageBlockView, error) {
func RenderPageBlock(ctx context.Context, kc client.Client, src kmapi.ObjectInfo, block *rsapi.PageBlockLayout, convertToTable bool) (*rsapi.PageBlockView, error) {
srcRID, err := kmapi.ExtractResourceID(kc.RESTMapper(), src.Resource)
if err != nil {
return nil, errors.Wrap(err, "failed to detect src resource id")
}
var srcObj unstructured.Unstructured
srcObj.SetGroupVersionKind(srcRID.GroupVersionKind())
err = kc.Get(context.TODO(), src.Ref.ObjectKey(), &srcObj)
err = kc.Get(ctx, src.Ref.ObjectKey(), &srcObj)
if err != nil {
return nil, err
}

return renderPageBlock(kc, oc, srcRID, &srcObj, block, convertToTable)
return renderPageBlock(ctx, kc, srcRID, &srcObj, block, convertToTable)
}

func renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.ResourceID, srcObj *unstructured.Unstructured, block *rsapi.PageBlockLayout, convertToTable bool) (*rsapi.PageBlockView, error) {
bv, err := _renderPageBlock(kc, oc, srcRID, srcObj, block, convertToTable)
func renderPageBlock(ctx context.Context, kc client.Client, srcRID *kmapi.ResourceID, srcObj *unstructured.Unstructured, block *rsapi.PageBlockLayout, convertToTable bool) (*rsapi.PageBlockView, error) {
bv, err := _renderPageBlock(ctx, kc, srcRID, srcObj, block, convertToTable)
if err != nil {
bv.Result = rsapi.RenderResult{
Status: rsapi.RenderError,
Expand All @@ -220,7 +219,16 @@ func renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.Res
return bv, nil
}

func _renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.ResourceID, srcObj *unstructured.Unstructured, block *rsapi.PageBlockLayout, convertToTable bool) (*rsapi.PageBlockView, error) {
func _renderPageBlock(ctx context.Context, kc client.Client, srcRID *kmapi.ResourceID, srcObj *unstructured.Unstructured, block *rsapi.PageBlockLayout, convertToTable bool) (*rsapi.PageBlockView, error) {
var impersonate bool
if block != nil && block.ResourceLocator != nil && block.Impersonate {
impersonate = true
}
cc, err := NewClient(ctx, kc, impersonate)
if err != nil {
return nil, err
}

out := rsapi.PageBlockView{
Kind: block.Kind,
Name: block.Name,
Expand All @@ -231,11 +239,11 @@ func _renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.Re
if block.Kind == rsapi.TableKindSelf || block.Kind == rsapi.TableKindSubTable {
out.Resource = srcRID
if convertToTable {
converter, err := tableconvertor.New(block.FieldPath, block.View.Columns, renderDashboard(kc, oc, srcObj), RenderExec(nil, &srcGVR))
converter, err := tableconvertor.New(block.FieldPath, block.View.Columns, renderDashboard(ctx, cc, srcObj), RenderExec(nil, &srcGVR))
if err != nil {
return &out, err
}
table, err := converter.ConvertToTable(context.TODO(), srcObj)
table, err := converter.ConvertToTable(ctx, srcObj)
if err != nil {
return &out, err
}
Expand All @@ -248,7 +256,7 @@ func _renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.Re
return &out, fmt.Errorf("unsupported table kind found in block %+v", block)
}

mapping, err := kc.RESTMapper().RESTMapping(schema.GroupKind{
mapping, err := cc.RESTMapper().RESTMapping(schema.GroupKind{
Group: block.Ref.Group,
Kind: block.Ref.Kind,
})
Expand Down Expand Up @@ -292,24 +300,24 @@ func _renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.Re
// handle FalcoEvent list call
if vars[sharedapi.GraphQueryVarTargetGroup] == falco.GroupName &&
vars[sharedapi.GraphQueryVarTargetKind] == falcov1alpha1.ResourceKindFalcoEvent {
objs, err = listFalcoEvents(kc, block, srcID)
objs, err = listFalcoEvents(ctx, cc, block, srcID)
if err != nil {
return &out, err
}
} else {
objs, err = ExecGraphQLQuery(kc, q, vars)
objs, err = ExecGraphQLQuery(cc, q, vars)
if err != nil {
return &out, err
}
}

if convertToTable {
converter, err := tableconvertor.New(block.FieldPath, block.View.Columns, renderDashboard(kc, oc, srcObj), RenderExec(&srcGVR, &mapping.Resource))
converter, err := tableconvertor.New(block.FieldPath, block.View.Columns, renderDashboard(ctx, cc, srcObj), RenderExec(&srcGVR, &mapping.Resource))
if err != nil {
return &out, err
}
list := &unstructured.UnstructuredList{Items: objs}
table, err := converter.ConvertToTable(context.TODO(), list)
table, err := converter.ConvertToTable(ctx, list)
if err != nil {
return &out, err
}
Expand All @@ -327,17 +335,17 @@ func _renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.Re
}
u := unstructured.Unstructured{Object: obj}
u.SetGroupVersionKind(mapping.GroupVersionKind)
err = kc.Create(context.TODO(), &u)
err = cc.Create(ctx, &u)
if err != nil {
return &out, err
}

if convertToTable {
converter, err := tableconvertor.New(block.FieldPath, block.View.Columns, renderDashboard(kc, oc, srcObj), RenderExec(&srcGVR, &mapping.Resource))
converter, err := tableconvertor.New(block.FieldPath, block.View.Columns, renderDashboard(ctx, cc, srcObj), RenderExec(&srcGVR, &mapping.Resource))
if err != nil {
return &out, err
}
table, err := converter.ConvertToTable(context.TODO(), &u)
table, err := converter.ConvertToTable(ctx, &u)
if err != nil {
return &out, err
}
Expand All @@ -349,7 +357,7 @@ func _renderPageBlock(kc client.Client, oc openvizcs.Interface, srcRID *kmapi.Re
return &out, nil
}

func listFalcoEvents(kc client.Client, block *rsapi.PageBlockLayout, srcID *kmapi.ObjectID) ([]unstructured.Unstructured, error) {
func listFalcoEvents(ctx context.Context, kc client.Client, block *rsapi.PageBlockLayout, srcID *kmapi.ObjectID) ([]unstructured.Unstructured, error) {
var refs []kmapi.ObjectReference
var err error
if srcID.Kind == "Pod" {
Expand All @@ -376,7 +384,7 @@ func listFalcoEvents(kc client.Client, block *rsapi.PageBlockLayout, srcID *kmap

var list unstructured.UnstructuredList
list.SetGroupVersionKind(falcov1alpha1.SchemeGroupVersion.WithKind(falcov1alpha1.ResourceKindFalcoEvent))
err = kc.List(context.TODO(), &list, &client.ListOptions{LabelSelector: selector})
err = kc.List(ctx, &list, &client.ListOptions{LabelSelector: selector})
if meta.IsNoMatchError(err) {
return nil, err
} else if err == nil {
Expand Down
Loading
Loading