Skip to content

Commit e0180e2

Browse files
authored
Disable WatchListClient for Tokens and Kubeconfigs (#1034)
* Disable WatchListClient for Tokens and Kubeconfigs * Bump lasso and wrangler
1 parent ca453a3 commit e0180e2

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ require (
3232
github.com/rancher/apiserver v0.8.3
3333
github.com/rancher/dynamiclistener v0.7.4-rc.2
3434
github.com/rancher/kubernetes-provider-detector v0.1.6-0.20240606163014-fcae75779379
35-
github.com/rancher/lasso v0.2.6
35+
github.com/rancher/lasso v0.2.7
3636
github.com/rancher/norman v0.8.4
3737
github.com/rancher/remotedialer v0.6.0-rc.1
38-
github.com/rancher/wrangler/v3 v3.4.0
38+
github.com/rancher/wrangler/v3 v3.5.0-rc.2
3939
github.com/sirupsen/logrus v1.9.4
4040
github.com/stretchr/testify v1.11.1
4141
github.com/tinylib/msgp v1.6.3

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@ github.com/rancher/dynamiclistener v0.7.4-rc.2 h1:rmsTukH0QUx4v6BpV3hArFccu+6LDu
185185
github.com/rancher/dynamiclistener v0.7.4-rc.2/go.mod h1:Xuq3XpoFO+6j8te9w/3rlrhhALME47jw5xWhueT5iYY=
186186
github.com/rancher/kubernetes-provider-detector v0.1.6-0.20240606163014-fcae75779379 h1:/DKzOm5Du2jPLE5rXPGhsb0XeT68kWEIRi6jnzMeyGk=
187187
github.com/rancher/kubernetes-provider-detector v0.1.6-0.20240606163014-fcae75779379/go.mod h1:IfqyXrTiCAg8rTJodbGApTiORgujJnBH+QyHHJlFSII=
188-
github.com/rancher/lasso v0.2.6 h1:/QNO491vWlTNYgwOOopRlILcTv+pI/wBHYdPFD2Pk5E=
189-
github.com/rancher/lasso v0.2.6/go.mod h1:L3ol8PdO21KoMhNa3RWjpR3ZBnE70JCAod1nJuOvT1E=
188+
github.com/rancher/lasso v0.2.7 h1:N56Pm8KJSk7gRVYILSGb35QBfjcDDeGFMfwUCivsbeg=
189+
github.com/rancher/lasso v0.2.7/go.mod h1:L3ol8PdO21KoMhNa3RWjpR3ZBnE70JCAod1nJuOvT1E=
190190
github.com/rancher/norman v0.8.4 h1:/3xPNdR85lDU5RIfuai8oBJjzSrS/umSjOQ+7M3njKc=
191191
github.com/rancher/norman v0.8.4/go.mod h1:9khwZhpsg8QmWnAJSJ3luAyxJKMzKKJgoxi0fqXron4=
192192
github.com/rancher/remotedialer v0.6.0-rc.1 h1:HMwcJjjT4irqM+d++jPcpjoNfhPCaxoHIyPzdpghZhE=
193193
github.com/rancher/remotedialer v0.6.0-rc.1/go.mod h1:CW6Q8F8IESN05/yl48OSwhVi54nDwVQQriV16zAiGkg=
194-
github.com/rancher/wrangler/v3 v3.4.0 h1:pEZ9wIM3k5EZkVXU2TbD6mWVfw5mtdv1v0PRJ7fPQxw=
195-
github.com/rancher/wrangler/v3 v3.4.0/go.mod h1:bRcdkdwRTwoXVSWVGtJdSBNXkKbInlo+PVkCtkUCi4s=
194+
github.com/rancher/wrangler/v3 v3.5.0-rc.2 h1:actO3J77tGT8Ub0/VsI573iRLJf+BTnmi307xV+sBhY=
195+
github.com/rancher/wrangler/v3 v3.5.0-rc.2/go.mod h1:bRcdkdwRTwoXVSWVGtJdSBNXkKbInlo+PVkCtkUCi4s=
196196
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
197197
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
198198
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=

pkg/clustercache/controller.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,17 @@ func (h *clusterCache) OnSchemas(schemas *schema.Collection) error {
150150
opts := &client.Options{
151151
Schema: schema.Schema,
152152
}
153-
summaryInformer := informer.NewFilteredSummaryInformerWithOptions(h.summaryClient, gvr, opts, metav1.NamespaceAll, 2*time.Hour,
153+
kubeconfigGVK := schema2.GroupVersionKind{Group: "ext.cattle.io", Version: "v1", Kind: "Kubeconfig"}
154+
tokenGVK := schema2.GroupVersionKind{Group: "ext.cattle.io", Version: "v1", Kind: "Token"}
155+
client := h.summaryClient
156+
// Due to a bug in Rancher's extension apiserver for the token and kubeconfig APIs, we
157+
// must disable the WatchList features for those APIs.
158+
if gvk == kubeconfigGVK || gvk == tokenGVK {
159+
client = &noWatchListClient{
160+
ExtendedInterface: h.summaryClient,
161+
}
162+
}
163+
summaryInformer := informer.NewFilteredSummaryInformerWithOptions(client, gvr, opts, metav1.NamespaceAll, 2*time.Hour,
154164
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, nil)
155165
ctx, cancel := context.WithCancel(h.ctx)
156166
w := &watcher{
@@ -300,3 +310,12 @@ func callAll(handlers []interface{}, gvr schema2.GroupVersionKind, key string, o
300310

301311
return obj, merr.NewErrors(errs...)
302312
}
313+
314+
// noWatchListListWatch disables WatchList feature
315+
type noWatchListClient struct {
316+
client.ExtendedInterface
317+
}
318+
319+
func (n *noWatchListClient) IsWatchListSemanticsUnSupported() bool {
320+
return true
321+
}

0 commit comments

Comments
 (0)