-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution for paginating the Discover page (#496) #525
Commits on Sep 30, 2024
-
feat: Introduce limit and continue parameters to kubernetes uris (haw…
…tio#496) * In order to paginate results, kubernetes uses 'limit' to limit the request and then returns a reference as a 'continue' property. By including the latter in the next query then next set of results can be obtained (see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#list-pod-v1-core) * globals.ts * Modifies KubeObjectList to support the optional properties of limit and continue defined in the KLimitMetadata type * Adds a PagingMetadata class for keeping track of paging references and the current index of the query, ie. <prev-ref> <index> <next-ref> * PagingMetadata support incremting and decrementing the current index in order to enable the moving to a previous or next set of results. * Kubernetes-service.ts * Refactored to support adding metadata limit to the watching of pods * Synchronises the pod watching code for both Namespace and Cluster config into a single function (initNamespaceClient). * Adds the namespace limit (nsLimit) to the pod options to be attached to the uri * If there is a continue reference for the current project/namespace then it too is added to the options for appending to the path uri * Watching the pods returns a result metadata as well as the pods which contains the podsRemaining property and a continue reference * The podRemaining property must be added to the 'current' paging metadata whilst the continueRef must be added to the 'next' paging metadata * Holds pods by project rather than just pods so that the project name can be used as an index reference for the pods * Holds metadata for each project so that the project name can be used as an index reference * Adds functions 'findNextPods' and 'findPrevPods' allowing clients to request the relevant alternative set of pods from the given namespace * collection.ts * Creates a metadata object for holding the limit and continue reference * Passes the metadata object through to the WsHandler responsible for doing the actual uri fetch * ws-handler.ts * Removes the support for websockets since they require the watch=true uri parameter which is incompatible with limit and continue. * Polling becomes the default mechanism instead for determine if there are any changes * OnMessage receives the response from the cluster and will also update the metadata object with the 'remaining' and 'continue' properties * object-poller.ts * Now responsible for fetching the cluster results, also communicates the metadata as part of the onMessage event back up to the WSHandler
Configuration menu - View commit details
-
Copy full SHA for f60a384 - Browse repository at this point
Copy the full SHA f60a384View commit details -
feat: Rework paging algorithm of kubernetes-api (hawtio#496)
* Current paging algorithm buggy and unnecessarily complex. Using limit, we are trying to save on network data load but this is not the issue with discover tab slowdown. Rather the slowdown is the number of pods being displayed and handled in the UI. * Better methodology: 1) Watch namespace and collect names of pods that are jolokia and add to a set 2) Take a page/chunk of pod names and watch them individually 3) Return only those pods watched for display in the UI 4) Prev/Next will move on the page/chunk in the pod name list and re-init the pod watchers accordingly * Removes the PagingMetadata * Fetches all the pods in a namespace using namespace watcher and adds names to list * Takes chunk from list determined by 'current' page and 'limit' size and starts watching each pod using fieldSelector. Provides only those pods as the collection of pods that k8Service displays for the namespace * Restores the wss handler and connections since no longer using limit and continue references. * No longer need to refresh continue tokens since not used * Changes name of Collection interface to Watched since it also now handles single entities being returned from k8 fieldSelector name API calls * NamespaceClients no longer need to be destroyed and recreated in order to work with pod changes. The pod watchers inside it are renewed if prev/next is called but otherwise those pod watchers already initialised are retained. Only those no longer in the 'page' are removed * Ref key from ClientFactor uses options name rather than continue ref * PagingMetadata interface refactored to Paging and applied to K8 Service and each namespace client
Configuration menu - View commit details
-
Copy full SHA for 8a9ab08 - Browse repository at this point
Copy the full SHA 8a9ab08View commit details -
Updates Kubernetes test app (hawtio#496)
* Places the API Properties in a tab to give all tabs more space * Adds Prev and Next buttons to pods tab to choose the next set of pods to display in the namespace * Puts projects inside an Accordian to separate out the pods logically * KubernetesPods -> KubernetesProjectPods * KubernetesClient removed as folded into Kubernetes component
Configuration menu - View commit details
-
Copy full SHA for 9cca8ca - Browse repository at this point
Copy the full SHA 9cca8caView commit details -
Configuration menu - View commit details
-
Copy full SHA for a896f2d - Browse repository at this point
Copy the full SHA a896f2dView commit details -
feat: Exposes the namespace limit for pod display (hawtio#496)
* Allows the namespace limit of the kubernetes service to be updated and resets all namespace clients to reconnect with the new limit value * Adds number input component to Kubernetes test app
Configuration menu - View commit details
-
Copy full SHA for 0d735b4 - Browse repository at this point
Copy the full SHA 0d735b4View commit details -
feat: Exposes the jolokia polling interval (hawtio#496)
* Allows user to extend/reduce the polling interval for updating of the pods
Configuration menu - View commit details
-
Copy full SHA for 5e2892b - Browse repository at this point
Copy the full SHA 5e2892bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6bd873c - Browse repository at this point
Copy the full SHA 6bd873cView commit details -
fix: Updates Discover component to support previous / next buttons (h…
…awtio#496) * Discover.tsx * Move loading-panel into its own component DiscoverLoadingPanel * Puts the pods into tabs based on the projects/namespaces * New DiscoverProjectContent for each project * DiscoverProjectContent * Lists the limited selection of pods from management-service * When next button is clicked, the signal is sent to the management-service to fetch the 'next' selection of pods for the given namespace * DiscoverToolbar * Sorts the tab order since they are the namespaces * Sorts the pods in each namespace tab * Filters applied in line with patternfly guidelines * Filters of same attribute applied as OR * Filters of different attributes applied as AND * Filters are first concatenated together before being applied * HeaderMenuDropDown * Reimplemented with flyout sub-menus for the pods separated by namespace * context * Replacement of groupds / pods with projects * Addition of refreshing flag to indicate when pods are being refreshed awaiting a management update from prev/next buttons * discover-service split with new discover-project class that encapsulates the discover-projects and pods received from management
Configuration menu - View commit details
-
Copy full SHA for df7c3db - Browse repository at this point
Copy the full SHA df7c3dbView commit details -
Exposes Discover Preferences (hawtio#496)
* Allows users to change the number of pods displayed in each Discover tab and the polling interval to determine heartbeat to jolokia container ports
Configuration menu - View commit details
-
Copy full SHA for 7f2cecd - Browse repository at this point
Copy the full SHA 7f2cecdView commit details -
fix: Replaces the prev/next buttons with patternfly pagination (hawti…
…o#496) * The prev/next buttons were created when it was unknown how many pods would be returned for each namespace. Since we now have this information a patternfly pagination component can be implemented instead, complete with pod total, first and last functions. * namespace-client.ts * Returns total number of pods in namespace as separate parameter in callback * Adds first / last / page functions to accompany next and previous * management-service.ts * Adds Paging interface functions as pass-throughs to k8 service * Discover.ts * Adds total pods to tab titles * DiscoverProjectContent.ts * Replaces buttons with pagination component
Configuration menu - View commit details
-
Copy full SHA for 20bae4f - Browse repository at this point
Copy the full SHA 20bae4fView commit details -
Change filtering to push down into the mgmt and k8 services (hawtio#496)
* namespace-client.ts * Change name of 2nd callback parameter to fullPodCount to make it clear this is the total jolokia pods after filtering but before page slicing * Adds filtering and sorting getters/setters to affect the pods returned by the pod watchers * If any change occurs from filtering or sorting then the callback should be called in order to notify the UI * filter.ts * Refactors the TypeFilter to be a single class containing both namespace and pod name values * kubernetes-service.ts * Add/remove the pod projects to/from the service depending on if there are pods returned after filtering * management-service.ts * Add/remove the mgmt pod projects to/from the service depending on if there are pods returned after filtering * Discover context * Use only 1 filter rather than an array * Breaks out the empty state into its own component for use in other parts of the Discover page * DiscoverProjectContent.ts * Needs refresh Effect to reset the pagination index if it is greater than the project count returned * DiscoverToolbar.ts * When the buttons are clicked call the management service functions for filtering and sorting so that all pod projects down to the k8 service are effected. * discover-service.ts * Only responsible for grouping pods rather as filtering is re-assigned to other services
Configuration menu - View commit details
-
Copy full SHA for c1dc5b5 - Browse repository at this point
Copy the full SHA c1dc5b5View commit details -
Fix: Changes as per review comments
* client-instance.ts * Removes _ from parameter var * globals.ts * paging-metadata-impl.ts * Removes metadata: KubeSeachMetadata on account of no longer used * namespace-client.ts * Sort the jolokiaPods when using getter if a sort order has been specified * ws-handler.ts * Commas rather than + in log strings * Return type for getters * index.ts * Only export specified objects * kubernetes-service.ts * k8 -> k8s * managed-project.ts * Uses correct log from globals
Configuration menu - View commit details
-
Copy full SHA for 92bee79 - Browse repository at this point
Copy the full SHA 92bee79View commit details -
fix: Cannot rely of Object.values to return ordered properties
* Since pods are fetched from an Object hashed by their uids, it is not certain that the pods will be correctly sorted when the sort button is clicked. Need to explicitly sort them. * Discover.tsx * context.ts * Adds a podOrder state object to context so that the DiscoverToolbar can update it and have it used when groupPods() is called * DiscoverToolbar.tsx * Set the pod order before telling the mgmt service to sort * discover-project.ts * When refreshing have it take into account the pod order that has been requested
Configuration menu - View commit details
-
Copy full SHA for 498a54a - Browse repository at this point
Copy the full SHA 498a54aView commit details
Commits on Oct 1, 2024
-
chore: Adds unit tests for classes
* kubernetes-api * Mocks @hawtio/react module to export a mock Logger * Unit tests for support.ts * Unit tests for namespace-client.ts * namespace-client-test.ts * Mocks CollectionImpl to avoid any network action * online-shell * Mocks @hawtio/react module to export a mock Logger * Unit tests for discover-project.ts * discover-project-tests.ts * Mocks online-oauth, management-api and provides a mock ManagedPod class
Configuration menu - View commit details
-
Copy full SHA for 5d5678e - Browse repository at this point
Copy the full SHA 5d5678eView commit details