1
0
mirror of https://github.com/rancher/steve.git synced 2025-04-27 11:00:48 +00:00
Commit Graph

269 Commits

Author SHA1 Message Date
Alejandro Ruiz
435e220795 fix(accesscontrol): CacheKey could not be stable 2024-07-31 10:24:23 +02:00
Silvio Moioli
0841e03c57
sql: bugfix: return total resource count correctly (#236)
* sql: drop dead code

Signed-off-by: Silvio Moioli <silvio@moioli.net>

* sql: bugfix: return total resource count correctly

Signed-off-by: Silvio Moioli <silvio@moioli.net>

* adapt tests

Signed-off-by: Silvio Moioli <silvio@moioli.net>

* adapt mocks

Signed-off-by: Silvio Moioli <silvio@moioli.net>

* TEMP: remove this when bumping lasso to include https://github.com/rancher/lasso/pull/84

Signed-off-by: Silvio Moioli <silvio@moioli.net>

* Use latest lasso instead of fork

---------

Signed-off-by: Silvio Moioli <silvio@moioli.net>
Co-authored-by: Tom Lebreux <tom.lebreux@suse.com>
2024-07-05 16:17:16 -04:00
Silvio Moioli
88fd70abbd sql: drop dead code
Signed-off-by: Silvio Moioli <silvio@moioli.net>
2024-07-05 16:08:56 +02:00
Silvio Moioli
cb311a8ce5 sql: remove spurious log line
Signed-off-by: Silvio Moioli <silvio@moioli.net>
2024-07-05 10:19:07 +02:00
Michael Bolot
e7a76d14f0 Adding APIGroups back to the schema
Prior schema calculations started with openapiv2 models which included a
model for APIGroups. However, new schema calculations use
ServerGroupsAndResources first, which omitted these values. This
re-adds this type using a static schema.
2024-07-02 13:27:04 -05:00
Tom Lebreux
9ac9be9c0e
Fix missing fields in schema definition endpoint (#215) 2024-06-17 10:52:19 -04:00
vardhaman22
8f3d2e8f21 go generate and go mod tidy 2024-06-05 23:08:15 +05:30
vardhaman22
dae842ea98 updated wrangler from v2 to v3
also updated k8s dependencies to v0.30.1
2024-06-05 22:53:08 +05:30
Silvio Moioli
7a84620e8b
SQLite backed cache (#223)
This uses SQLite-backed informers provided by Lasso with https://github.com/rancher/lasso/pull/65 to implement Steve API (/v1/) functionality.

This new functionality is available behind a feature flag to be specified at Steve startup

See https://confluence.suse.com/pages/viewpage.action?pageId=1359086083 

Co-authored-by: Ricardo Weir <ricardo.weir@suse.com>
Co-authored-by: Michael Bolot <michael.bolot@suse.com>
Co-authored-by: Silvio Moioli <silvio@moioli.net>
Signed-off-by: Silvio Moioli <silvio@moioli.net>
2024-06-05 16:17:12 +02:00
Michael Bolot
c6b887c1cb Fixing schema definitions bugs
Fixes two bugs with the schema definitions:
- Adds resources that are a part of the baseSchema (but aren't k8s resources).
- Adds logic to handle resources which aren't in a prefered version, but
  are still in some version.
2024-05-15 08:43:35 -05:00
Ricardo Weir
d42a5bc545
Skip key generation if cache disabled (#170) 2024-04-19 09:43:15 -04:00
Michael Bolot
bcba9d5e3b
Merge pull request #180 from MbolotSuse/flaky-test
Attempting to fix flaky tests
2024-04-04 08:23:08 -05:00
Michael Bolot
0e9fde750f Attempting to fix flaky tests
Some tests which relied on timeouts were a bit flaky in CI. This PR
refactors a few of them to work on a more reliable method of receiving
from a channel and raises the timeout of another test.
2024-04-03 15:32:23 -05:00
Diogo Souza
46e3638cd8
changing permission for kubeconfig file inside the shell pod (#166)
* changing permission for kubeconfig file inside the shell pod

* creating unit tests for the changes done
2024-04-03 13:33:37 -04:00
Michael Bolot
870824dc8f
Merge pull request #161 from MbolotSuse/resource-schema-improved-cache
Resource schema improved cache
2024-03-14 09:57:06 -05:00
Jonathan Crowther
ca29f475f0
Merge pull request #162 from JonCrowther/count-race-condition
Fix race condition in debounceCounts
2024-03-14 10:52:28 -04:00
Jonathan Crowther
abbe805737 Change which object needs DeepCopy 2024-03-13 19:41:21 -04:00
Michael Bolot
b7618463e6 Fixing bug with preferred versions
In the original implementation of the definition handler, the resource
list was checked for preferred version, and this overrode the preferred
version of the overall group. However, this logic was inaccurate and
did not use the group as the source of truth on the preferred version
like it should have.
2024-03-12 13:59:17 -05:00
Michael Bolot
0f32ff22e0 Adding tests for improved schema cache 2024-03-12 13:53:51 -05:00
Michael Bolot
2f8e64840b Improving Schema Definitions cache/refresh
Updates the schema definitions refresh method to use a new debounce
method. Adds a handler which refreshes the definitions every 2
seconds after adding a CRD and every 10 minutes by default.
2024-03-12 13:49:39 -05:00
Jonathan Crowther
cec59c5a61 Implement custom DeepCopy for Count 2024-03-01 11:56:18 -05:00
Jonathan Crowther
0e74495395 DeepCopy the count before sending it as APIEvent 2024-03-01 10:50:35 -05:00
Michael Bolot
7913f2782a
Merge pull request #141 from moio/watchnames_propagate_errors
WatchNames: return errors via WebSocket
2024-03-01 09:48:41 -06:00
Michael Bolot
099ebc509f Adding tests for schemaDefinitions 2024-02-26 15:42:07 -06:00
Michael Bolot
40f6b10fc7 Adding schema definitions endpoint
Introduces new schema definitions endpoint, allowing the caller to get
the fields/types/descriptions for a given kubernetes resource.
2024-02-26 15:42:03 -06:00
Michael Bolot
3f65942a6a Tests for Reducing number of generated schemas 2024-02-26 15:39:41 -06:00
Michael Bolot
605e74c97a Reducing number of generated schemas
Changes steve to only return top level schema definitions rather
than a full defined schema for every field. Also adds basic docs
and fixes a bug with schema generation on versioned crds
2024-02-26 09:20:42 -06:00
Kevin Joiner
e35a044d5a Bumps rancher/wrangler to it's tagged v2 version.
The previous wrangler commit included all of the v2 changes.
Except for the import paths changes.
2024-01-24 10:24:01 -05:00
Silvio Moioli
d138622063
adapt tests
Signed-off-by: Silvio Moioli <silvio@moioli.net>
2024-01-23 11:25:29 +01:00
Silvio Moioli
1585ed3f7a
WatchNames: return errors via WebSocket
Align behavior with plain Watch, which also does the same.

Fixes https://github.com/rancher/rancher/issues/41809

Signed-off-by: Silvio Moioli <silvio@moioli.net>
2023-12-22 20:10:51 +01:00
Michael Bolot
0b23400f9f Updating ByNames to not return nil, nil
ByNames could previously return a nil value and a nil error. This caused
issues when other parts of the application
(pkg/stores/partition/parallel.go) tried to use the result. Now this
will return an empty list on the error condition, instead of nil
2023-10-16 14:33:35 -05:00
Colleen Murphy
52e7ebfd1b Fix partition unit test
Remove unnecessary items from the `access` slice in one of the unit
tests. Each item in `access` corresponds to one request in `apiOps`, so
they should have the same number of elements.
2023-09-20 13:58:37 -07:00
vardhaman22
ebc8b721a8 updated deps for k8s 1.27 2023-08-23 00:42:52 +05:30
Colleen Murphy
d040cffef3
Merge pull request #112 from cmurphy/unformatter-store
Drop unrecognized fields before update
2023-07-17 09:02:51 -07:00
Colleen Murphy
adaa391ddf Drop unrecognized fields before update
Add a nested store to the proxy store to strip non-Kubernetes fields
from the object being updated.

The steve formatter and proxy store adds fields to objects when it
outputs them to the client, for usability by the UI. It adds the
object's fields[1], relationships to other objects[2], a summary of the
object's state[3], and additional information in the conditions[4].
These fields are not native to Kubernetes, so when a client submits the
object back as an update, Kubernetes reports a warning that they are
unrecognized. This change ensures the extra fields are removed before
submitting the update.

[1] bf2e9655f5/pkg/stores/proxy/proxy_store.go (L189)
[2] bf2e9655f5/pkg/resources/common/formatter.go (L106)
[3] bf2e9655f5/pkg/resources/common/formatter.go (L100)
[4] bf2e9655f5/pkg/resources/common/formatter.go (L108)
2023-07-14 14:54:01 -07:00
Colleen Murphy
8128019458
Merge pull request #80 from moio/fix_lru_concurrent_map_write
LRU cache: fix concurrent map write
2023-06-23 13:22:50 -07:00
Ricardo Weir
c53bd62e9c Add tests 2023-06-09 13:18:32 -07:00
Silvio Moioli
7010a5e6c7
proxy_store: improve error handling
This prevents a goroutine leak when item.Object is a `runtime.Object` but not a
`metav1.Object`, as in that case `WatchNames`’s `for` loop will quit early and
subsequent calls to `returnErr` will remain parked forever.

This helps with https://github.com/rancher/rancher/issues/41225
Fuller explanation in https://github.com/rancher/steve/pull/107
2023-06-09 10:55:26 +02:00
Colleen Murphy
1dfd3c711f
Merge pull request #105 from cmurphy/projects-filtering
Add projectsornamespaces query parameter
2023-05-12 10:58:54 -07:00
Colleen Murphy
84dedac146 Add projectsornamespaces query parameter
Add a new query parameter to filter resources by their namespace or
their namespace's project. This parameter is separate from the existing
`filter` parameter.

Filter by a comma-separated list of projects and/or namespaces with:

?projectsornamespaces=p1,n1,n2

The result can be negated with the ! operator:

?projectsornamespaces!=p1,n1,n2
2023-05-11 14:17:39 -07:00
Ricardo Weir
0cabe8de10 Update tests 2023-05-10 22:58:41 -07:00
Ricardo Weir
3db0918eb8 Change cache default to false 2023-05-10 22:58:35 -07:00
Colleen Murphy
e6a8019546
Merge pull request #76 from cmurphy/or-filter
Add support for OR and NOT filters
2023-03-30 04:45:40 -07:00
Colleen Murphy
61a39906f9 Add support for NOT filters
This change adds support for excluding results using the != operator.

Example to exclude all results with name "example":

?filter=metadata.name!=example

Include all results from namespace "example" but exclude those with name
"example":

?filter=metadata.namespace=example&metadata.name!=example

Exclude results with name "foo" OR exclude results with name "bar"
(effectively includes results of both types):

?filter=metadata.name!=foo,metadata.name!=bar
2023-03-23 14:12:14 -07:00
Colleen Murphy
2e4ee872d9 Add support for OR filters
Currently, multiple filters can be appended on the query string, and
each subsequent filter is ANDed with the set. Items that pass through
the filter set must match every filter in the set.

This change adds support for OR filters. A single filter key can specify
multiple filters, separated by ','. An item that passes this filter can
match any filter in the set.

For example, this filter matches items that have either "name" or
"namespace" that match "example":

?filter=metadata.name=example,metadata.namespace=example

This filter matches items that have "name" that matches either "foo" or
"bar":

?filter=metadata.name=foo,metadata.name=bar

Specifying more than one filter key in the query still ANDs each inner
filter set together. This set of filters can match either a name of
"foo" or "bar", but must in all cases match namespace "abc":

?filter=metadata.name=foo,metadata.name=bar&filter=metadata.namespace=abc
2023-03-23 14:12:13 -07:00
Silvio Moioli
44a6096815
LRU cache: fix concurrent map write
Signed-off-by: Silvio Moioli <silvio@moioli.net>
2023-03-15 10:07:43 +01:00
Ricardo Weir
23ae2d3abc Revert client change
Prior, table client configs were mistakenly swapped out for regular
client configs. This caused requests using these methods to no
longer return table column data under metadata.fields. Consequently,
table data was blank in the dashboard UI. Now, the client config
swap has been reverted and table fields should be populated in the
dashboard UI.
2023-02-13 16:36:43 -07:00
Colleen Murphy
9a386b205c Fix resource counts unit tests
Increase the timeout slightly to avoid the occasional premature timeout.
Fix error message typo.
2023-01-20 14:19:05 -08:00
Michael Bolot
59a2c55e14 Fixes a bug with resource.error watch events
Watch events need to have a type defined by
k8s.io/apimachinery/pkg/watch to be properly interpreted. Fixes
a bug where this was not the case
2023-01-11 15:43:42 -06:00
Chad Roberts
65ca114ce0
Expose WarningBuffer type for external use 2023-01-03 11:32:46 -05:00