1
0
mirror of https://github.com/rancher/steve.git synced 2025-08-31 23:20:56 +00:00
Commit Graph

617 Commits

Author SHA1 Message Date
Eric Promislow
2cd7997e6b Fix non-vai sorting involving string arrays, add tests. (#618)
- Bump wrangler to get fix for 'GetValueFromAny'.
  This adds string arrays to the types it supports.

- Use a newer go library sort function to maintain a stable sort

- Use the map-sort-map pattern to avoid repeatedly calculating the
  same underlying value for `object[arg1][arg2][...]`
v0.6.14
2025-06-13 10:18:48 -07:00
Chad Roberts
5de54d6a4a Handle int64 field type when adding index fields (#671)
* Handle int64 field type when adding index fields

* add support for float64
2025-06-13 13:04:55 -04:00
Chad Roberts
58f15a4349 check err after client.List call when creating informer (#672) v0.6.13 2025-06-12 17:03:52 -04:00
Josh Meranda
c67ddf2de4 [main] block UI until we receive requests from kube-apiserver (#668)
* block UI until we receive requests from kube-apiserver

* satisfy CI

* undo test code

---------

Co-authored-by: joshmeranda <joshua.meranda@gmail.com>
v0.6.12
2025-06-11 14:58:36 -04:00
Tom Lebreux
1157865ea3 Fix panic due to concurrent map writes (#669)
The same object is given to many HTTP request and they proceed to modify
that object.
v0.6.11
2025-06-11 11:57:48 -04:00
Tom Lebreux
cf97607be5 Return resourceversion too old error to UI instead of logging (#667)
* Return watch error instead of logging it

The UI needs to know about watch error like `resourceversion too old` so
we need to return it.

* Sort by resourceVersion as number

The UI makes some assumption on resourceVersion. It assumes they are a
number and they are ordered by the number value. We'll want to fix this
at some point most likely but for now let's give something in a way that
UI wants.

* Remove -d suffix

After much testing, a delete of an object seems to have its own
resourceVersion so we don't need the -d suffix, we can simply use the
new resourceVersion.
v0.6.10
2025-06-10 17:29:42 -04:00
Eric Promislow
7db113a1fd Add vai access-control for ext Tokens and Kubeconfigs (#651)
* Add vai access-control for tokens.

* Check for both Token and Kubeconfig resources

* Add a unit test for verifying the generated filters for restricted resources.

* Remove a TODO comment as Tom points out we no longer need it.

* Return error if we can't get userinfo from apiOp.Request.Context

* Stop using camelCase for the user ID label.

* Add a test for the admin user.

* And fold the two user-access tests into a single parameterized test.

* Address reviewer comments.

* post-rebase merge fixes

* WIP - add a comment about determining admin users.

---------

Co-authored-by: Peter Matseykanets <peter.matseykanets@suse.com>
2025-06-10 14:28:49 -07:00
Tom Lebreux
f258ebcf31 Add garbage collection for events table (#664)
* Add ListOptionIndexerOptions to create ListOptionIndexer

* Remove unused function

* Implement configurable garbage collection on ListOptionIndexer

* Propagate Steve options from Server
v0.6.9
2025-06-10 12:02:55 -04:00
Tom Lebreux
39fed09b2e Bump apiserver to v0.6.2 (#665) 2025-06-10 08:18:23 -04:00
Tom Lebreux
b4db257cdb Handle transaction failure due to canceled context.Context (#662)
* Re-order SQL event hooks so events are last

* Add QueryRowContext for single line queries

* Add test case for unknown resource version

* Properly check rows and close it

* More accurate error message when context.Context is canceled

* Re-order test check
2025-06-09 15:39:09 -04:00
Tom Lebreux
b695567794 Keep track of events for SQL cache watches (#661)
* Keep track of past events

* Clarify RV acronym

* Fix comment typo

* Rename listEvents variables

* Improve filter readability

* Move defer
v0.6.8
2025-06-05 18:40:19 -04:00
Tom Lebreux
b0aa90cd22 Add watch filtering support for vai (#654)
* Add support for watch filtering

* Remove debug Println

* Validate watch selector
v0.6.7
2025-06-03 18:10:36 -04:00
Tom Lebreux
e3f207ddc2 Add basic watch functionality for SQL cache (#653)
* Remove unused method

* Add basic watch functionality

* Remove TestWatchNamesErrReceive test
2025-06-03 18:07:18 -04:00
Tom Lebreux
2672969496 Add object to RegisterAfterDelete and introduce RegisterAfterDeleteAll (#649)
* Add object to AfterDelete callbacks

* Add RegisterAfterDeleteAll
2025-06-03 17:32:43 -04:00
Tom Lebreux
a8f3ce48d6 Convert tests to real SQL store (#652) 2025-06-02 16:01:45 -06:00
Tom Lebreux
97f07399d6 Bump apiserver to v0.6.1 (#650) 2025-05-30 15:16:29 -04:00
Alejandro Ruiz
06fe9c3ef4 Calculate AccessSets once per request instead of per resource (#647) 2025-05-30 16:32:56 +02:00
Tom Lebreux
55a1b940a0 Split RegisterAfterUpsert into RegisterAfterAdd and RegisterAfterUpdate (#644)
* Split RegisterAfterUpsert into two

We're going to need to be able to differentiate between Add and Update
for storing events in the _events table.

* Update mocks
2025-05-30 08:25:12 -04:00
Tom Lebreux
cb0d9d6d54 Remove limit and continue param for SQL cache (#643) 2025-05-27 09:53:10 -04:00
Tom Lebreux
1e5018e31a Fix returning error for empty ingresses.spec.rules.host (#642)
* Fix returning error for empty ingresses.spec.rules.host

* Fix error format

* Use require instead of assert
v0.6.6
2025-05-20 16:14:19 -04:00
Eric Promislow
18ac23afe7 Support quoting values in queries. (#601)
* Support quoting values in queries.

* Correct test: 'informer' => 'sqltypes', and update description.

* Enable backslash-escaping of quoted strings.
v0.6.5
2025-05-13 11:40:54 -07:00
Chad Roberts
27ed443fff [main] Use Wrangler defined field for resourcePermissions, bump wrangler (#637)
* Remove custom addition of resourcePermissions in favor of wrangler defined type, bump wrangler
v0.6.4
2025-05-13 13:30:27 -04:00
Kevin McDermott
fc5eeae110 Add support for modifying the created Factory clients (#602)
Add support for modifying the created Factory clients

This adds a new functional-opt based mechanism for configuring the factory clients, and provides a new function for allowing consumers to provide the QPS and Burst values for configuring clients.
2025-05-13 08:37:37 +01:00
Alejandro Ruiz
ea01a40c8d Refactor HelmData formatter to avoid importing helm dependencies (#607)
* Small refactor in tests

* Small refactor around decoding

* Refactor decodeHelm3 so we can drop the helm dependency

* Vendor helmv2 protobuf types so we can drop the helmv2 old dependency

* go mod tidy

* Add test with sample HelmV2 data
2025-05-09 09:41:26 -07:00
Chad Roberts
57da759db1 Include namespace-specific permission in schemas (#594)
* Update formatter signature to use the interface to facilitate using a fake for testing
* Add a few unit tests
* Avoid adding empty perms to permissions map
v0.6.3
2025-05-08 05:42:35 -04:00
Peter Matseykanets
9121a52d5d Respect CreateOptions in ext.CreateOrUpdate (#623) 2025-05-05 13:44:51 -04:00
Eric Promislow
e3b881f13a Add context to the remotedialer ping logger - steve side. (#577)
* Add context to the remotedialer ping logger - steve side.

* Use a custom type as a context key instead of a basic string

* Bump remotedialer so it can use the configured context.
v0.6.3-rc.1
2025-04-29 11:24:31 -07:00
Eric Promislow
57ce685118 Sort-indirect PR broken into smaller parts: part 3/6 - pass listOptions by reference (#612)
* Move types related to list options and sql queries into their own package.

The problem having these in the informer package is that eventually code
in other packages will need to import `informer` only for constants or types,
but some members of the informer package may already depend on those. Best to
move type definitions into their own simpler package.

* Fix the ListOptions sort field.

Instead of making it a single array-ish field, convert it into a
true array of Sort Directives.  Easier to read, less bending backwards.

* Pass the listOptions struct by reference to avoid copying.

We never update the ListOptions struct once it's created so there's
no need to pass it by value.

This might be a near-useless optimization...
2025-04-25 11:19:34 -07:00
Eric Promislow
89268ba86b Sort-indirect PR broken into smaller parts: part 2/6 - fix the Sort part of ListOptions (#611)
* Move types related to list options and sql queries into their own package.

The problem having these in the informer package is that eventually code
in other packages will need to import `informer` only for constants or types,
but some members of the informer package may already depend on those. Best to
move type definitions into their own simpler package.

* Fix the ListOptions sort field.

Instead of making it a single array-ish field, convert it into a
true array of Sort Directives.  Easier to read, less bending backwards.

* Rebasing (or human error) duplicated 'NewSortList'.
2025-04-25 10:15:20 -07:00
Eric Promislow
2b227dbd22 Move types related to list options and sql queries into their own package. (#610)
The problem having these in the informer package is that eventually code
in other packages will need to import `informer` only for constants or types,
but some members of the informer package may already depend on those. Best to
move type definitions into their own simpler package.
2025-04-25 09:11:09 -07:00
renovate-rancher[bot]
392a95f753 chore(deps): update module github.com/rancher/dynamiclistener to v0.6.2 (#495)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2025-04-23 16:35:55 -07:00
renovate-rancher[bot]
83cf2ac76f chore(deps): update module helm.sh/helm/v3 to v3.17.2 (#337)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2025-04-22 13:20:22 -07:00
Sakala Venkata Krishna Rohit
2f12b40974 Add log message to log the error from http client (#595) v0.6.2 2025-04-11 13:09:34 -07:00
Sakala Venkata Krishna Rohit
da9bc2a114 Update urfave/cli to v2 (#523) 2025-04-08 12:46:32 -07:00
Sakala Venkata Krishna Rohit
5ae8585e5d Fix namespace access control in steve (#568)
* Fix adding namespace resource access

* Add tests for addResourceAccess func
2025-04-07 17:40:43 -07:00
Tom Lebreux
e1061a86cd Update branch (#549)
* Update branch

* Update norman and apiserver to v0.6.0
2025-03-18 11:36:01 -04:00
Tom Lebreux
b29f7d505c Reapply "Fix not finding ClusterRoleBinding or RoleBinding for service account…" (#540) (#550)
This reverts commit 53f2165aee.
v0.6.1
2025-03-14 11:52:28 -04:00
Tom Lebreux
53f2165aee Revert "Fix not finding ClusterRoleBinding or RoleBinding for service account…" (#540)
This reverts commit 0f4fd1fde6.
v0.5.12 v0.6.0
2025-03-11 11:14:21 -04:00
Tom Lebreux
0f4fd1fde6 Fix not finding ClusterRoleBinding or RoleBinding for service accounts (#539) v0.5.11 2025-03-10 13:35:01 -04:00
Eric Promislow
f486902100 Add support for another field: (#532)
provisioning.cattle.io.clusters\
metadata.annotations[provisioning.cattle.io/management-cluster-display-name]

Needed to add another character to the subfieldRegex in
listoption_indexer to allow hyphens in annotation field names.
v0.5.10
2025-03-05 12:53:59 -08:00
Eric Promislow
2f331b1a1a Ensure complex accessors from schema don't result in double-bracketing. (#531) v0.5.9 2025-03-04 09:52:35 -08:00
Eric Promislow
2711fd1f46 Added more fields - part 6. (#485)
* Added more fields - part 6.

* Tweaks needed to get 'batch.cronjobs' working

* Add a clarifying comment on pulling values out of an array.

* Use the correct capitalization for the etcd-snapshot kind.
2025-03-04 09:31:21 -08:00
Eric Promislow
0edba0da3e Sort labels (#527)
* Support sorting on metadata.labels.NAME

The key to doing this is if we want to sort on, say, `metadata.labels.foo`, we need to
search for all rows with a label of the name `foo` in all the various
join tables we create for each label the query references.

We ignore nulls by giving them lowest priority using "NULLS LAST"
("NULLS FIRST" if sorting in descending order).

* Ensure labels that are mentioned only in sort params are still selected.

If we don't do this -- say we sort on metadata.labels.foo but never
make a test on it, the sort resuilts are ignored.

* Remove extraneous debugger statements.
2025-03-04 09:30:14 -08:00
renovate-rancher[bot]
a85993129e chore(deps): update module modernc.org/sqlite to v1.36.0 (#528)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2025-02-27 17:10:58 -05:00
Eric Promislow
3b45729415 Generate field names with brackets when needed. (#477)
* Generate field names with brackets when needed.

* Stop hard-wiring complex selectors as `["field1", "field2[sub-field3]"]`

and instead represent them as a more consistent `["field1", "field2", "sub-field3"]`

* Convert all filter strings ending with square brackets to an array.

Stop special-casing 'metadata.labels[X]' and handle any query string that ends with '[...]'.

* Stop checking for pre-bracketed terms in constant field-accessor arrays.

In this commit we stop converting string arrays like
`["metadata", "labels[k8s.io/deepcode]"]` into the database field
`"metadata.labels[k8s.io/deepcode]"` and instead will do a
naive `join` to give `metadata[labels[k8s.io/deepcode]]`.  The solution
is to never express the above terms in separate fields, like
`["metadata", "labels", "k8s.io/deepcode"]`. This also better reflects
the stucture of the referenced object.

* gofmt changes

* Simplify comment about 'smartJoin'.
v0.5.8
2025-02-25 10:39:29 -08:00
Sakala Venkata Krishna Rohit
527d44a3a7 Bump golang lint (#524) 2025-02-24 09:51:38 -08:00
renovate-rancher[bot]
078ddfe47d chore(deps): update module github.com/rancher/saml to v0.4.14 (#496)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2025-02-23 10:59:59 -08:00
Sakala Venkata Krishna Rohit
0c73b199be Update renovate.json to ignore packages (#516)
* Rancher 2.7 is EOL, so removing release/v0.1

* Ignore dependencies for steve renovate

* Ignore major, minor bumps of rancher deps

* test
2025-02-21 10:37:19 -08:00
Eric Promislow
c906c36bc3 support unwatchables in vai (#458)
* Create and use a synthetic watcher for non-watchable resources.

* Write unit tests for the synthetic watcher.

* Make the refresh interval for synthetic watchers configurable.

The default is to call `client.List(...)` every 5 seconds for each unwatchable GVK.

There are currently only 3 such GVKs right now so this will be informative
enough but not really noticeable.

* Pass the context into the synthetic watch func.

* Restore changes lost in rebasing.

---------

Co-authored-by: Tom Lebreux <tom.lebreux@suse.com>
v0.5.7
2025-02-20 12:45:58 -08:00
Alejandro Ruiz
6559fa9ad7 Fix "Unable to cancel request for *client.addQuery" warnings (#512) 2025-02-20 12:03:03 -05:00