Skip to content
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

Custom chart plugins not working in Kubernetes deployment #29588

Closed
3 tasks done
mayanklalwani opened this issue Jul 14, 2024 · 2 comments
Closed
3 tasks done

Custom chart plugins not working in Kubernetes deployment #29588

mayanklalwani opened this issue Jul 14, 2024 · 2 comments
Labels
infra:container Infra container and K8s plugins

Comments

@mayanklalwani
Copy link

Bug description

I made a custom chart plugin and tested it locally (through docker-compose deployment) and the chart was working fine. I tried deploying the same docker image on Kubernetes cluster where my application is working, I can see the new plugin code is there at the desired location after this but the chart doesn't appear on the UI.

How to reproduce the bug

1.) Create a new chart plugin.
2.) Deploy on Superset running through Kubernetes.
3.) After successful deployment, check if the new chart appears on UI.

Screenshots/recordings

No response

Superset version

3.1.3

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added infra:container Infra container and K8s plugins labels Jul 14, 2024
Copy link

dosubot bot commented Jul 14, 2024

The issue might be related to the dynamic imports (lazy-loading) of your custom chart plugin components. When deploying on a Kubernetes cluster, the environment might not be correctly resolving these dynamic imports, which can cause the plugin not to appear on the UI.

In the ChartPlugin class, the sanitizeLoader function is used to handle dynamic imports. Ensure that your Kubernetes environment has the necessary configurations to support these dynamic imports.

Here is a snippet from the ChartPlugin class that deals with dynamic imports:

function sanitizeLoader<T extends object>(
  loader: PromiseOrValueLoader<ValueOrModuleWithValue<T>>,
): PromiseOrValueLoader<T> {
  return () => {
    const loaded = loader();

    return loaded instanceof Promise
      ? (loaded.then(
          module => ('default' in module && module.default) || module,
        ) as Promise<T>)
      : (loaded as T);
  };
}

Make sure that your Kubernetes deployment is set up to handle these dynamic imports correctly. This might involve ensuring that the necessary files are available and correctly referenced in your deployment configuration [1].

Additionally, you need to enable the DYNAMIC_PLUGINS feature flag in the superset_config.py file. This can be done by specifying key/value entries in configOverrides in your values.yaml file:

configOverrides:
  my_override: |
    FEATURE_FLAGS = {
        "DYNAMIC_PLUGINS": True
    }

This configuration will ensure that the DYNAMIC_PLUGINS feature is enabled, allowing you to deploy custom chart plugins in Apache Superset [2][3].

To continue talking to Dosu, mention @dosu.

@mayanklalwani
Copy link
Author

Yes, these settings are there in my environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra:container Infra container and K8s plugins
Projects
None yet
Development

No branches or pull requests

1 participant