pixie icon indicating copy to clipboard operation
pixie copied to clipboard

Add Pixie UI support for script bundle env var

Open htroisi opened this issue 3 years ago • 2 comments

Problem When installing Pixie in an air gap environment , the Pixie UI will fail to load, unless you set up the script dev environment: image

Feature request The UI should honor an env variable at build time to point somewhere else for the bundle. The UI should also provide a more useful error message when it fails to load a bundle.

htroisi avatar Jul 11 '22 19:07 htroisi

Done in this commit.

Here's what changed:

  • Two new env vars, in script_bundles_config.yaml for each environment in k8s/cloud/*:

    • SCRIPT_BUNDLE_URLS: A JSON-stringified array of URL strings. Defaults to the OSS bundle. Pixie's UI tries to load a JSON document from each URL in this array. User can override, see below.

    • SCRIPT_BUNDLE_DEV: A JSON-stringified boolean. Defaults to "false". If "true", bundles are queried with a cache-busting timestamp parameter to make script development a bit easier. The instructions as-is still work, it's only the defaults that work differently.

  • There's a new localStorage key, px-custom-script-bundle-paths.

    • If set, it replaces the value of SCRIPT_BUNDLE_URLS and forces SCRIPT_BUNDLE_DEV on.
    • If it isn't set, the old localStorage keys are checked like before.
  • If Pixie's UI fails to load a script bundle, it now shows an error view linking to these instructions.

NickLanam avatar Jul 21 '22 21:07 NickLanam

@NickLanam I ran into the new UI error when following the self-hosted install guide using a minikube test cluster. Screen Shot 2022-08-18 at 1 51 58 PM

I was using the default yamls (I didn't change SCRIPT_BUNDLE_URLS or SCRIPT_BUNDLE_DEV), so I wasn't expecting to see this error.

It looks isDev is getting set to true in script-bundle.tsx, given that I get the SCRIPT_BUNDLES_OVERRIDDEN error. Yet, pl-script-bundles-config shows

Name:         pl-script-bundles-config
Namespace:    plc
Labels:       app=pl-cloud
Annotations:  <none>

Data
====
SCRIPT_BUNDLE_DEV:
----
false
SCRIPT_BUNDLE_URLS:
----
[ "https://storage.googleapis.com/pixie-prod-artifacts/script-bundles/bundle-oss.json" ]

BinaryData
====

Events:  <none>

htroisi avatar Aug 18 '22 21:08 htroisi

Closing this because I have not been able to reproduce this bug.

htroisi avatar Sep 26 '22 21:09 htroisi