Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed schema validation. Has it ever worked? #98

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (lrm *LockedResourceManager) validateLockedResources(lockedResources []lock
result = multierror.Append(result, errors.New("resource type:"+lockedResource.Unstructured.GroupVersionKind().String()+"not defined"))
continue
}
err = templates.ValidateUnstructured(ctx, &lockedResource.Unstructured, schemaValidation.(*validation.NullSchema))
err = templates.ValidateUnstructured(ctx, &lockedResource.Unstructured, schemaValidation)
if err != nil {
lrm.log.Error(err, "unable to validate", "unstructured", lockedResource.Unstructured)
result = multierror.Append(result, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func ProcessTemplateArray(context context.Context, data interface{}, template *t
// ValidateUnstructured validates the content of an unstructured against an openapi schema.
// the schema is intended to be retrieved from a running instance of kubernetes, but other usages are possible.
// requires a context with log
func ValidateUnstructured(context context.Context, obj *unstructured.Unstructured, validationSchema *validation.NullSchema) error {
func ValidateUnstructured(context context.Context, obj *unstructured.Unstructured, validationSchema validation.Schema) error {
log := log.FromContext(context)
bb, err := obj.MarshalJSON()
if err != nil {
Expand Down
Loading