mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
fixed skipping resources
This commit is contained in:
parent
d468368ec2
commit
85d47e16e7
2 changed files with 5 additions and 4 deletions
|
@ -141,7 +141,7 @@ func Command() *cobra.Command {
|
||||||
return sanitizedError.NewWithError("failed to load resources", err)
|
return sanitizedError.NewWithError("failed to load resources", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(resources) == 0 {
|
if len(resources) == 0 && !cluster {
|
||||||
return sanitizedError.NewWithError("valid resource(s) not provided", err)
|
return sanitizedError.NewWithError("valid resource(s) not provided", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ func GetResources(policies []*v1.ClusterPolicy, resourcePaths []string, dClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if lenOfResource >= len(resources){
|
if lenOfResource >= len(resources) {
|
||||||
fmt.Printf("\n----------------------------------------------------------------------\n%s not found in cluster\n----------------------------------------------------------------------\n", resourcePath)
|
fmt.Printf("\n----------------------------------------------------------------------\n%s not found in cluster\n----------------------------------------------------------------------\n", resourcePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,13 +116,14 @@ func getResourcesOfTypeFromCluster(resourceTypes []string, dClient *client.Clien
|
||||||
r := make(map[string]map[string]*unstructured.Unstructured)
|
r := make(map[string]map[string]*unstructured.Unstructured)
|
||||||
|
|
||||||
var resources []*unstructured.Unstructured
|
var resources []*unstructured.Unstructured
|
||||||
|
|
||||||
for _, kind := range resourceTypes {
|
for _, kind := range resourceTypes {
|
||||||
r[kind] = make(map[string]*unstructured.Unstructured)
|
r[kind] = make(map[string]*unstructured.Unstructured)
|
||||||
resourceList, err := dClient.ListResource("", kind, namespace, nil)
|
resourceList, err := dClient.ListResource("", kind, namespace, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
// return nil, err
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
version := resourceList.GetAPIVersion()
|
version := resourceList.GetAPIVersion()
|
||||||
for _, resource := range resourceList.Items {
|
for _, resource := range resourceList.Items {
|
||||||
r[kind][resource.GetName()] = resource.DeepCopy()
|
r[kind][resource.GetName()] = resource.DeepCopy()
|
||||||
|
|
Loading…
Add table
Reference in a new issue