From 13148533bf7275c01fa1995422e84861a5ad70a8 Mon Sep 17 00:00:00 2001 From: Adam Wolfe Gordon Date: Tue, 6 Aug 2024 16:12:53 -0600 Subject: [PATCH] fixup! query: Allow multiple filters to be specified address review comments --- apis/query/v1alpha2/query_types.go | 23 ++++++++++---------- apis/query/v1alpha2/zz_generated.deepcopy.go | 12 +++++----- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/apis/query/v1alpha2/query_types.go b/apis/query/v1alpha2/query_types.go index 4b04787..d3878b7 100644 --- a/apis/query/v1alpha2/query_types.go +++ b/apis/query/v1alpha2/query_types.go @@ -45,7 +45,6 @@ type QueryTopLevelFilter struct { // objects specifies what to filter. Objects in the query response will // match all criteria in at least one of the specified filters. // +required - // +kubebuilder:validation:MinLength=1 Objects []QueryFilter `json:"objects"` } @@ -93,14 +92,14 @@ type Freshness struct { type QueryFilter struct { // id is the object ID to query. ID string `json:"id,omitempty"` - // createdAt queries for objects with a range of creation times. - CreatedAt QueryCreatedAt `json:"createdAt,omitempty"` + // creationTimestamp queries for objects with a range of creation times. + CreationTimestamp QueryCreationTimestamp `json:"creationTimestamp,omitempty"` // namespace is the namespace WITHIN a control plane to query. Namespace string `json:"namespace,omitempty"` // name is the name of objects to query. Name string `json:"name,omitempty"` - // kind is the GroupKinds of objects to query. - Kind QueryGroupKind `json:"kind,omitempty"` + // groupKind is the GroupKinds of objects to query. + GroupKind QueryGroupKind `json:"groupKind,omitempty"` // labels are the labels of objects to query. Labels map[string]string `json:"labels,omitempty"` // categories is a list of categories to query. @@ -117,16 +116,16 @@ type QueryFilter struct { JSONPath string `json:"jsonpath,omitempty"` } -// QueryCreatedAt specifies how to query by object creation time. -type QueryCreatedAt struct { +// QueryCreationTimestamp specifies how to query by object creation time. +type QueryCreationTimestamp struct { After metav1.Time `json:"after,omitempty"` Before metav1.Time `json:"before,omitempty"` } // QueryGroupKind specifies how to query for GroupKinds. type QueryGroupKind struct { - // group is the API group to query. If empty all groups will be queried. - Group string `json:"group,omitempty"` + // apiGroup is the API group to query. If empty all groups will be queried. + APIGroup string `json:"apiGroup,omitempty"` // kind is kind to query. Kinds are case-insensitive and also match plural // resources. If empty all kinds will be queried. Kind string `json:"kind,omitempty"` @@ -151,9 +150,9 @@ type QueryCondition struct { Type string `json:"type"` // status is the status of condition to query. This is either True, False // or Unknown. - // - // +kubebuilder:validation:Required - Status string `json:"status"` + Status string `json:"status,omitempty"` + // reason queries based on the reason field of the condition. + Reason string `json:"reason,omitempty"` } // A QueryOwner specifies how to query by owner. diff --git a/apis/query/v1alpha2/zz_generated.deepcopy.go b/apis/query/v1alpha2/zz_generated.deepcopy.go index 84d5ab6..d4ffba5 100644 --- a/apis/query/v1alpha2/zz_generated.deepcopy.go +++ b/apis/query/v1alpha2/zz_generated.deepcopy.go @@ -126,18 +126,18 @@ func (in *QueryCondition) DeepCopy() *QueryCondition { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueryCreatedAt) DeepCopyInto(out *QueryCreatedAt) { +func (in *QueryCreationTimestamp) DeepCopyInto(out *QueryCreationTimestamp) { *out = *in in.After.DeepCopyInto(&out.After) in.Before.DeepCopyInto(&out.Before) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryCreatedAt. -func (in *QueryCreatedAt) DeepCopy() *QueryCreatedAt { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryCreationTimestamp. +func (in *QueryCreationTimestamp) DeepCopy() *QueryCreationTimestamp { if in == nil { return nil } - out := new(QueryCreatedAt) + out := new(QueryCreationTimestamp) in.DeepCopyInto(out) return out } @@ -145,8 +145,8 @@ func (in *QueryCreatedAt) DeepCopy() *QueryCreatedAt { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *QueryFilter) DeepCopyInto(out *QueryFilter) { *out = *in - in.CreatedAt.DeepCopyInto(&out.CreatedAt) - out.Kind = in.Kind + in.CreationTimestamp.DeepCopyInto(&out.CreationTimestamp) + out.GroupKind = in.GroupKind if in.Labels != nil { in, out := &in.Labels, &out.Labels *out = make(map[string]string, len(*in))