Skip to content

Commit

Permalink
tf: cache open api schema fetch (istio#41392)
Browse files Browse the repository at this point in the history
This makes tests 4x faster on my machine (kind).

I have no clue why a *Cached*DiscoveryClient implements
OpenAPISchemaGetter in an uncached manner, while this method is cached,
but its out of our control. This mirrors kubectl, which uses an in
memory cached variant.
  • Loading branch information
howardjohn authored Oct 13, 2022
1 parent a9e7c85 commit d68a4ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/kube/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,8 +1048,8 @@ func (c *client) applyYAMLFile(namespace string, dryRun bool, file string) error
return err
}
opts.DynamicClient = c.dynamic
opts.DryRunVerifier = resource.NewQueryParamVerifier(c.dynamic, c.discoveryClient, resource.QueryParamDryRun)
opts.FieldValidationVerifier = resource.NewQueryParamVerifier(c.dynamic, c.discoveryClient, resource.QueryParamFieldValidation)
opts.DryRunVerifier = resource.NewQueryParamVerifier(c.dynamic, c.clientFactory.OpenAPIGetter(), resource.QueryParamDryRun)
opts.FieldValidationVerifier = resource.NewQueryParamVerifier(c.dynamic, c.clientFactory.OpenAPIGetter(), resource.QueryParamFieldValidation)
opts.FieldManager = fieldManager
if dryRun {
opts.DryRunStrategy = util.DryRunServer
Expand Down Expand Up @@ -1180,7 +1180,7 @@ func (c *client) deleteFile(namespace string, dryRun bool, file string) error {
opts.WaitForDeletion = true
opts.WarnClusterScope = enforceNamespace
opts.DynamicClient = c.dynamic
opts.DryRunVerifier = resource.NewQueryParamVerifier(c.dynamic, c.discoveryClient, resource.QueryParamDryRun)
opts.DryRunVerifier = resource.NewQueryParamVerifier(c.dynamic, c.clientFactory.OpenAPIGetter(), resource.QueryParamDryRun)

if dryRun {
opts.DryRunStrategy = util.DryRunServer
Expand Down

0 comments on commit d68a4ab

Please sign in to comment.