From f9e669954f31e26e4269768820b70556dff5ca86 Mon Sep 17 00:00:00 2001 From: David-Jaeyoon-Lee Date: Wed, 30 Oct 2024 19:56:08 +0000 Subject: [PATCH] Rebase to master & fix merge conflicts Signed-off-by: David-Jaeyoon-Lee --- pkg/gator/errors.go | 1 + pkg/gator/reader/read_resources.go | 2 +- pkg/gator/verify/runner.go | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/gator/errors.go b/pkg/gator/errors.go index ccf9076e76e..a5e504ddeb9 100644 --- a/pkg/gator/errors.go +++ b/pkg/gator/errors.go @@ -19,6 +19,7 @@ var ( // SyncSet. ErrNotAGVKManifest = errors.New("not a GVKManifest") // ErrNotAnExpansion indicates the user-indicated file does not contain a + // ErrNotAnExpansion indicates the user-indicated file does not contain an // ExpansionTemplate. ErrNotAnExpansion = errors.New("not an Expansion Template") // ErrAddingTemplate indicates a problem instantiating a Suite's ConstraintTemplate. diff --git a/pkg/gator/reader/read_resources.go b/pkg/gator/reader/read_resources.go index 3244f09618f..64b3f3483a5 100644 --- a/pkg/gator/reader/read_resources.go +++ b/pkg/gator/reader/read_resources.go @@ -250,7 +250,7 @@ func ReadExpansion(f fs.FS, path string) (*unstructured.Unstructured, error) { } gvk := u.GroupVersionKind() - if gvk.Group != "expansion.gatekeeper.sh" { + if gvk.Group != "expansion.gatekeeper.sh" || gvk.Kind != "ExpansionTemplate" { return nil, gator.ErrNotAnExpansion } diff --git a/pkg/gator/verify/runner.go b/pkg/gator/verify/runner.go index 9fcc4b29fc9..2f995124c24 100644 --- a/pkg/gator/verify/runner.go +++ b/pkg/gator/verify/runner.go @@ -366,6 +366,10 @@ func (r *Runner) runReview(ctx context.Context, newClient func() (gator.Client, } review, err := c.Review(ctx, au, reviews.EnforcementPoint(util.GatorEnforcementPoint)) + if err != nil { + return nil, fmt.Errorf("reviewing %v %s/%s: %w", + toReview.GroupVersionKind(), toReview.GetNamespace(), toReview.GetName(), err) + } if e != nil { resultants, err := e.Expand(toReview)