This project is a standalone repository hosting the Kubevirt plugin for OpenShift Console.
Please follow the steps below to open an issue for this repository.
Navigate to the OpenShift Virtualization issues page and search for the issue using the search bar in the upper right-hand corner. If your issue doesn't exist you'll need to open a new one.
You must be logged in with a Red Hat account to open an issue. If you already have an account click the Log In button in the upper right-hand corner and enter your credentials. If you don't, follow the instructions here to create one.
Once you're logged in, navigate back to the OpenShift Virtualization issues page and click the blue Create button in the top navigation bar to open the Create Issue form.
Enter a concise, but descriptive summary of the problem in the Summary field, provide the requested information in the Description field, and select 'CNV User Interface' from the Component/s dropdown menu. The information in the Description field is critical to ensuring a prompt fix, so please be thorough.
Click the Create button at the bottom then click on the link in the alert that pops up on the right side of the screen to open the issue. Do this quickly as it won't be displayed for very long. Write down the issue ID (Ex: CNV-12345) so you can easily locate the issue later.
Open two terminals and navigate to the kubevirt-plugin directory in both of them. The first terminal will run a containerized instance of console and the second will run the kubevirt-plugin.
In the first terminal:
- Log into the OpenShift cluster you are using.
- Run
yarn start-console
OR./start-console.sh
OR./start-console-auth-mode.sh
.
In the second terminal:
- Run
yarn && yarn dev
NOTE: ./start-console-auth-mode.sh
is when authentication is needed, start-console.sh
, ignores authentication.
Make sure the Remote Containers extension is installed. This method uses Docker Compose where one container is the OpenShift console and the second container is the plugin. It requires that you have access to an existing OpenShift cluster. After the initial build, the cached containers will help you start developing in seconds.
- Create a
dev.env
file inside the.devcontainer
folder with the correct values for your cluster:
OC_PLUGIN_NAME=kubevirt-plugin
OC_URL=https://api.example.com:6443
OC_USER=kubeadmin
OC_PASS=<password>
(Ctrl+Shift+P) => Remote Containers: Open Folder in Container...
yarn dev
- Navigate to http://localhost:9000
yarn test-cypress-docker
- Navigate to http://localhost:10000
- login with password
kubevirt
(no need for username)
- Set up Console and See the plugin development section in Console Dynamic Plugins README for details on how to run OpenShift console using local plugins.
- Run bridge with
-plugins kubevirt-plugin=http://localhost:9001/ -i18n-namespaces=plugin__kubevirt-plugin
- Run
yarn dev
inside the plugin.
You should use the useKubevirtTranslation
hook as follows:
conster Header: React.FC = () => {
const { t } = useKubevirtTranslation();
return <h1>{t('Hello, World!')}</h1>;
};
For labels in console extensions files, you should use the format
%plugin__kubevirt-plugin~My Label%
. Console will replace the value with
the message for the current language from the plugin__kubevirt-plugin
namespace. For example:
{
"type": "console.navigation/section",
"properties": {
"id": "admin-demo-section",
"perspective": "admin",
"name": "%plugin__kubevirt-plugin~VirtualMachines%"
}
}
Note that you will need to include a comment in utils/i18n.ts
like the
following for i18next-parser to
add the message from console extensions files to your message catalog as follows:
// t('plugin__kubevirt-plugin~VirtualMachines')
Run yarn i18n
to update the JSON files in the locales
folder of the
dynamic plugin when adding or changing messages.
- Build the image:
docker build -t quay.io/kubevirt-ui/kubevirt-plugin:latest .
- Run the image:
docker run -it --rm -d -p 9001:80 quay.io/kubevirt-ui/kubevirt-plugin:latest
- Push the image to the image registry:
docker push quay.io/kubevirt-ui/kubevirt-plugin:latest
After pushing an image with your changes to an image registry, you can deploy the plugin to a cluster by instantiating the template:
oc process -f oc-manifest.yaml \
-p PLUGIN_NAME=kubevirt-plugin \
-p NAMESPACE=kubevirt-ui \
-p IMAGE=quay.io/kubevirt-ui/kubevirt-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": ["kubevirt-plugin"] } }' --type=merge