1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-01-20 18:52:16 +00:00
kyverno/cmd/cli/kubectl-kyverno/policy/legacy_loader.go
Jim Bugwadia 6d48a185d1
Fix cli load policies from fs (#10270)
* skip invalid policy files

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix file-system policy loader

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* propagate policy schema error

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

---------

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2024-05-21 15:17:49 +08:00

16 lines
355 B
Go

package policy
import yamlutils "github.com/kyverno/kyverno/pkg/utils/yaml"
func legacyLoader(_ string, content []byte) (*LoaderResults, error) {
policies, vaps, bindings, err := yamlutils.GetPolicy(content)
if err != nil {
return nil, err
}
return &LoaderResults{
Policies: policies,
VAPs: vaps,
VAPBindings: bindings,
}, nil
}