Skip to content

Commit

Permalink
Deprecate client-side validation in the direct applier
Browse files Browse the repository at this point in the history
The kube 1.28 libraries made client-side validation much harder.

We should be using server-side validation anyway.
  • Loading branch information
justinsb committed Sep 11, 2023
1 parent 55ff419 commit a28bcba
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions pkg/patterns/declarative/pkg/applier/direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,8 @@ func (d *DirectApplier) Apply(ctx context.Context, opt ApplierOptions) error {
}

if opt.Validate {
// validation likely makes redundant apiserver requests and is less optimized than the non-validation case,
// but validation isn't the common path

dynamicClient, err := f.DynamicClient()
if err != nil {
return err
}
nqpv := resource.NewQueryParamVerifier(dynamicClient, f.OpenAPIGetter(), resource.QueryParamFieldValidation)

v, err := d.inner.NewFactory(opt).Validator(metav1.FieldValidationStrict, nqpv)

if err != nil {
return err
}
b.Schema(v)
// client-side validation is no longer recommended, in favor of server-side apply/validation
return fmt.Errorf("client-side validation is no longer supported")
}

var errs []error
Expand Down

0 comments on commit a28bcba

Please sign in to comment.