Skip to content

Commit

Permalink
fix(kuma-cp): paginate Secrets correctly in universal (backport of #1…
Browse files Browse the repository at this point in the history
…0954) (#10956)

* fix(kuma-cp): paginate Secrets correctly in universal (#10954)

We were wrapping a store that already had a pagination store with another pagination store.
This led to inconsistent results like:

```
% kumactl get secrets --mesh nonprod --size 1000 | grep -v MESH | wc -l
450
% kumactl get secrets --mesh nonprod --offset 100 | grep -v MESH | wc -l
0
```

Only k8s stores needs to be wrapped with a pagination store, the default store for universal is already paginated:

https://github.com/kumahq/kuma/blob/7075f0e17466c73ec82aa95649124edad6cafe8d/pkg/core/bootstrap/bootstrap.go#L295-L301

https://github.com/kumahq/kuma/blob/7075f0e17466c73ec82aa95649124edad6cafe8d/pkg/plugins/secrets/universal/plugin.go#L17

Signed-off-by: Mike Beaumont <[email protected]>

* fix conflicts

Signed-off-by: Jay Chen <[email protected]>

---------

Signed-off-by: Mike Beaumont <[email protected]>
Signed-off-by: Jay Chen <[email protected]>
Co-authored-by: Mike Beaumont <[email protected]>
Co-authored-by: Jay Chen <[email protected]>
  • Loading branch information
3 people committed Jul 24, 2024
1 parent f3d5557 commit fde462d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/plugins/secrets/k8s/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/pkg/errors"

core_plugins "github.com/kumahq/kuma/pkg/core/plugins"
core_store "github.com/kumahq/kuma/pkg/core/resources/store"
secret_store "github.com/kumahq/kuma/pkg/core/secrets/store"
k8s_extensions "github.com/kumahq/kuma/pkg/plugins/extensions/k8s"
)
Expand All @@ -21,5 +22,10 @@ func (p *plugin) NewSecretStore(pc core_plugins.PluginContext, _ core_plugins.Pl
if !ok {
return nil, errors.Errorf("secret client hasn't been configured")
}
return NewStore(client, client, pc.Config().Store.Kubernetes.SystemNamespace)

coreStore, err := NewStore(client, client, pc.Config().Store.Kubernetes.SystemNamespace)
if err != nil {
return nil, errors.Wrap(err, "couldn't create k8s secret store")
}
return core_store.NewPaginationStore(coreStore), nil
}

0 comments on commit fde462d

Please sign in to comment.