* working for positive case
* changed to custom code
* removed comment
* added tests
* fixing ci error
* one more fix
* Update proxy_store tests for projectornamespace parsing.
Since we no longer need to execute a db query, and just return a filter,
we can drop a lot of code.
* added distinct back to conform with other queries
* one more fix
---------
Co-authored-by: Eric Promislow <epromislow@suse.com>
* Sort by ID rather than metadata.namespace,metadata.name
- In tests add an id field to the list of fields to cache/create and to the objects.
* Add benchmark tests to compare sorting by ns/name vs id.
* On Reset, remove all the sqlite files, not just the main one.
* Avoid resetting the database and cache when not needed.
Avoid resetting when a change doesn't bring in new schema fields.
Always reset when a CRD is deleted.
* Force a database reset when a new CRD is added.
* Improve code readability. No functional change.
* changed ParseQuery projectornamespace handling
* addressed comments from eric/chad and tom
* fixing lint error
* added resourceVersion to list
* updated mocks
* updated tests
* Update tests after rebase
---------
Co-authored-by: Tom Lebreux <tom.lebreux@suse.com>
* Add Tokens and Kubeconfig fields to date mapping
* Fix missing cols in transform func for watch
* Mark CRDs as.. CRD
* Don't transform CRD's date field
* More error wrapping for SQL cache
* Use context.Context instead of stopCh
* Move CacheFor to Info log level
* Implement time-based GC
* Set default GC param when running standalone steve
* 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.
* Wrote unit tests for external associations.
* 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.
* Finish rebasing manually.
* Fix external association unit-tests after rebasing.
Specifically, recomment a test that was uncommented in this PR,
and revert the underlying code that made this test pass. That
code change causes user-based integration tests to fail, so something
is not correct in that code.
This was actually unrelated to the reason for PR 633, to fix
a problem when sorting on a label that dropped objects that
didn't have that label. That part remains untouched.
* Use SQL `WITH` statements to sort unbound labels.
These are labels whose names are never positively referenced in a filter,
so they don't need to exist on the row that we still want to display.
Here I create a virtual table of all the rows, substituting a null
value for each label that isn't associated on the row, and then sort on that.
* Just always select-distinct for now.
* Add more tests for filtering/sorting
- Assign more values to the cattle and horses labels
- Move the sortfield value to a number in the 100s -- keep in mind
these values are sorted by ascii value of underlying chars, not numerically
- Rename the var names to better reflect the values they contain
* Remove mentions of the prepared SQL statement in the test descriptions.
We care either about the items we get back from the query, or in some
cases the SQL that gets generated by the AST interpreter.
* Simplify the use of WITH stmts in SQL (thx Tom)
* Fix the comment about an unexpected situation.
* Fix post-rebase tests.
* 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>'