Giter Site home page Giter Site logo

crane-ui-plugin's Introduction

Crane UI - OpenShift Dynamic Plugin

NOTE: This repository is brand new and under active prerelease development.

The Crane UI plugin provides a UI for constructing container migration pipelines within the OpenShift console.

It is provided as an OpenShift Console dynamic plugin which requires OpenShift 4.11 or greater.

You can run the plugin using a local development environment or build an image to deploy it to a cluster.

Local development

You'll need:

  • Node.js 16+ and Yarn 1.x installed
  • Python and jq installed (for the start-console.sh setup script)
  • An OpenShift 4.11+ cluster (the Console UI will run locally, but it needs a real cluster on the backend)

To set up for local development:

  1. Install dependencies on your cluster. You can install them by installing the crane-operator, or manually:

    • Install the Red Hat OpenShift Pipelines operator from OperatorHub

    • Deploy crane-reverse-proxy including its dev-only route:

      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/dev/namespace.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/default/deployment.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/default/service.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/rbac/serviceAccount.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/rbac/role.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/rbac/clusterRole.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/rbac/roleBinding.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/rbac/clusterRoleBinding.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-reverse-proxy/main/config/dev/route.yaml
    • Deploy crane-secret-service including its dev-only route:

      oc create -f https://raw.githubusercontent.com/konveyor/crane-secret-service/main/config/default/deployment.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-secret-service/main/config/default/service.yaml
      oc create -f https://raw.githubusercontent.com/konveyor/crane-secret-service/main/config/dev/route.yaml
  2. Clone and build the openshift/console repository in a separate directory.

    git clone https://github.com/openshift/console.git
    cd console
    ./build.sh

To run the plugin locally:

  1. From the crane-ui-plugin directory:

    yarn install  # Install dependencies
    yarn build    # Build the plugin, generating output to `dist` directory
    yarn start    # Start an HTTP server hosting the generated assets on port 9001

    The plugin module server runs on port 9001 with CORS enabled.

  2. In a second terminal window, also from the crane-ui-plugin directory:

    (NOTE: replace ../console below with the path to your clone of the openshift/console repository if it is located elsewhere)

    # `oc login` to your cluster, and then:
    yarn start-console ../console

    This script will configure an OAuth client and run the console with auth enabled.

  3. Open the Console in your browser at http://localhost:9000/ and log in.

  4. Find our UI in the following locations on the OpenShift Console's Developer perspective:

    • On the Add page, click one of the actions in the "Import Existing Application" card.
    • In the left-side nav, click "Imported Applications".

Docker image

Before you can deploy your plugin on a cluster, you must build an image and push it to an image registry.

  1. Build the image:

    docker build -t quay.io/yourname/crane-ui-plugin:latest .
  2. Run the image:

    docker run -it --rm -d -p 9001:8080 quay.io/yourname/crane-ui-plugin:latest
  3. Push the image:

    docker push quay.io/yourname/crane-ui-plugin:latest

Deployment on cluster

Console dynamic plugins are supposed to be deployed via OLM operators. However, the plugin can also be deployed manually as follows.

After pushing an image with your changes to a registry, you can deploy the plugin to a cluster by instantiating the provided OpenShift template. It will run a light-weight nginx HTTP server to serve your plugin's assets.

oc process -f template.yaml \
  -p PLUGIN_NAME=crane-ui-plugin \
  -p NAMESPACE=openshift-migration-toolkit \
  -p IMAGE=quay.io/yourname/crane-ui-plugin:latest \
  | oc create -f -

Once deployed, patch the Console operator config to enable the plugin.

oc patch consoles.operator.openshift.io cluster \
  --patch '{ "spec": { "plugins": ["crane-ui-plugin"] } }' --type=merge

References

The structure of this repository is based on spadgett/console-plugin-template.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.