
Product
Introducing Socket Scanning for OpenVSX Extensions
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
@stolostron/multicluster-sdk
Advanced tools
Provides extensions and APIs that dynamic plugins can use to leverage multicluster capabilities provided by Red Hat Advanced Cluster Management.
A React SDK for working with multicluster OpenShift/Kubernetes resources from the OpenShift Console.
This SDK provides extensions and APIs that dynamic plugins can use to leverage multicluster capabilities provided by Red Hat Advanced Cluster Management (RHACM). It aims to provide similar functionality to the dynamic plugin(https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) SDK but for multicluster scenarios.
npm install @stolostron/multicluster-sdk
The multicluster SDK provides components and hooks that enable your dynamic plugins to work with resources across multiple clusters.
Setup depends on your usage scenarios.
useIsFleetAvailable hook to check if support is available. Because it is not permitted to call hooks conditionally, if you are using these multicluster SDK hooks, then you must call them with arguments that render the hook in a disabled state when fleet support is unavailable. Otherwise you will get empty results or errors. See the API Reference for details.REQUIRED_PROVIDER_FLAG constant.// Example code will be added after API stabilization
| Function | Type |
|---|---|
fleetK8sCreate | <R extends K8sResourceCommon>(options: OptionsCreate<R>) => Promise<R> |
| Function | Type |
|---|---|
fleetK8sDelete | <R extends K8sResourceCommon>(options: OptionsDelete<R>) => Promise<R> |
| Function | Type |
|---|---|
fleetK8sGet | <R extends K8sResourceCommon>(options: OptionsGet) => Promise<R> |
| Function | Type |
|---|---|
fleetK8sPatch | <R extends K8sResourceCommon>(options: OptionsPatch<R>) => Promise<R> |
| Function | Type |
|---|---|
fleetK8sUpdate | <R extends K8sResourceCommon>(options: OptionsUpdate<R>) => Promise<R> |
| Function | Type |
|---|---|
FleetResourceLink | React.FC<FleetResourceLinkProps> |
| Function | Type |
|---|---|
getFleetK8sAPIPath | (cluster?: string or undefined) => Promise<string> |
Hook that provides information about user access to a given resource.
| Function | Type |
|---|---|
useFleetAccessReview | ({ group, resource, subresource, verb, name, namespace, cluster, }: FleetAccessReviewResourceAttributes) => [boolean, boolean] |
Parameters:
resourceAttributes: resource attributes for access reviewresourceAttributes.group: the name of the group to check access forresourceAttributes.resource: the name of the resource to check access forresourceAttributes.subresource: the name of the subresource to check access forresourceAttributes.verb: the "action" to perform; one of 'create' | 'get' | 'list' | 'update' | 'patch' | 'delete' | 'deletecollection' | 'watch' | 'impersonate'resourceAttributes.name: the nameresourceAttributes.namespace: the namespaceresourceAttributes.cluster: the cluster name to find the resource inReturns:
Array with isAllowed and loading values.
| Function | Type |
|---|---|
useFleetClusterNames | UseFleetClusterNames |
| Function | Type |
|---|---|
useFleetK8sAPIPath | UseFleetK8sAPIPath |
A hook for watching Kubernetes resources with support for multi-cluster environments.
It is equivalent to the useK8sWatchResource
hook from the OpenShift Console Dynamic Plugin SDK
but allows you to retrieve data from any cluster managed by Red Hat Advanced Cluster Management.
It automatically detects the hub cluster and handles resource watching on both hub and remote clusters using WebSocket connections for real-time updates.
| Function | Type |
|---|---|
useFleetK8sWatchResource | UseFleetK8sWatchResource |
Parameters:
initResource: - The resource to watch. Can be null to disable the watch.initResource.cluster: - The managed cluster on which the resource resides; null for the hub clusterReturns:
A tuple containing the watched resource data, a boolean indicating if the data is loaded, and any error that occurred. The hook returns live-updating data.
Examples:
// Watch pods on a remote cluster
const [pods, loaded, error] = useFleetK8sWatchResource({
groupVersionKind: { version: 'v1', kind: 'Pod' },
isList: true,
cluster: 'remote-cluster',
namespace: 'default'
})
// Watch a specific deployment on hub cluster
const [deployment, loaded, error] = useFleetK8sWatchResource({
groupVersionKind: { group: 'apps', version: 'v1', kind: 'Deployment' },
name: 'my-app',
namespace: 'default'
})
| Function | Type |
|---|---|
useFleetPrometheusPoll | UsePrometheusPoll |
A React hook that provides fleet-wide search functionality using the ACM search API.
| Function | Type |
|---|---|
useFleetSearchPoll | UseFleetSearchPoll |
Parameters:
watchOptions: - Configuration options for the resource watchwatchOptions.groupVersionKind: - The group, version, and kind of the resource to search forwatchOptions.limit: - Maximum number of results to return (defaults to -1 for no limit)watchOptions.namespace: - Namespace to search in (only used if namespaced is true)watchOptions.namespaced: - Whether the resource is namespacedwatchOptions.name: - Specific resource name to search for (exact match)watchOptions.isList: - Whether to return results as a list or single itemadvancedSearch: - Optional array of additional search filtersadvancedSearch[].property: - The property name to filter onadvancedSearch[].values: - Array of values to match for the propertypollInterval: - Optional polling interval in seconds. Defaults to 30 seconds (polling enabled).30: polls at the given interval in seconds
Returns:
A tuple containing:
data: The search results formatted as Kubernetes resources, or undefined if no resultsloaded: Boolean indicating if the search has completed (opposite of loading)error: Any error that occurred during the search, or undefined if successfulrefetch: A callback that enables you to re-execute the queryExamples:
// Search for all Pods in a specific namespace with default 30-second polling
const [pods, loaded, error] = useFleetSearchPoll({
groupVersionKind: { group: '', version: 'v1', kind: 'Pod' },
namespace: 'default',
namespaced: true,
isList: true
});
// Search for a specific Deployment with polling every 60 seconds
const [deployment, loaded, error] = useFleetSearchPoll({
groupVersionKind: { group: 'apps', version: 'v1', kind: 'Deployment' },
name: 'my-deployment',
namespace: 'default',
namespaced: true,
isList: false
}, [
{ property: 'label', values: ['app=my-app'] }
], 60);
// Search without polling (one-time query)
const [services, loaded, error] = useFleetSearchPoll({
groupVersionKind: { group: '', version: 'v1', kind: 'Service' },
namespaced: true,
isList: true
}, undefined, false);
Hook that provides hub cluster name.
| Function | Type |
|---|---|
useHubClusterName | UseHubClusterName |
Returns:
Array with hubclustername, loaded and error values.
Hook that determines if the fleet support is available.
Checks if the feature flag with the name corresponding to the REQUIRED_PROVIDER_FLAG constant is enabled.
Red Hat Advanced Cluster Management enables this feature flag in versions that provide all of the dependencies
required by this version of the multicluster SDK.
| Function | Type |
|---|---|
useIsFleetAvailable | UseIsFleetAvailable |
Returns:
true if a version of Red Hat Advanced Cluster Management that is compatible with the multicluster SDK is available; false otherwise
| Constant | Type |
|---|---|
REQUIRED_PROVIDER_FLAG | "MULTICLUSTER_SDK_PROVIDER_1" |
| Type | Type |
|---|---|
Fleet | T and { cluster?: string } |
| Type | Type |
|---|---|
FleetAccessReviewResourceAttributes | Fleet<AccessReviewResourceAttributes> |
| Type | Type |
|---|---|
FleetK8sResourceCommon | Fleet<K8sResourceCommon> |
| Type | Type |
|---|---|
FleetResourceLinkProps | Fleet<ResourceLinkProps> |
| Type | Type |
|---|---|
FleetWatchK8sResource | Fleet<WatchK8sResource> |
| Type | Type |
|---|---|
UseFleetClusterNames | () => [string[], boolean, any] |
| Type | Type |
|---|---|
UseFleetK8sAPIPath | ( cluster?: string ) => [k8sAPIPath: string or undefined, loaded: boolean, error: Error or undefined] |
| Type | Type |
|---|---|
UseFleetK8sWatchResource | <R extends FleetK8sResourceCommon or FleetK8sResourceCommon[]>( initResource: FleetWatchK8sResource or null ) => WatchK8sResult<R> or [undefined, boolean, any] |
| Type | Type |
|---|---|
UseHubClusterName | () => [hubClusterName: string or undefined, loaded: boolean, error: any] |
Signature of the useIsFleetAvailable hook
| Type | Type |
|---|---|
UseIsFleetAvailable | () => boolean |
All contributions to the repository must be submitted under the terms of the Apache Public License 2.0. For contribution guidelines, see CONTRIBUTING.md.
FAQs
Provides extensions and APIs that dynamic plugins can use to leverage multicluster capabilities provided by Red Hat Advanced Cluster Management.
We found that @stolostron/multicluster-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies