* Continue rebasing.
* Wrote unit tests for external associations.
* Fix the generated SQL.
Some syntactic sugar (capitalizing the keywords), but use the 'ON' syntax on JOINs.
* We want "management.cattle.io.projects:spec.displayName" not "...spec.clusterName"
* Implement hard-wired external associations:
* The table is in sqlproxy.proxy_store
- externalGVKDependencies - a map of GVKs to dependencies.
When the key GVK is updated, it triggers the updates in the database for the dependent GVKs,
replacing fields as specified in the table.
* This is done in an afterUpsert handler, but it's done after the transaction for the core
GVK update is finished, because most likely the dependent GVK updates will depend on the
final database values for the GVK being updated, and if we do it as part of the transaction
the new values won't be committed to the database.
* When an object is modified/created, check for external deps that need updating.
* Stop emitting errors when joining tables if one of the tables doesn't exist.
* Update unit test syntax for SQL queries.
* And an override check
This ensures we don't overwrite good data when
pulling data from one table to another.
* Drop labels, and use mgmt.cattle.io/spec.displayName
There's no need to hardwire labels in proxy_store:typeSpecificIndexedFields
because all labels are indexed in the shadow labels table.
* Keep clusterName, add displayName for mgmt.cattle.io
* Fix rebase/merge breakage.
* Finish the merge: add the 'selfUpdateInfo' param where it didn't get inserted during merge.
* Patch up rebase failures.
* Now gomock generates named args. I give up.
* Continue rebasing.
* Wrote unit tests for external associations.
* Fix the generated SQL.
Some syntactic sugar (capitalizing the keywords), but use the 'ON' syntax on JOINs.
* whitespace fix post rebase
* We want "management.cattle.io.projects:spec.displayName" not "...spec.clusterName"
* Fix the database calls: drop the key
* Fix breakage during automatic rebase merging gone wrong.
* ws fix - NFC
* Post rebase-merge fixes
* Fix rebase-driven merge.
* Fix rebase breakage.
* go-uber v0.5.2 prefers real arg names to '<argN>'
* 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...
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.
Previous SQLite-related code used context.Background() and context.TODO() because it was not developed with context awareness.
This commit propagates the main Steve context so that it can be used when interacting with SQL context-aware functions.
This PR removes all production-code use of context.Background() and context.TODO() and replaces test-code use of TODO with Background.
Contributes to rancher/rancher#47825
* bump lasso to include pull #111
Signed-off-by: Silvio Moioli <silvio@moioli.net>
* Make IsListWatchable public to be reused in other packages
Signed-off-by: Silvio Moioli <silvio@moioli.net>
* Let lasso know whether a type is watchable upon requesting a cache
Signed-off-by: Silvio Moioli <silvio@moioli.net>
* Adapt existing tests
Signed-off-by: Silvio Moioli <silvio@moioli.net>
* Add a test to check watchability is detected correctly
Signed-off-by: Silvio Moioli <silvio@moioli.net>
---------
Signed-off-by: Silvio Moioli <silvio@moioli.net>
Adds logic which adds virtual fields resources. This allows these fields
to be sorted/filtered on when the SQL cache is enabled. Id and
metadata.state.name were added as the first two fields.
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>