openshift/dynamic-plugin-sdk

@openshift/dynamic-plugin-sdk or @openshift-console/dynamic-plugin-sdk

Closed this issue · 7 comments

Which is correct to use, @openshift/dynamic-plugin-sdk or @openshift-console/dynamic-plugin-sdk?

The OpenShift 4.12 docs here point to the openshift/console-plugin-template repo. That repo is using @openshift-console/dynamic-plugin-sdk.

I noticed that @openshift-console/dynamic-plugin-sdk is missing implementations of documented functions like k8sListResource, k8sCreateResource, etc. The types are there but the implementation isn't. Those functions are implemented in this repo though.

Hello @RyanMillerC

Which is correct to use, @openshift/dynamic-plugin-sdk or @openshift-console/dynamic-plugin-sdk?

OpenShift Console 4.12 uses its own plugin SDK implementation via @openshift-console/dynamic-plugin-sdk and @openshift-console/dynamic-plugin-sdk-webpack packages. When writing a plugin for OpenShift Console 4.12 or earlier, you should use these packages.

See "OpenShift Console Versions vs SDK Versions" section in Console plugins README which maps Console release versions to plugin SDK package versions.

I noticed that @openshift-console/dynamic-plugin-sdk is missing implementations of documented functions like k8sListResource, k8sCreateResource, etc. The types are there but the implementation isn't.

Console K8s utility functions like k8sListResource are declared here - these are typically wrapped via adapterFunc for backwards API compatibility.

These utilities should be available through @openshift-console/dynamic-plugin-sdk package in terms of both code and typings 🤔 when you clone Console repo and run yarn install it will automatically rebuild all Console plugin SDK dist packages at frontend/packages/console-dynamic-plugin-sdk/dist.

The core subdirectory is for @openshift-console/dynamic-plugin-sdk package published to npmjs. Console k8sListResource and other K8s utilities are in lib/utils/k8s/k8s-resource.js under this subdirectory.

I think the issue may be with export name - the function is exported under name k8sList and not k8sListResource.

export {
  k8sGetResource as k8sGet,
  k8sCreateResource as k8sCreate,
  k8sUpdateResource as k8sUpdate,
  k8sPatchResource as k8sPatch,
  k8sDeleteResource as k8sDelete,
  k8sListResource as k8sList,
  k8sListResourceItems as k8sListItems,
} from '../utils/k8s';

Those functions are implemented in this repo though.

Right, we copied Console K8s utility functions into this repo and tweaked them a bit. But we export them as e.g. k8sListResource instead of k8sList which is likely the source of confusion 😃

Thanks for the response @vojtechszocs.

To be 100% clear, I'm developing a plugin that will be bundled into a community operator. Based on your reply I will use (@openshift-console/dynamic-console-plugin and related) that github.com/openshift/console provides since I'm targeting OpenShift 4.12 and below.

Are the packages (@openshift/dynamic-console-plugin and related) that this repo provides for future versions of OpenShift (4.13 and on)?


What threw me off on k8sListResource vs k8sList is this comment that says to use k8sCreateResource instead of k8sCreate:

@deprecated Use {@link k8sCreateResource} instead.
...
export const k8sCreate = <R extends K8sResourceCommon>(
...

The other get, create, and list functions have a similar deprecated message.

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.