From c9331116facaffb48395d669c41dcf7625d9e57a Mon Sep 17 00:00:00 2001 From: Arnob Kumar Saha Date: Wed, 8 Jan 2025 22:10:10 +0600 Subject: [PATCH] Add filter map in info (#528) Signed-off-by: Arnob kumar saha Signed-off-by: Tamal Saha Co-authored-by: Tamal Saha --- apis/meta/v1alpha1/openapi_generated.go | 15 ++++++++++++++ apis/meta/v1alpha1/resourcelayout_types.go | 1 + apis/meta/v1alpha1/zz_generated.deepcopy.go | 7 +++++++ ...meta.k8s.appscode.com_resourcelayouts.yaml | 20 +++++++++++++++++++ go.mod | 4 ++-- go.sum | 8 ++++---- .../v1alpha1/resourcelayouts.yaml | 20 +++++++++++++++++++ pkg/layouts/lib.go | 8 ++++++++ .../kmodules.xyz/client-go/api/v1/cluster.go | 3 ++- .../kmodules.xyz/client-go/client/client.go | 9 +++------ vendor/kmodules.xyz/client-go/cluster/lib.go | 2 ++ vendor/modules.txt | 4 ++-- 12 files changed, 86 insertions(+), 15 deletions(-) diff --git a/apis/meta/v1alpha1/openapi_generated.go b/apis/meta/v1alpha1/openapi_generated.go index 6a78d1a34..decd73328 100644 --- a/apis/meta/v1alpha1/openapi_generated.go +++ b/apis/meta/v1alpha1/openapi_generated.go @@ -20506,6 +20506,21 @@ func schema_resource_metadata_apis_meta_v1alpha1_PageBlockLayout(ref common.Refe }, }, }, + "filters": { + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: false, + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, }, Required: []string{"kind", "ref", "query"}, }, diff --git a/apis/meta/v1alpha1/resourcelayout_types.go b/apis/meta/v1alpha1/resourcelayout_types.go index de6b631a4..e380a74ca 100644 --- a/apis/meta/v1alpha1/resourcelayout_types.go +++ b/apis/meta/v1alpha1/resourcelayout_types.go @@ -84,6 +84,7 @@ type PageBlockLayout struct { View *PageBlockTableDefinition `json:"view,omitempty"` RequiredFeatureSets map[string]FeatureList `json:"requiredFeatureSets,omitempty"` + Filters map[string]bool `json:"filters,omitempty"` } type FeatureList []string diff --git a/apis/meta/v1alpha1/zz_generated.deepcopy.go b/apis/meta/v1alpha1/zz_generated.deepcopy.go index a42fa0d1f..7cbaedd8d 100644 --- a/apis/meta/v1alpha1/zz_generated.deepcopy.go +++ b/apis/meta/v1alpha1/zz_generated.deepcopy.go @@ -911,6 +911,13 @@ func (in *PageBlockLayout) DeepCopyInto(out *PageBlockLayout) { (*out)[key] = outVal } } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make(map[string]bool, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } return } diff --git a/crds/meta.k8s.appscode.com_resourcelayouts.yaml b/crds/meta.k8s.appscode.com_resourcelayouts.yaml index 3f31fc4eb..43aadb917 100644 --- a/crds/meta.k8s.appscode.com_resourcelayouts.yaml +++ b/crds/meta.k8s.appscode.com_resourcelayouts.yaml @@ -50,6 +50,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about an image used @@ -300,6 +304,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about @@ -571,6 +579,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about @@ -815,6 +827,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about @@ -1096,6 +1112,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about an image used diff --git a/go.mod b/go.mod index 4ee24fb04..dc3edcb67 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 github.com/yudai/gojsondiff v1.0.0 - go.bytebuilders.dev/license-verifier v0.14.2 + go.bytebuilders.dev/license-verifier v0.14.4 golang.org/x/net v0.33.0 gomodules.xyz/encoding v0.0.8 gomodules.xyz/jsonpath v0.0.2 @@ -29,7 +29,7 @@ require ( k8s.io/klog/v2 v2.130.1 k8s.io/kube-openapi v0.0.0-20240703190633-0aa61b46e8c2 kmodules.xyz/apiversion v0.2.0 - kmodules.xyz/client-go v0.30.43 + kmodules.xyz/client-go v0.30.44 kmodules.xyz/crd-schema-fuzz v0.29.1 kmodules.xyz/go-containerregistry v0.0.12 kmodules.xyz/offshoot-api v0.30.1 diff --git a/go.sum b/go.sum index 6c8b66335..f9cc3f266 100644 --- a/go.sum +++ b/go.sum @@ -220,8 +220,8 @@ github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.bytebuilders.dev/license-verifier v0.14.2 h1:syPjdKV9YC9ERpm4vofpHf7coZtntqbSXweN0XFQJBQ= -go.bytebuilders.dev/license-verifier v0.14.2/go.mod h1:bNNaVbry3TZbu54pf57LkhjsFX94T6O62w0roiy1yiE= +go.bytebuilders.dev/license-verifier v0.14.4 h1:JwTGQFew4nudwv8Pk3BdfQRts8KfgUQ5xhu138w1wt4= +go.bytebuilders.dev/license-verifier v0.14.4/go.mod h1:LqWXJKee5ofDcCYM6T5WilYlUc4NlKeZz58tHwO8GEs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -334,8 +334,8 @@ k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCI k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= -kmodules.xyz/client-go v0.30.43 h1:ygH5e1+0oht4YV9NyT42YoWAlp9wrAUMH6FsB9vAlbk= -kmodules.xyz/client-go v0.30.43/go.mod h1:T9Kiu20wXEn65dLBQeegf4+y7oahJBR9ZJO2zGEVLIY= +kmodules.xyz/client-go v0.30.44 h1:mLOBXQhvCIhdega9WoN4Px/usqobuKTT2vOPQcbGhXQ= +kmodules.xyz/client-go v0.30.44/go.mod h1:T9Kiu20wXEn65dLBQeegf4+y7oahJBR9ZJO2zGEVLIY= 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/go-containerregistry v0.0.12 h1:Tl32QGmSqRVm9PUEb/f3dgDeu9zW5fVzt3qmAFIE37I= diff --git a/hub/resourcedescriptors/meta.k8s.appscode.com/v1alpha1/resourcelayouts.yaml b/hub/resourcedescriptors/meta.k8s.appscode.com/v1alpha1/resourcelayouts.yaml index 7b12148a3..680e40df4 100644 --- a/hub/resourcedescriptors/meta.k8s.appscode.com/v1alpha1/resourcelayouts.yaml +++ b/hub/resourcedescriptors/meta.k8s.appscode.com/v1alpha1/resourcelayouts.yaml @@ -73,6 +73,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about an image used @@ -322,6 +326,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about @@ -589,6 +597,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about @@ -833,6 +845,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about @@ -1114,6 +1130,10 @@ spec: type: string fieldPath: type: string + filters: + additionalProperties: + type: boolean + type: object icons: items: description: ImageSpec contains information about an image used diff --git a/pkg/layouts/lib.go b/pkg/layouts/lib.go index ea5d8af4f..ce213980c 100644 --- a/pkg/layouts/lib.go +++ b/pkg/layouts/lib.go @@ -313,6 +313,14 @@ func GetResourceLayout(kc client.Client, outline *rsapi.ResourceOutline) (*rsapi return nil, fmt.Errorf("ResourceOutline %s page %s uses multiple basic blocks", outline.Name, section.Name) } section.Info = &tables[0] + + section.Info.Filters = make(map[string]bool) + for typ, show := range sectionFilter.Info { + if typ == "basic" { + continue + } + section.Info.Filters[typ] = show + } } if sectionOutline.Insight != nil && sectionFilter.Insight { tables, err := FlattenPageBlockOutline(kc, src, *sectionOutline.Insight, rsapi.Field) diff --git a/vendor/kmodules.xyz/client-go/api/v1/cluster.go b/vendor/kmodules.xyz/client-go/api/v1/cluster.go index c8a0a104b..c9adf90d2 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/cluster.go +++ b/vendor/kmodules.xyz/client-go/api/v1/cluster.go @@ -192,7 +192,7 @@ type ClusterInfo struct { CAPI *CAPIClusterInfo `json:"capi" protobuf:"bytes,4,opt,name=capi"` } -// +kubebuilder:validation:Enum=capa;capg;capz +// +kubebuilder:validation:Enum=capa;capg;capz;caph;capk type CAPIProvider string const ( @@ -200,6 +200,7 @@ const ( CAPIProviderCAPG CAPIProvider = "capg" CAPIProviderCAPZ CAPIProvider = "capz" CAPIProviderCAPH CAPIProvider = "caph" + CAPIProviderCAPK CAPIProvider = "capk" ) type ClusterClaimInfo struct { diff --git a/vendor/kmodules.xyz/client-go/client/client.go b/vendor/kmodules.xyz/client-go/client/client.go index 321ec3abc..e71042c2f 100644 --- a/vendor/kmodules.xyz/client-go/client/client.go +++ b/vendor/kmodules.xyz/client-go/client/client.go @@ -143,8 +143,7 @@ func CreateOrPatchE(ctx context.Context, c client.Client, obj client.Object, tra func CreateOrPatch(ctx context.Context, c client.Client, obj client.Object, transform TransformFunc, opts ...client.PatchOption) (kutil.VerbType, error) { return CreateOrPatchE(ctx, c, obj, func(obj client.Object, createOp bool) (client.Object, error) { - transform(obj, createOp) - return obj, nil + return transform(obj, createOp), nil }, opts...) } @@ -188,8 +187,7 @@ func PatchE(ctx context.Context, c client.Client, obj client.Object, transform P func Patch(ctx context.Context, c client.Client, obj client.Object, transform PatchFunc, opts ...client.PatchOption) (kutil.VerbType, error) { return PatchE(ctx, c, obj, func(obj client.Object) (client.Object, error) { - transform(obj) - return obj, nil + return transform(obj), nil }, opts...) } @@ -232,8 +230,7 @@ func PatchStatusE(ctx context.Context, c client.Client, obj client.Object, trans func PatchStatus(ctx context.Context, c client.Client, obj client.Object, transform PatchFunc, opts ...client.SubResourcePatchOption) (kutil.VerbType, error) { return PatchStatusE(ctx, c, obj, func(obj client.Object) (client.Object, error) { - transform(obj) - return obj, nil + return transform(obj), nil }, opts...) } diff --git a/vendor/kmodules.xyz/client-go/cluster/lib.go b/vendor/kmodules.xyz/client-go/cluster/lib.go index 674d92164..1b81fa48d 100644 --- a/vendor/kmodules.xyz/client-go/cluster/lib.go +++ b/vendor/kmodules.xyz/client-go/cluster/lib.go @@ -222,6 +222,8 @@ func getProviderName(kind string) kmapi.CAPIProvider { return kmapi.CAPIProviderCAPG case "HetznerCluster": return kmapi.CAPIProviderCAPH + case "KubevirtCluster": + return kmapi.CAPIProviderCAPK } return "" } diff --git a/vendor/modules.txt b/vendor/modules.txt index 386eea776..fe4def2e3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -305,7 +305,7 @@ github.com/yudai/golcs # github.com/zeebo/xxh3 v1.0.2 ## explicit; go 1.17 github.com/zeebo/xxh3 -# go.bytebuilders.dev/license-verifier v0.14.2 +# go.bytebuilders.dev/license-verifier v0.14.4 ## explicit; go 1.21 go.bytebuilders.dev/license-verifier/apis/licenses go.bytebuilders.dev/license-verifier/info @@ -745,7 +745,7 @@ k8s.io/utils/trace # kmodules.xyz/apiversion v0.2.0 ## explicit; go 1.14 kmodules.xyz/apiversion -# kmodules.xyz/client-go v0.30.43 +# kmodules.xyz/client-go v0.30.44 ## explicit; go 1.22.0 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1