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
8170cf0f
Commit
8170cf0f
authored
May 30, 2017
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to make the watch cache for CRs match first return values
parent
78ced8e4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
customresource_handler.go
...extensions-server/pkg/apiserver/customresource_handler.go
+11
-0
No files found.
staging/src/k8s.io/kube-apiextensions-server/pkg/apiserver/customresource_handler.go
View file @
8170cf0f
...
@@ -275,6 +275,17 @@ func (r *crdHandler) getServingInfoFor(crd *apiextensions.CustomResourceDefiniti
...
@@ -275,6 +275,17 @@ func (r *crdHandler) getServingInfoFor(crd *apiextensions.CustomResourceDefiniti
r
.
restOptionsGetter
,
r
.
restOptionsGetter
,
)
)
// When new REST storage is created, the storage cacher for the CR starts asynchronously.
// REST API operations return like list use the RV of etcd, but the storage cacher's reflector's list
// can get a different RV because etcd can be touched in between the initial list operation (if that's what you're doing first)
// and the storage cache reflector starting.
// Later, you can issue a watch with the REST apis list.RV and end up earlier than the storage cacher.
// The time window is really narrow, but it can happen. The simplest "solution" is to wait
// briefly for the storage cache to start before we return out new storage so its more likely that we'll have valid
// resource versions for the watch cache. We don't expose cache status outside of the caching layer
// so I can't think of way to determine it reliably.
time
.
Sleep
(
1
*
time
.
Second
)
parameterScheme
:=
runtime
.
NewScheme
()
parameterScheme
:=
runtime
.
NewScheme
()
parameterScheme
.
AddUnversionedTypes
(
schema
.
GroupVersion
{
Group
:
crd
.
Spec
.
Group
,
Version
:
crd
.
Spec
.
Version
},
parameterScheme
.
AddUnversionedTypes
(
schema
.
GroupVersion
{
Group
:
crd
.
Spec
.
Group
,
Version
:
crd
.
Spec
.
Version
},
&
metav1
.
ListOptions
{},
&
metav1
.
ListOptions
{},
...
...
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