Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
66660498
Commit
66660498
authored
Dec 19, 2018
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved memory-cached and disk-cached discovery to their own packages
parent
64ce2e59
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
15 deletions
+17
-15
cached_discovery.go
...8s.io/client-go/discovery/cached/disk/cached_discovery.go
+10
-9
cached_discovery_test.go
.../client-go/discovery/cached/disk/cached_discovery_test.go
+3
-2
round_tripper.go
...c/k8s.io/client-go/discovery/cached/disk/round_tripper.go
+1
-1
round_tripper_test.go
....io/client-go/discovery/cached/disk/round_tripper_test.go
+1
-1
BUILD
staging/src/k8s.io/client-go/discovery/cached/memory/BUILD
+0
-0
memcache.go
.../src/k8s.io/client-go/discovery/cached/memory/memcache.go
+1
-1
memcache_test.go
...k8s.io/client-go/discovery/cached/memory/memcache_test.go
+1
-1
No files found.
staging/src/k8s.io/client-go/discovery/cached_discovery.go
→
staging/src/k8s.io/client-go/discovery/cached
/disk/cached
_discovery.go
View file @
66660498
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
dis
covery
package
dis
k
import
(
"errors"
...
...
@@ -31,6 +31,7 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/version"
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes/scheme"
restclient
"k8s.io/client-go/rest"
)
...
...
@@ -38,7 +39,7 @@ import (
// CachedDiscoveryClient implements the functions that discovery server-supported API groups,
// versions and resources.
type
CachedDiscoveryClient
struct
{
delegate
DiscoveryInterface
delegate
discovery
.
DiscoveryInterface
// cacheDirectory is the directory where discovery docs are held. It must be unique per host:port combination to work well.
cacheDirectory
string
...
...
@@ -57,7 +58,7 @@ type CachedDiscoveryClient struct {
fresh
bool
}
var
_
CachedDiscoveryInterface
=
&
CachedDiscoveryClient
{}
var
_
discovery
.
CachedDiscoveryInterface
=
&
CachedDiscoveryClient
{}
// ServerResourcesForGroupVersion returns the supported resources for a group and version.
func
(
d
*
CachedDiscoveryClient
)
ServerResourcesForGroupVersion
(
groupVersion
string
)
(
*
metav1
.
APIResourceList
,
error
)
{
...
...
@@ -92,13 +93,13 @@ func (d *CachedDiscoveryClient) ServerResourcesForGroupVersion(groupVersion stri
// ServerResources returns the supported resources for all groups and versions.
// Deprecated: use ServerGroupsAndResources instead.
func
(
d
*
CachedDiscoveryClient
)
ServerResources
()
([]
*
metav1
.
APIResourceList
,
error
)
{
_
,
rs
,
err
:=
ServerGroupsAndResources
(
d
)
_
,
rs
,
err
:=
discovery
.
ServerGroupsAndResources
(
d
)
return
rs
,
err
}
// ServerGroupsAndResources returns the supported groups and resources for all groups and versions.
func
(
d
*
CachedDiscoveryClient
)
ServerGroupsAndResources
()
([]
*
metav1
.
APIGroup
,
[]
*
metav1
.
APIResourceList
,
error
)
{
return
ServerGroupsAndResources
(
d
)
return
discovery
.
ServerGroupsAndResources
(
d
)
}
// ServerGroups returns the supported groups, with information like supported versions and the
...
...
@@ -220,13 +221,13 @@ func (d *CachedDiscoveryClient) RESTClient() restclient.Interface {
// ServerPreferredResources returns the supported resources with the version preferred by the
// server.
func
(
d
*
CachedDiscoveryClient
)
ServerPreferredResources
()
([]
*
metav1
.
APIResourceList
,
error
)
{
return
ServerPreferredResources
(
d
)
return
discovery
.
ServerPreferredResources
(
d
)
}
// ServerPreferredNamespacedResources returns the supported namespaced resources with the
// version preferred by the server.
func
(
d
*
CachedDiscoveryClient
)
ServerPreferredNamespacedResources
()
([]
*
metav1
.
APIResourceList
,
error
)
{
return
ServerPreferredNamespacedResources
(
d
)
return
discovery
.
ServerPreferredNamespacedResources
(
d
)
}
// ServerVersion retrieves and parses the server's version (git version).
...
...
@@ -279,7 +280,7 @@ func NewCachedDiscoveryClientForConfig(config *restclient.Config, discoveryCache
})
}
discoveryClient
,
err
:=
NewDiscoveryClientForConfig
(
config
)
discoveryClient
,
err
:=
discovery
.
NewDiscoveryClientForConfig
(
config
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -288,7 +289,7 @@ func NewCachedDiscoveryClientForConfig(config *restclient.Config, discoveryCache
}
// NewCachedDiscoveryClient creates a new DiscoveryClient. cacheDirectory is the directory where discovery docs are held. It must be unique per host:port combination to work well.
func
newCachedDiscoveryClient
(
delegate
DiscoveryInterface
,
cacheDirectory
string
,
ttl
time
.
Duration
)
*
CachedDiscoveryClient
{
func
newCachedDiscoveryClient
(
delegate
discovery
.
DiscoveryInterface
,
cacheDirectory
string
,
ttl
time
.
Duration
)
*
CachedDiscoveryClient
{
return
&
CachedDiscoveryClient
{
delegate
:
delegate
,
cacheDirectory
:
cacheDirectory
,
...
...
staging/src/k8s.io/client-go/discovery/cached_discovery_test.go
→
staging/src/k8s.io/client-go/discovery/cached
/disk/cached
_discovery_test.go
View file @
66660498
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
dis
covery
package
dis
k
import
(
"io/ioutil"
...
...
@@ -29,6 +29,7 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
"k8s.io/client-go/discovery"
restclient
"k8s.io/client-go/rest"
"k8s.io/client-go/rest/fake"
)
...
...
@@ -104,7 +105,7 @@ type fakeDiscoveryClient struct {
serverResourcesHandler
func
()
([]
*
metav1
.
APIResourceList
,
error
)
}
var
_
DiscoveryInterface
=
&
fakeDiscoveryClient
{}
var
_
discovery
.
DiscoveryInterface
=
&
fakeDiscoveryClient
{}
func
(
c
*
fakeDiscoveryClient
)
RESTClient
()
restclient
.
Interface
{
return
&
fake
.
RESTClient
{}
...
...
staging/src/k8s.io/client-go/discovery/round_tripper.go
→
staging/src/k8s.io/client-go/discovery/
cached/disk/
round_tripper.go
View file @
66660498
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
dis
covery
package
dis
k
import
(
"net/http"
...
...
staging/src/k8s.io/client-go/discovery/round_tripper_test.go
→
staging/src/k8s.io/client-go/discovery/
cached/disk/
round_tripper_test.go
View file @
66660498
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
dis
covery
package
dis
k
import
(
"bytes"
...
...
staging/src/k8s.io/client-go/discovery/cached/BUILD
→
staging/src/k8s.io/client-go/discovery/cached/
memory/
BUILD
View file @
66660498
File moved
staging/src/k8s.io/client-go/discovery/cached/memcache.go
→
staging/src/k8s.io/client-go/discovery/cached/mem
ory/mem
cache.go
View file @
66660498
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
cached
package
memory
import
(
"errors"
...
...
staging/src/k8s.io/client-go/discovery/cached/memcache_test.go
→
staging/src/k8s.io/client-go/discovery/cached/mem
ory/mem
cache_test.go
View file @
66660498
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
cached
package
memory
import
(
"errors"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment