mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
chore: remove unused custom expansions from client (#3697)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
f34a542587
commit
f32ea23c9d
3 changed files with 12 additions and 62 deletions
|
@ -1,18 +0,0 @@
|
||||||
package v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ClusterPolicyListerExpansion interface{}
|
|
||||||
|
|
||||||
//ListResources is a wrapper to List and adds the resource kind information
|
|
||||||
// as the lister is specific to a gvk we can harcode the values here
|
|
||||||
func (pl *clusterPolicyLister) ListResources(selector labels.Selector) (ret []*v1.ClusterPolicy, err error) {
|
|
||||||
policies, err := pl.List(selector)
|
|
||||||
for index := range policies {
|
|
||||||
policies[index].SetGroupVersionKind(v1.SchemeGroupVersion.WithKind("ClusterPolicy"))
|
|
||||||
}
|
|
||||||
return policies, err
|
|
||||||
}
|
|
|
@ -18,6 +18,18 @@ limitations under the License.
|
||||||
|
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
|
// ClusterPolicyListerExpansion allows custom methods to be added to
|
||||||
|
// ClusterPolicyLister.
|
||||||
|
type ClusterPolicyListerExpansion interface{}
|
||||||
|
|
||||||
|
// GenerateRequestListerExpansion allows custom methods to be added to
|
||||||
|
// GenerateRequestLister.
|
||||||
|
type GenerateRequestListerExpansion interface{}
|
||||||
|
|
||||||
|
// GenerateRequestNamespaceListerExpansion allows custom methods to be added to
|
||||||
|
// GenerateRequestNamespaceLister.
|
||||||
|
type GenerateRequestNamespaceListerExpansion interface{}
|
||||||
|
|
||||||
// PolicyListerExpansion allows custom methods to be added to
|
// PolicyListerExpansion allows custom methods to be added to
|
||||||
// PolicyLister.
|
// PolicyLister.
|
||||||
type PolicyListerExpansion interface{}
|
type PolicyListerExpansion interface{}
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
package v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
)
|
|
||||||
|
|
||||||
type GenerateRequestListerExpansion interface{}
|
|
||||||
|
|
||||||
type GenerateRequestNamespaceListerExpansion interface {
|
|
||||||
GetGenerateRequestsForClusterPolicy(policy string) ([]*v1.GenerateRequest, error)
|
|
||||||
GetGenerateRequestsForResource(kind, namespace, name string) ([]*v1.GenerateRequest, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s generateRequestNamespaceLister) GetGenerateRequestsForResource(kind, namespace, name string) ([]*v1.GenerateRequest, error) {
|
|
||||||
var list []*v1.GenerateRequest
|
|
||||||
grs, err := s.List(labels.NewSelector())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for idx, gr := range grs {
|
|
||||||
if gr.Spec.Resource.Kind == kind &&
|
|
||||||
gr.Spec.Resource.Namespace == namespace &&
|
|
||||||
gr.Spec.Resource.Name == name {
|
|
||||||
list = append(list, grs[idx])
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s generateRequestNamespaceLister) GetGenerateRequestsForClusterPolicy(policy string) ([]*v1.GenerateRequest, error) {
|
|
||||||
var list []*v1.GenerateRequest
|
|
||||||
grs, err := s.List(labels.NewSelector())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for idx, gr := range grs {
|
|
||||||
if gr.Spec.Policy == policy {
|
|
||||||
list = append(list, grs[idx])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list, err
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue