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

Restmapper cache #1508

Merged
merged 5 commits into from
Nov 29, 2021
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
32 changes: 17 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ require (
github.com/Masterminds/semver v1.5.0
github.com/agext/levenshtein v1.2.3 // indirect
github.com/aws/aws-sdk-go v1.38.20 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/getkin/kin-openapi v0.66.0
github.com/go-errors/errors v1.1.1 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
Expand All @@ -19,7 +21,7 @@ require (
github.com/google/go-cmp v0.5.6
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.4 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v0.16.0
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -35,6 +37,7 @@ require (
github.com/hashicorp/terraform-plugin-test/v2 v2.2.1
github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 // indirect
github.com/jinzhu/copier v0.2.9
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.12.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/go-homedir v1.1.0
Expand All @@ -52,32 +55,31 @@ require (
github.com/zclconf/go-cty v1.8.4
go.starlark.net v0.0.0-20210406145628-7a1108eaa012 // indirect
golang.org/x/mod v0.4.2
golang.org/x/net v0.0.0-20210414194228-064579744ee0 // indirect
golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78 // indirect
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/term v0.0.0-20210406210042-72f3dc4e9b72 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a // indirect
google.golang.org/api v0.44.0 // indirect
google.golang.org/genproto v0.0.0-20210415145412-64678f1ae2d5 // indirect
google.golang.org/grpc v1.37.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.21.2
k8s.io/apiextensions-apiserver v0.21.2
k8s.io/apimachinery v0.21.2
k8s.io/client-go v11.0.0+incompatible
k8s.io/kube-aggregator v0.21.0
k8s.io/kube-openapi v0.0.0-20210323165736-1a6458611d18 // indirect
k8s.io/kubectl v0.21.0
k8s.io/utils v0.0.0-20210305010621-2afb4311ab10 // indirect
sigs.k8s.io/kustomize/api v0.8.7 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.1 // indirect
k8s.io/api v0.21.7
k8s.io/apiextensions-apiserver v0.21.7
k8s.io/apimachinery v0.21.7
k8s.io/client-go v0.21.7
k8s.io/kube-aggregator v0.21.7
k8s.io/kubectl v0.21.7
k8s.io/utils v0.0.0-20210802155522-efc7438f0176 // indirect
)

// kustomize needs to be kept in sync with the cli-runtime.
// go-openapi needs to be locked at a version that is compatible with kustomize
replace (
github.com/go-openapi/spec => github.com/go-openapi/spec v0.19.9
k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.0
k8s.io/client-go => k8s.io/client-go v0.21.0
k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.7
k8s.io/client-go => k8s.io/client-go v0.21.7
sigs.k8s.io/kustomize/pkg/transformers => ./vendor/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer
sigs.k8s.io/kustomize/pkg/transformers/config => ./vendor/k8s.io/cli-runtime/pkg/kustomize/k8sdeps/transformer/config
)
Expand Down
114 changes: 52 additions & 62 deletions go.sum

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions manifest/provider/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,6 @@ func (s *RawProviderServer) ApplyResourceChange(ctx context.Context, req *tfprot

resp.NewState = req.PlannedState
}
// force a refresh of the OpenAPI foundry on next use
// we do this to capture any potentially new resource type that might have been added
s.OAPIFoundry = nil // this needs to be optimized to refresh only when CRDs are applied (or maybe other schema altering resources too?)

return resp, nil
}
Expand Down
18 changes: 11 additions & 7 deletions manifest/provider/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/client-go/discovery"
"k8s.io/client-go/discovery/cached/memory"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest"
"k8s.io/client-go/restmapper"
Expand Down Expand Up @@ -66,13 +67,16 @@ func (ps *RawProviderServer) getRestMapper() (meta.RESTMapper, error) {
if err != nil {
return nil, err
}
agr, err := restmapper.GetAPIGroupResources(dc)
if err != nil {
return nil, err
}
mapper := restmapper.NewDiscoveryRESTMapper(agr)
ps.restMapper = mapper
return mapper, nil

// agr, err := restmapper.GetAPIGroupResources(dc)
// if err != nil {
// return nil, err
// }
// mapper := restmapper.NewDeferredDiscoveryRESTMapper(agr)

cache := memory.NewMemCacheClient(dc)
ps.restMapper = restmapper.NewDeferredDiscoveryRESTMapper(cache)
return ps.restMapper, nil
}

// getRestClient returns a raw REST client instance
Expand Down
19 changes: 0 additions & 19 deletions vendor/github.com/evanphx/json-patch/.travis.yml

This file was deleted.

19 changes: 19 additions & 0 deletions vendor/github.com/evanphx/json-patch/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 18 additions & 15 deletions vendor/github.com/evanphx/json-patch/merge.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/evanphx/json-patch/patch.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions vendor/github.com/form3tech-oss/jwt-go/map_claims.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading