An OpenShift web console plugin for kubernetes-nmstate. The plugin adds a web-based user interface for managing node network configuration inside the OpenShift console.
NMState is a tool for state-driven network configuration on cluster nodes. This plugin provides four main views:
- Policies — create, edit, and delete
NodeNetworkConfigurationPolicyresources - States — browse
NodeNetworkStatefor each node with detailed interface info - Physical Networks — overview of physical network interfaces and enactment status
- Node Network Configuration — topology visualization of node network layouts
- NMState Operator installed on the cluster
- OpenShift Console 4.12+
git clone git@github.com:openshift/nmstate-console-plugin.git
cd nmstate-console-plugin
npm install
npm run start-consoleThe OpenShift console runs at http://localhost:9000 with the plugin loaded on port 9001.
Requires a running OpenShift or Kubernetes cluster (see Development for cluster setup options).
cd nmstate-console-plugin
npm run dev -- --port 9443 \
--server-type https \
--server-options-key /var/serving-cert/tls.key \
--server-options-cert /var/serving-cert/tls.crt| Requirement | Description |
|---|---|
| Node.js | JavaScript runtime environment |
| npm | Package manager for Node.js (included with Node.js) |
| Kubernetes | An OpenShift or Kubernetes cluster |
| kubectl | The Kubernetes command-line tool |
You can create a small OpenShift environment using OpenShift Local or KinD. OpenShift Local installs all necessary services. When using KinD, you may need to set up the development environment manually.
# Deploy a minimal Kubernetes cluster with storage, registry, and admin user
bash scripts/deploy-cluster.sh
# Delete the cluster and local registry (removes all workloads and data)
bash scripts/clean-cluster.shRunning virtualized workloads (e.g. virtual machines) on this cluster requires starting the cluster as root:
sudo bash scripts/deploy-cluster.sh
npm install
npm run start-consoleThe OpenShift console runs in a container connected to your current cluster. The plugin HTTP server runs on port 9001 with CORS enabled. The development server is available at http://localhost:9000.
start-console accepts these environment variables:
| Variable | Description |
|---|---|
| CONSOLE_IMAGE | Console image to run (default: quay.io/openshift/origin-console:latest) |
| CONSOLE_PORT | Console web application port (default: 9000) |
| INVENTORY_SERVER_HOST | NMState inventory server URL (default: http://localhost:30088) |
| BRIDGE_K8S_AUTH_BEARER_TOKEN | Bearer token for user account (on OpenShift defaults to $(oc whoami -t)) |
| BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT | Kubernetes API server URL (default: guessed from kubeconfig) |
When running on a cluster without NMState installed, install only the missing CRDs:
kubectl apply -f scripts/yaml/crds
When running OpenShift Local, install NMState and KubeVirt via OperatorHub. On KinD, use the CI scripts.
export BRIDGE_K8S_MODE_OFF_CLUSTER_ENDPOINT=$(oc whoami --show-server)
export BRIDGE_K8S_AUTH_BEARER_TOKEN=$(oc whoami --show-token)
export INVENTORY_SERVER_HOST=https://$(oc get routes -o custom-columns=HOST:.spec.host -A | grep 'nmstate-inventory' | head -n 1)
npm run devoc process -f oc-manifest.yaml \
-p PLUGIN_NAME=nmstate-console-plugin \
-p NAMESPACE=openshift-nmstate \
-p IMAGE=quay.io/nmstate/nmstate-console-plugin:latest \
| oc create -f -Enable the plugin:
oc patch consoles.operator.openshift.io cluster \
--patch '{ "spec": { "plugins": ["nmstate-console-plugin"] } }' --type=mergehelm upgrade -i nmstate-console-plugin deployment/nmstate-console-plugin \
-n openshift-nmstate --create-namespaceBy default Helm uses quay.io/nmstate/nmstate-console-plugin:latest. Override with --set image=IMAGE_NAME.
See the chart values for all parameters.
Enable the plugin (if no other console plugins are installed):
oc patch consoles.operator.openshift.io cluster \
--patch '{ "spec": { "plugins": ["nmstate-console-plugin"] } }' --type=mergeIf other console plugins are already installed:
oc patch consoles.operator.openshift.io cluster \
--patch '[{ "op": "add", "path": "/spec/plugins/-", "value": "nmstate-console-plugin" }]' --type=jsonOn OpenShift 4.10, add
--set plugin.securityContext.enabled=falseto omit Pod Security configurations.
npm test # Jest unit tests
npm run test:coverage # Jest with coverage report
npm run cypress # Cypress e2e (headless Chrome)
npm run cypress:open # Cypress interactive modeContributions are welcome. See CONTRIBUTING.md for coding standards and the PR process.
| Reference | Description |
|---|---|
| NMState | NMState project |
| OpenShift web console | Web-based user interface for OpenShift |
| OpenShift Dynamic Plugin SDK | Dynamic plugin SDK for OpenShift user interfaces |
| NMState documentation | Usage documentation for NMState configuration |
| PatternFly | Open-source design system used for OpenShift UI development |
Inspired by forklift-console-plugin.